magic-cli
v1.2.4
Published
A tools to help you easily develop react(vue) project
Downloads
22
Maintainers
Readme
magic-cli
A tools to help you easily develop react(vue) project
install
With npm do:
$ npm install -g magic-cli
With yarn do:
$ yarn global add magic-cli
commands
new
Init a project base on templates
options:
> -c, --clone # Use git clone to download template
> -r, --remote # Download remote template even if the local has a cache
note: We render file use Handlebars.js. You can see it to write template
alias
Add an alias to the template
options:
> -l, --list # List all alias
> -a, --absolute # If local add absolute path
> -d, --desc [desc] # Add some description for alias
unalias:
Delete an alias to the template
g/generate:
Generate files base on blueprint
options:
> -l, --list # list all blueprints
> -c, --cwd [path] # Assign generate start path(work dir)
> -f, --force # overwrite the exsits file instead of ask
example:
if you set a blueprint like this
└── route
├── index.js
└── files
└── __name__
├── __name__Containers.js
├── __name__Components.js
└── __name__Reducers.js
then use
magic g
$ magic g route home
you will get result like this:
└── home
├── homeContainers.js
├── homeComponents.js
└── homeReducers.js
note Formats:
__name.cap__
or__name.capitalize__
=> home to Home__name.low__
or__name.lowercase__
=> Home to home__name.up__
or__name.uppercase__
=> home to HOME__name.dash__
or__name.dashcase__
=> homeName to home-name
The files content also render by this rule , so you can write __name__
will be replaced
Contents
Templates :
Not finish, wait a moment, you can use vue-cli template first, we has the same api like it.
Blueprints :
|Name|Description|
|---|---|
|magic g blueprint <name>
|generates a blueprint template file|