Skip to content

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

License

Notifications You must be signed in to change notification settings

magic-FE/magic-cli

Repository files navigation

magic-cli

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

Build Status npm package node version deps package npm download npm package PRs 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 :

Name Description
magic g blueprint <name> generates a blueprint template file

License

MIT