-
Notifications
You must be signed in to change notification settings - Fork 33
/
index.js
72 lines (64 loc) · 2.01 KB
/
index.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
/**
* @file mars-cli-template generator
* @author meixuguang
*/
module.exports = async (api, options) => {
if (options.isDistH5) {
api.render('./dist-h5');
return;
}
api.render('./template', {
doesCompile: api.hasPlugin('babel') || api.hasPlugin('typescript')
});
if (!options.noH5) {
api.render('./template-h5', {
doesCompile: api.hasPlugin('babel') || api.hasPlugin('typescript')
});
// 添加 h5 所需的依赖
api.extendPackage({
scripts: {
'serve-dist-h5': 'mars-cli-service serve --path ./dist-h5',
'build-dist-h5': 'mars-cli-service build --path ./dist-h5'
},
dependencies: {
'vue': '^2.6.6',
'vue-router': '^3.0.1',
'@marsjs/components': '^1.0.10',
'@marsjs/api': '^1.0.11'
},
devDependencies: {
'atom-web-compiler': '^2.2.0',
'atom2vue-loader': '^1.0.0',
'@marsjs/vue-cli-plugin-mars-web': '^0.0.9',
'@vue/cli-plugin-babel': '^3.0.0',
'@vue/cli-service': '^3.5.0',
'less': '^3.0.4',
'less-loader': '^4.1.0',
'vue-template-compiler': '^2.6.10'
}
});
}
api.extendPackage({
scripts: {
'serve': 'mars serve',
'build': 'mars build',
'build:swan': 'mars build',
'serve:swan': 'mars serve',
'build:h5': 'mars build -t h5',
'serve:h5': 'mars serve -t h5',
'build:wx': 'mars build -t wx',
'serve:wx': 'mars serve -t wx'
},
dependencies: {
'@marsjs/build': '^0.2.0',
'@marsjs/core': '^0.2.0'
},
devDependencies: {
'@vue/cli': '^3.3.0'
}
});
// additional tooling configurations
if (options.configs) {
api.extendPackage(options.configs);
}
};