The dva command line utility.
JavaScript HTML CSS Makefile
Latest commit c7fc76f Jan 13, 2017 @sorrycc sorrycc 0.7.8
Failed to load latest commit information.
bin feat: support specify base Nov 21, 2016
boilerplates upgrade deps Jan 13, 2017
src 0.7.7, fix npm publish problem Jan 10, 2017
.editorconfig πŸ‘» Jul 25, 2016
.gitignore πŸ‘» Jul 25, 2016 chore: update Oct 19, 2016
Makefile rm dist before publish Jul 29, 2016 πŸ˜‹ Dec 21, 2016
package.json 0.7.8 Jan 13, 2017


NPM version NPM downloads

CLI for dva .

Getting Started

Install, create and start.

# Install
$ npm install dva-cli -g

# Create app
$ dva new myapp

# Start app
$ cd myapp
$ npm start


We have 3 commands: new, init and generate(alias g).

dva new [options]

Create app with new directory.

Usage Examples

$ dva new myapp
$ dva new myapp --demo
$ dva new myapp --no-install


  • --demo -- Generate a dead simple project for quick prototype
  • --no-install -- Disable npm install after files created

dva init [options]

Create app in current directory. It's options is the same as dva new.

dva generate (short-cut alias: "g")

Generate route, model and component.

Usage Examples

$ dva g route product-list
$ dva g model products
$ dva g component Editor
$ dva g component Users/UserModal
$ dva g component Header --no-css

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           #


dva-cli use roadhog for build and server, view roadhog#Configuration (δΈ­ζ–‡η‰ˆ) for details.