dvax-cli
v0.2.1
Published
The dva command line utility. X-custom
Downloads
1
Readme
dvax-cli
CLI for dva . X-custom
Custom Feature
- use styled-component
- add state component boilerplate (eg: dvax g route --state)
- add generate service
- add generate module (gen model,route,service together)
- add dynamic router
Getting Started
Install, create and start.
# Install
$ npm install dvax-cli -g
# Create app
$ dvax new myapp
# Start app
$ cd myapp
$ npm start
Commands
We have 3 commands: new
, init
and generate
(alias g
).
dvax new [options]
Create app with new directory.
Usage Examples
$ dvax new myapp
$ dvax new myapp --demo
$ dvax new myapp --no-install
options
--demo
-- Generate a dead simple project for quick prototype--no-install
-- Disable npm install after files created
dvax init [options]
Create app in current directory. It's options is the same as dvax new
.
dvax generate (short-cut alias: "g")
Generate route, model and component.
Usage Examples
$ dvax g route product-list
$ dvax g model products
$ dvax g service products
$ dvax g comp Editor
$ dvax g comp Users/UserModal
$ dvax g comp Header --state
$ dvax g module dict
Generated File Tree
.
├── src # Source directory
├── assets # Store images, icons, ...
├── components # UI components
├── index.css # CSS for entry file
├── index.html # HTML for entry file
├── index.js # Enry file
├── models # Dva models
├── router.js # Router configuration
├── routes # Route components
├── services # Used for communicate with server
└── utils # Utils
└── request.js # A util wrapped dva/fetch
├── .editorconfig #
├── .eslintrc # Eslint config
├── .gitignore #
├── .roadhogrc # Roadhog config
└── package.json #
Configuration
dvax-cli use roadhog for build and server, view roadhog#Configuration (中文版) for details.