From 54dcaeae886a76ea04e81c93ef421c8a35e2c493 Mon Sep 17 00:00:00 2001 From: NoBey Date: Tue, 15 Aug 2017 23:14:08 +0800 Subject: [PATCH 1/2] update chalk & babel-preset-stage-0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b01cce1..1e562d0 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "build": "rm -rf lib && babel src --out-dir lib" }, "dependencies": { - "chalk": "^1.1.3", + "chalk": "^2.1.0", "commander": "^2.9.0", "dva-ast": "^0.3.5", "empty-dir": "^0.2.1", @@ -35,7 +35,7 @@ "babel-plugin-transform-runtime": "^6.9.0", "babel-preset-es2015": "^6.9.0", "babel-preset-react": "^6.5.0", - "babel-preset-stage-0": "~6.5.0", + "babel-preset-stage-0": "^6.24.1", "babel-runtime": "^6.9.2" }, "babel": { From b57ce5e3b1370939d35a0b04a9189bc3b6755ab3 Mon Sep 17 00:00:00 2001 From: NoBey Date: Tue, 15 Aug 2017 23:45:58 +0800 Subject: [PATCH 2/2] add generate aliases m,r,c --- src/generate.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/generate.js b/src/generate.js index c46274d..648d28c 100644 --- a/src/generate.js +++ b/src/generate.js @@ -30,7 +30,14 @@ function generate(program, { cwd }) { const defaultEntry = `${base}/index.js`; const defaultRouter = `${base}/router.js`; - const [type, name] = program.args; + const name = program.args[1]; + let type = program.args[0]; + const aliases = { + m: 'model', + r: 'route', + c: 'component', + }; + if (aliases[type]) type = aliases[type]; try { switch (type) {