Home

Awesome

dva-cli

NPM version NPM downloads

CLI for dva .


πŸ“’ dva-cli is deprecated, please use create-umi instead, checkout Create a Project with create-umi for detail.


Getting Started

Install, create and start.

# Install
$ npm install dva-cli -g

# Create app
$ dva new myapp

# Start app
$ cd myapp
$ npm start

Commands

We have 2 commands: new, init.

dva new <appName> [options]

Create app with new directory.

Usage Examples

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

options

dva init [options]

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

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

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

License

MIT