dvajs / dva-cli

The dva command line utility.
966 stars 157 forks source link

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