dva-cli

January 13, 2019 ยท View on GitHub

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 [options]

Create app with new directory.

Usage Examples

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

options

  • --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.

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