Awesome
dva-cli
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
--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.