forked from lgwebdream/fe-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
49 lines (45 loc) · 1.14 KB
/
utils.js
File metadata and controls
49 lines (45 loc) · 1.14 KB
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
const {
noMainTemplatePath,
vue2NoneTemplatePath,
vue2ElementTemplatePath,
vue2CommonTemplatePath,
react17CommonTemplatePath,
templatePackageJson,
templateWebpackConfig,
} = require('./config');
/*
* "vue": "^2.6.14"
* "vue-loader": "^15.9.6",
* "vue-template-compiler": "^2.6.14",
* "element-ui": "^2.15.3",
* */
module.exports = {
getInitTemplate(framework, ui) {
if (framework === 'vue') {
if (ui === 'element') {
return vue2ElementTemplatePath;
}
return vue2NoneTemplatePath;
}
return noMainTemplatePath;
},
getCommonTemplate(framework) {
const commons = {
vue: vue2CommonTemplatePath,
react: react17CommonTemplatePath,
};
return commons[framework];
},
getPackageJson({ ui, main }) {
const result = JSON.parse(JSON.stringify(templatePackageJson));
if (main === 'vue') {
result.dependencies.vue = '^2.6.14';
result.devDependencies['vue-loader'] = '^15.9.6';
result.devDependencies['vue-template-compiler'] = '^2.6.14';
}
if (ui === 'element') {
result.dependencies['element-ui'] = '^2.15.3';
}
return result;
},
};