UNPKG

919 BJavaScriptView Raw
1const program = require('commander');
2const readline = require('readline');
3const { createPage } = require('../fn/page');
4const { createRoute } = require('../fn/route');
5
6
7const rl = readline.createInterface({
8 input: process.stdin,
9 output: process.stdout
10});
11
12program.parse(process.argv);
13
14let pageName;
15rl.question("页面名称(驼峰命名):", answer => {
16 console.log();
17 // rl.close();
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