Skip to content

Commit

Permalink
deprecate dva-cli, prefer create-umi
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Jan 13, 2019
1 parent 1582939 commit 7565fd4
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 23 deletions.
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.DS_Store
tmp
node_modules
lib
dist
coverage
.nyc_output
/yarn.lock
/node_modules
/lib
/dist
/coverage
/.nyc_output

23 changes: 8 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# dva-cli

[![NPM version](https://img.shields.io/npm/v/dva-cli.svg?style=flat)](https://npmjs.org/package/dva-cli)
[![NPM downloads](http://img.shields.io/npm/dm/dva-cli.svg?style=flat)](https://npmjs.org/package/dva-cli)

CLI for [dva](https://github.com/dvajs/dva) .

---

**📢 dva-cli is deprecated, please use [create-umi](https://github.com/umijs/create-umi) instead, checkout [Create a Project with create-umi](https://umijs.org/guide/create-umi-app.html) for detail.**

---

## Getting Started

Install, create and start.
Expand All @@ -22,7 +29,7 @@ $ npm start

## Commands

We have 3 commands: `new`, `init` and `generate`(alias `g`).
We have 2 commands: `new`, `init`.

### dva new <appName> [options]

Expand All @@ -45,20 +52,6 @@ $ dva new myapp --no-install

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

### dva generate <type> <name> (short-cut alias: "g")

Generate route, model and component.

#### Usage Examples

```bash
$ dva g route product-list
$ dva g model products
$ dva g component Editor
$ dva g component Users/UserModal
$ dva g component Header --no-css
```

## Generated File Tree

```bash
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"dva-ast": "^0.3.5",
"empty-dir": "^0.2.1",
"fs-extra": "^0.30.0",
"inquirer": "^6.2.1",
"left-pad": "^1.1.3",
"path-exists": "^3.0.0",
"simple-uppercamelcase": "^1.0.0",
Expand Down
25 changes: 24 additions & 1 deletion src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import through from 'through2';
import { sync as emptyDir } from 'empty-dir';
import leftPad from 'left-pad';
import chalk from 'chalk';
import inquirer from 'inquirer';

function info(type, message) {
console.log(`${chalk.green.bold(leftPad(type, 12))} ${message}`);
Expand Down Expand Up @@ -76,4 +77,26 @@ function template(dest, cwd) {
});
}

export default init;
export default function (...args) {
console.log();
console.log(chalk.bold(chalk.red(`dva-cli is deprecated, please use ${chalk.blue(`create-umi`)} instead, checkout ${chalk.gray(chalk.underline('https://umijs.org/guide/create-umi-app.html'))} for detail.`)));
console.log(chalk.bold(chalk.green(`如果你是蚂蚁金服内部用户,请使用 bigfish 创建项目,详见 https://bigfish.alipay.com/ 。`)));
console.log();
inquirer.prompt([
{
type: 'confirm',
name: 'insist',
message: `Do you insist on using dva-cli?`,
default: false,
},
]).then(({ insist }) => {
if (insist) {
init(...args);
} else {
console.log('Have a good day!');
}
}).catch(e => {
console.error(chalk.red(`> Project init failed.`));
console.error(e);
})
};

0 comments on commit 7565fd4

Please sign in to comment.