1 |
|
2 | const { NANACHI_CONFIG_PATH } = require('../consts/index');
|
3 | const fs = require('fs-extra');
|
4 | const { deepMerge } = require('../packages/utils/index');
|
5 |
|
6 | module.exports = async function(args){
|
7 | try {
|
8 | const { buildType, beta, betaUi, watch, compress, huawei, analysis, silent} = args;
|
9 | const nanachiConfig = {};
|
10 | const baseConfig = {
|
11 | platform: buildType,
|
12 | beta,
|
13 | betaUi,
|
14 | compress,
|
15 | watch,
|
16 | huawei,
|
17 | analysis,
|
18 | silent
|
19 | };
|
20 |
|
21 | if (fs.existsSync(NANACHI_CONFIG_PATH)) {
|
22 | const userConfig = require(NANACHI_CONFIG_PATH);
|
23 | deepMerge(nanachiConfig, userConfig);
|
24 | }
|
25 | deepMerge(nanachiConfig, baseConfig);
|
26 |
|
27 | require('../index')(nanachiConfig);
|
28 |
|
29 | } catch (e) {
|
30 |
|
31 | console.log(e);
|
32 | process.exit(1);
|
33 | }
|
34 | };
|
35 |
|