A tools to help you easily develop react(vue) project
With npm do:
$ npm install -g magic-cli
With yarn do:
$ yarn global add magic-cli
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
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
Delete an alias to the template
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
React:
- xfcf1/react-webpack-starter: a simple template with UI component antd
Vue:
- vue-cli template:
vue-cli
official tempalte, we has the same api like it.
Name | Description |
---|---|
magic g blueprint <name> |
generates a blueprint template file |