-
Notifications
You must be signed in to change notification settings - Fork 247
/
Copy pathcreate.js
85 lines (81 loc) · 1.88 KB
/
create.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
'use strict';
const { create } = require('./shell');
const common_files = [
"app/extend",
'app/service',
'app/middleware',
'app/model',
'app/lib',
'app/web/asset',
'app/web/component',
'.vscode',
'.eslintrc.js',
'.eslintignore',
'.gitignore',
'LICENSE'
];
const scopeMapping = {
'egg-vue-webpack-spa-boilerplate': {
files:[
'app/controller/spa',
'app/web/framework/app.js',
'app/web/framework/request.js',
'app/web/page/spa',
'app/web/view/layout.html',
'app/view',
'config',
"test/utils",
"test/controller/spa.test.js"
]
},
'egg-vue-webpack-mpa-boilerplate': {
files:[
'app/controller/blog',
'app/web/framework/entry',
'app/web/framework/i18n',
'app/web/framework/plugin',
'app/web/framework/request.js',
'app/web/page/blog',
'app/web/view/layout.html',
'app/view',
'config',
"test/utils",
"test/controller/blog.test.js"
]
},
'egg-vue-webpack-asset-boilerplate': {
files:[
'app/controller/asset',
'app/web/framework/app.js',
'app/web/framework/request.js',
'app/web/page/asset',
'app/web/view',
'app/view',
'config',
"test/utils",
"test/controller/asset.test.js"
]
},
'egg-vue-webpack-html-boilerplate': {
files:[
'app/controller/html',
'app/web/framework/app.js',
'app/web/framework/request.js',
'app/web/page/html',
'app/web/view/layout.tpl',
'app/view',
'config',
"test/utils",
"test/controller/html.test.js"
]
}
};
if (process.argv.length === 4 && process.argv[2] === '--scope') {
const scope = process.argv[3];
const { files: scopeFiles } = scopeMapping[scope];
const files = [...common_files, ...scopeFiles];
create(files, {
sourceName: 'egg-vue-webpack-boilerplate',
targetName: scope
});
}