• Stars
    star
    965
  • Rank 47,414 (Top 1.0 %)
  • Language
    JavaScript
  • Created over 8 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The dva command line utility.

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

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