UNPKG

987 BJavaScriptView Raw
1
2const { NANACHI_CONFIG_PATH } = require('../consts/index');
3const fs = require('fs-extra');
4const { deepMerge } = require('../packages/utils/index');
5
6module.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 // 合并nanachi.config.js中的用户自定义配置
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 // eslint-disable-next-line
31 console.log(e);
32 process.exit(1);
33 }
34};
35