Skip to content

Repository files navigation

magic-cli

A tools to help you easily develop react(vue) project

Build Statusnpm packagenode versiondeps packagenpm downloadnpm packagePRs Welcome

中文文档

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 :

React:

Vue:

Blueprints :

NameDescription
magic g blueprint <name>generates a blueprint template file

License

MIT

About

A tools to help you easily develop react(vue) project

Topics

Resources

Stars

7 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages