1 | const program = require('commander');
|
2 | const readline = require('readline');
|
3 | const { createPage } = require('../fn/page');
|
4 | const { createRoute } = require('../fn/route');
|
5 |
|
6 |
|
7 | const rl = readline.createInterface({
|
8 | input: process.stdin,
|
9 | output: process.stdout
|
10 | });
|
11 |
|
12 | program.parse(process.argv);
|
13 |
|
14 | let pageName;
|
15 | rl.question("页面名称(驼峰命名):", answer => {
|
16 | console.log();
|
17 |
|
18 | pageName = createPage(answer);
|
19 |
|
20 | rl.question(`此页面路由名称( 空值:[使用页面名称作为路由名称],'NONE':不创建路由 ):`, routeName => {
|
21 | console.log();
|
22 |
|
23 | if(routeName=='NONE'){
|
24 | return;
|
25 | }
|
26 |
|
27 | if (!routeName) {
|
28 | routeName = pageName.nameC;
|
29 | }
|
30 |
|
31 | rl.question('是否创建移动端路由(y/n, 默认:y):', isMobile => {
|
32 | rl.close();
|
33 | if (isMobile === undefined) isMobile = 'y';
|
34 | createRoute(routeName, isMobile.trim()==='y');
|
35 | })
|
36 | })
|
37 | })
|
38 |
|