Command-line Interface
The Command-line Interface comes with several useful commands that will speed up your development process.
Create a new project with Blue
The project
command creates a new project based on the Blue scaffold structure
$ bcli project my-project
A new folder /my-project
is created in the current working directory and will install all necessary dependency for you.
At the end of this process, change directory in the new project folder and run the development server with
$ npm run dev
That's it!
Project options
Project scaffold version
By default, when running the project
command, the latest Blue scaffold is downloaded, but it's also possible to specify a major version of it by adding the --major
flag
$ bcli project my-project --major 1
Force using NPM or YARN
By default it will look for yarn
if it's installed, otherwise will fallback to npm
.
It is also possible to just force the command line to use one of them running the command with --npm
or -n
for NPM
$ bcli project my-project --npm
--yarn
or -y
for Yarn
$ bcli project my-project --yarn
Force overwrite
When a folder already exists, is possible to overwrite that folder by simply adding the --force
or -f
flag
$ bcli project my-project --force
Git init
By default git is initialized after the project is created, but it's possible to skip that passing the --nocommit
flag
$ bcli project my-project --nocommit
Components, containers and pages
Blue follows the dumb/smart component pattern separating them in: components (dumb), containers (smart) and pages, which are just components used for routing.
to create a component just run
$ bcli component my-component
for a container component run
$ bcli container my-container
and for a page run
$ bcli page home
Vuex store module
We like to create a standalone store module to keep everything clean. Every Vuex store module aspect lives in a separate file: state, getters, actions, mutations and events.
$ bcli store my-module
The store
command comes with few extra questions that can speed up your module creation.
It's possible to pre-populate your code with all events, mutations and actions that you might need for you logic.
Provide a simple string with comma separations like: set token, get token, remove token
when the question is prompted and the CLI will do the rest.
Share your localhost with a secure tunnel
The share
command allows to share the local environment with an https secure tunnel
$ bcli share 8080
The command needs only the port where you application is running and it will install the ngrok globally in your machine, if not available already, to be able to generate a unique url to share.