@tmsfe/tmskit 0.0.37 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +488 -261
- package/package.json +3 -1
- package/src/compile/compile.js +8 -2
- package/src/compile/dev.js +5 -1
- package/src/compile/plugins/tmsTemplateRender.js +122 -0
- package/src/core/buildAppJson.js +16 -7
- package/src/core/mpCi.js +14 -0
- package/src/core/tmsMpconfig.js +20 -7
- package/src/entry.js +9 -0
- package/src/scripts/run/dev/index.js +4 -0
- package/src/scripts/run/index.js +5 -0
- package/src/scripts/run/sourcemap/index.js +48 -0
package/dist/index.cjs.js
CHANGED
|
@@ -9,25 +9,27 @@ var require$$0$2 = require('shelljs');
|
|
|
9
9
|
var require$$4 = require('glob-ignore');
|
|
10
10
|
var require$$1$2 = require('os');
|
|
11
11
|
var require$$0$3 = require('lodash');
|
|
12
|
+
var require$$1$3 = require('preprocess');
|
|
13
|
+
var require$$4$1 = require('json5');
|
|
12
14
|
var require$$0$4 = require('async');
|
|
13
|
-
var require$$1$
|
|
14
|
-
var require$$1$
|
|
15
|
+
var require$$1$4 = require('ejs');
|
|
16
|
+
var require$$1$5 = require('inquirer');
|
|
15
17
|
var require$$0$5 = require('metalsmith');
|
|
16
18
|
var require$$0$6 = require('request');
|
|
17
19
|
var require$$10 = require('unzipper');
|
|
18
|
-
var require$$1$
|
|
20
|
+
var require$$1$6 = require('crypto');
|
|
19
21
|
var require$$0$7 = require('miniprogram-ci');
|
|
20
|
-
var require$$1$
|
|
21
|
-
var require$$1$
|
|
22
|
-
var require$$0$8 = require('
|
|
22
|
+
var require$$1$7 = require('fs-extra');
|
|
23
|
+
var require$$1$8 = require('semver');
|
|
24
|
+
var require$$0$8 = require('through2');
|
|
25
|
+
var require$$0$9 = require('gulp');
|
|
23
26
|
var require$$2 = require('minimatch');
|
|
24
27
|
var require$$3$1 = require('gulp-if');
|
|
25
|
-
var require$$
|
|
26
|
-
var require$$0$9 = require('object-assign');
|
|
28
|
+
var require$$0$a = require('object-assign');
|
|
27
29
|
var require$$3$2 = require('fancy-log');
|
|
28
|
-
var require$$4$
|
|
30
|
+
var require$$4$2 = require('ansi-colors');
|
|
29
31
|
var require$$5 = require('chokidar');
|
|
30
|
-
var require$$6
|
|
32
|
+
var require$$6 = require('readable-stream');
|
|
31
33
|
var require$$7 = require('vinyl-file');
|
|
32
34
|
var require$$8 = require('vinyl');
|
|
33
35
|
var require$$9 = require('anymatch');
|
|
@@ -35,7 +37,7 @@ var require$$11 = require('glob-parent');
|
|
|
35
37
|
var require$$2$1 = require('plugin-error');
|
|
36
38
|
var require$$10$1 = require('path-is-absolute');
|
|
37
39
|
var require$$12$1 = require('slash');
|
|
38
|
-
var require$$1$
|
|
40
|
+
var require$$1$9 = require('commander');
|
|
39
41
|
|
|
40
42
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
41
43
|
|
|
@@ -48,25 +50,27 @@ var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
|
|
|
48
50
|
var require$$4__default = /*#__PURE__*/_interopDefaultLegacy(require$$4);
|
|
49
51
|
var require$$1__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$1$2);
|
|
50
52
|
var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
|
|
51
|
-
var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$4);
|
|
52
53
|
var require$$1__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$1$3);
|
|
54
|
+
var require$$4__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$4$1);
|
|
55
|
+
var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$4);
|
|
53
56
|
var require$$1__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$1$4);
|
|
57
|
+
var require$$1__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$1$5);
|
|
54
58
|
var require$$0__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$0$5);
|
|
55
59
|
var require$$0__default$6 = /*#__PURE__*/_interopDefaultLegacy(require$$0$6);
|
|
56
60
|
var require$$10__default = /*#__PURE__*/_interopDefaultLegacy(require$$10);
|
|
57
|
-
var require$$1__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$1$5);
|
|
58
|
-
var require$$0__default$7 = /*#__PURE__*/_interopDefaultLegacy(require$$0$7);
|
|
59
61
|
var require$$1__default$6 = /*#__PURE__*/_interopDefaultLegacy(require$$1$6);
|
|
62
|
+
var require$$0__default$7 = /*#__PURE__*/_interopDefaultLegacy(require$$0$7);
|
|
60
63
|
var require$$1__default$7 = /*#__PURE__*/_interopDefaultLegacy(require$$1$7);
|
|
64
|
+
var require$$1__default$8 = /*#__PURE__*/_interopDefaultLegacy(require$$1$8);
|
|
61
65
|
var require$$0__default$8 = /*#__PURE__*/_interopDefaultLegacy(require$$0$8);
|
|
66
|
+
var require$$0__default$9 = /*#__PURE__*/_interopDefaultLegacy(require$$0$9);
|
|
62
67
|
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
63
68
|
var require$$3__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$3$1);
|
|
64
|
-
var require$$
|
|
65
|
-
var require$$0__default$9 = /*#__PURE__*/_interopDefaultLegacy(require$$0$9);
|
|
69
|
+
var require$$0__default$a = /*#__PURE__*/_interopDefaultLegacy(require$$0$a);
|
|
66
70
|
var require$$3__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$3$2);
|
|
67
|
-
var require$$4__default$
|
|
71
|
+
var require$$4__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$4$2);
|
|
68
72
|
var require$$5__default = /*#__PURE__*/_interopDefaultLegacy(require$$5);
|
|
69
|
-
var require$$6__default
|
|
73
|
+
var require$$6__default = /*#__PURE__*/_interopDefaultLegacy(require$$6);
|
|
70
74
|
var require$$7__default = /*#__PURE__*/_interopDefaultLegacy(require$$7);
|
|
71
75
|
var require$$8__default = /*#__PURE__*/_interopDefaultLegacy(require$$8);
|
|
72
76
|
var require$$9__default = /*#__PURE__*/_interopDefaultLegacy(require$$9);
|
|
@@ -74,11 +78,11 @@ var require$$11__default = /*#__PURE__*/_interopDefaultLegacy(require$$11);
|
|
|
74
78
|
var require$$2__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$2$1);
|
|
75
79
|
var require$$10__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$10$1);
|
|
76
80
|
var require$$12__default = /*#__PURE__*/_interopDefaultLegacy(require$$12$1);
|
|
77
|
-
var require$$1__default$
|
|
81
|
+
var require$$1__default$9 = /*#__PURE__*/_interopDefaultLegacy(require$$1$9);
|
|
78
82
|
|
|
79
83
|
var src$3 = {};
|
|
80
84
|
|
|
81
|
-
const chalk$
|
|
85
|
+
const chalk$5 = require$$3__default;
|
|
82
86
|
const moment$1 = require$$1__default;
|
|
83
87
|
|
|
84
88
|
/**
|
|
@@ -114,25 +118,25 @@ const succeed$2 = (message = '') => {
|
|
|
114
118
|
* @returns {undefined} 无
|
|
115
119
|
*/
|
|
116
120
|
const warn$2 = message => {
|
|
117
|
-
console.log(`${moment$1().format('YYYY-MM-DD HH:mm:ss')}`, chalk$
|
|
121
|
+
console.log(`${moment$1().format('YYYY-MM-DD HH:mm:ss')}`, chalk$5.yellow(message));
|
|
118
122
|
};
|
|
119
|
-
const info$
|
|
123
|
+
const info$k = (...args) => console.log(`${moment$1().format('YYYY-MM-DD HH:mm:ss')}`, ...args);
|
|
120
124
|
const infoNoTime$1 = (...args) => console.log(...args);
|
|
121
125
|
var log$1 = {
|
|
122
126
|
fail: fail$a,
|
|
123
127
|
succeed: succeed$2,
|
|
124
128
|
warn: warn$2,
|
|
125
|
-
info: info$
|
|
129
|
+
info: info$k,
|
|
126
130
|
infoNoTime: infoNoTime$1
|
|
127
131
|
};
|
|
128
132
|
|
|
129
133
|
const ora$2 = require$$0__default;
|
|
130
|
-
const path$
|
|
134
|
+
const path$h = require$$1__default$1;
|
|
131
135
|
const fs$j = require$$0__default$1;
|
|
132
136
|
const shelljs$7 = require$$0__default$2;
|
|
133
137
|
const glob = require$$4__default;
|
|
134
138
|
const {
|
|
135
|
-
info: info$
|
|
139
|
+
info: info$j
|
|
136
140
|
} = log$1;
|
|
137
141
|
const shelljsOptions = {
|
|
138
142
|
slient: true,
|
|
@@ -141,8 +145,8 @@ const shelljsOptions = {
|
|
|
141
145
|
|
|
142
146
|
// 获取当前目录
|
|
143
147
|
const cwd = process.cwd();
|
|
144
|
-
function resolve$
|
|
145
|
-
return path$
|
|
148
|
+
function resolve$k(...args) {
|
|
149
|
+
return path$h.resolve(cwd, ...args);
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
/**
|
|
@@ -175,7 +179,7 @@ function downloadRepoForGit$1(url, dest, branch) {
|
|
|
175
179
|
return new Promise((resolve, reject) => {
|
|
176
180
|
// 如果目标目录不存在
|
|
177
181
|
if (fs$j.existsSync(dest)) {
|
|
178
|
-
shelljs$7.rm('-rf', path$
|
|
182
|
+
shelljs$7.rm('-rf', path$h.join(dest));
|
|
179
183
|
}
|
|
180
184
|
shelljs$7.mkdir('-p', dest);
|
|
181
185
|
shelljs$7.cd(dest);
|
|
@@ -270,11 +274,11 @@ const cost = start => Date.now() - start;
|
|
|
270
274
|
* @param {String} endText 任务结束后提示语
|
|
271
275
|
* @returns {Undefined} 无需返回值
|
|
272
276
|
*/
|
|
273
|
-
function createTask$
|
|
277
|
+
function createTask$7(task, startText, endText) {
|
|
274
278
|
return async (...args) => {
|
|
275
279
|
const start = Date.now();
|
|
276
280
|
const spinner = ora$2();
|
|
277
|
-
info$
|
|
281
|
+
info$j(startText);
|
|
278
282
|
spinner.start();
|
|
279
283
|
const result = await task(...args);
|
|
280
284
|
endText && spinner.succeed(`${endText}, 耗时${cost(start) / 1000}s`);
|
|
@@ -296,7 +300,7 @@ const mergeMap$1 = function (obj, src) {
|
|
|
296
300
|
return obj;
|
|
297
301
|
};
|
|
298
302
|
const relativeCwdPath$1 = function (file) {
|
|
299
|
-
return path$
|
|
303
|
+
return path$h.relative(process.cwd(), file);
|
|
300
304
|
};
|
|
301
305
|
|
|
302
306
|
/**
|
|
@@ -332,7 +336,7 @@ function findFiles(globPath, filter = []) {
|
|
|
332
336
|
// 获取绝对路径
|
|
333
337
|
function getAbsolutePath$6(pathDir, cwd = '') {
|
|
334
338
|
let newPath = pathDir;
|
|
335
|
-
newPath = newPath.startsWith('/') ? newPath : resolve$
|
|
339
|
+
newPath = newPath.startsWith('/') ? newPath : resolve$k(cwd, newPath);
|
|
336
340
|
newPath = newPath.endsWith('/') ? newPath.slice(0, newPath.length - 1) : newPath;
|
|
337
341
|
return newPath;
|
|
338
342
|
}
|
|
@@ -363,10 +367,10 @@ function getGitUser$2() {
|
|
|
363
367
|
return res.stdout;
|
|
364
368
|
}
|
|
365
369
|
var widgets = {
|
|
366
|
-
resolve: resolve$
|
|
370
|
+
resolve: resolve$k,
|
|
367
371
|
isObject,
|
|
368
372
|
isArray,
|
|
369
|
-
createTask: createTask$
|
|
373
|
+
createTask: createTask$7,
|
|
370
374
|
downloadRepoForGit: downloadRepoForGit$1,
|
|
371
375
|
pullRepoForGit: pullRepoForGit$1,
|
|
372
376
|
camelize,
|
|
@@ -383,35 +387,35 @@ var widgets = {
|
|
|
383
387
|
|
|
384
388
|
var tmsMpconfig = {exports: {}};
|
|
385
389
|
|
|
386
|
-
const path$
|
|
390
|
+
const path$g = require$$1__default$1;
|
|
387
391
|
const os = require$$1__default$2;
|
|
388
392
|
|
|
389
393
|
// 用户目录
|
|
390
394
|
const HOME_DIR = os.homedir();
|
|
391
395
|
|
|
392
396
|
// 所有文件的缓存目录
|
|
393
|
-
const CACHE_DIR = path$
|
|
397
|
+
const CACHE_DIR = path$g.resolve(HOME_DIR, '.tmskit');
|
|
394
398
|
|
|
395
399
|
// 版本管理的CDN地址
|
|
396
400
|
const VERSION_URL = 'https://tms-web-1g1czzwka2fd06f2-1301126013.tcloudbaseapp.com/tmskit-template/version.json';
|
|
397
401
|
|
|
398
402
|
// version缓存文件
|
|
399
|
-
const VERSION_CACHE_FILE = path$
|
|
403
|
+
const VERSION_CACHE_FILE = path$g.resolve(CACHE_DIR, 'version_cache_file.json');
|
|
400
404
|
|
|
401
405
|
// npm缓存文件
|
|
402
|
-
const NPM_CACHE_FILE$1 = path$
|
|
406
|
+
const NPM_CACHE_FILE$1 = path$g.resolve(CACHE_DIR, 'npm_cache_file.json');
|
|
403
407
|
|
|
404
408
|
// 脚手架模板代码所在目录
|
|
405
|
-
const TEMPLATE_DIR$1 = path$
|
|
409
|
+
const TEMPLATE_DIR$1 = path$g.resolve(CACHE_DIR, 'template');
|
|
406
410
|
|
|
407
411
|
// 第三方模块源码存放的临时缓存目录
|
|
408
|
-
const MODULE_CODE_DIR$2 = path$
|
|
412
|
+
const MODULE_CODE_DIR$2 = path$g.resolve(CACHE_DIR, 'modules_code');
|
|
409
413
|
|
|
410
414
|
// 缓存分包node_modules的目录
|
|
411
|
-
const NODE_MODULES_DIR$2 = path$
|
|
415
|
+
const NODE_MODULES_DIR$2 = path$g.resolve(CACHE_DIR, 'node_modules');
|
|
412
416
|
|
|
413
417
|
// 扩展命令源码的存放处
|
|
414
|
-
const EXTEND_CMD$1 = path$
|
|
418
|
+
const EXTEND_CMD$1 = path$g.resolve(CACHE_DIR, 'cmd');
|
|
415
419
|
|
|
416
420
|
// 创建模板的名称
|
|
417
421
|
const TEMPLATE_NAME$1 = 'tmskit-template';
|
|
@@ -437,7 +441,7 @@ const MODULE_CONFIG_FILENAME = 'module.config.json';
|
|
|
437
441
|
|
|
438
442
|
// 默认的webpack entry
|
|
439
443
|
const DEFAULT_WEBPACK_ENTRY = {
|
|
440
|
-
app: path$
|
|
444
|
+
app: path$g.resolve(process.cwd(), 'app')
|
|
441
445
|
};
|
|
442
446
|
|
|
443
447
|
// 默认从源码拷贝到编译后的配置
|
|
@@ -544,6 +548,8 @@ var defaultTmsConfig = {
|
|
|
544
548
|
const loadash = require$$0__default$3;
|
|
545
549
|
const fs = require$$0__default$1;
|
|
546
550
|
const path = require$$1__default$1;
|
|
551
|
+
const pp = require$$1__default$3;
|
|
552
|
+
const JSON5 = require$$4__default$1;
|
|
547
553
|
const {
|
|
548
554
|
TMS_CONFIG_FILENAME,
|
|
549
555
|
MODULE_CONFIG_FILENAME,
|
|
@@ -604,9 +610,18 @@ var defaultTmsConfig = {
|
|
|
604
610
|
modules.all = tmsConfig.modules;
|
|
605
611
|
tmsConfig.modules = modules;
|
|
606
612
|
}
|
|
607
|
-
//
|
|
608
|
-
|
|
609
|
-
|
|
613
|
+
// 使用自定义的合并策略:
|
|
614
|
+
// 1. 对 templateVars 字段做浅合并(即把 tms.config.js 中的和 tms.private.config.js 中的对象合并,
|
|
615
|
+
// 如果存在同名字段则以 tms.private.config.js 中的为准)。
|
|
616
|
+
// 2. 对数组(并且数组元素为对象的情况)执行拼接
|
|
617
|
+
const res = loadash.mergeWith({}, tmsConfig, tmsPrivateCf, (objValue, srcValue, key) => {
|
|
618
|
+
if (key === 'templateVars') {
|
|
619
|
+
return {
|
|
620
|
+
...(objValue || {}),
|
|
621
|
+
...(srcValue || {})
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
if (Array.isArray(objValue) && objValue[0] && isObject(objValue[0])) {
|
|
610
625
|
return objValue.concat(srcValue);
|
|
611
626
|
}
|
|
612
627
|
});
|
|
@@ -674,13 +689,20 @@ var defaultTmsConfig = {
|
|
|
674
689
|
* @param {array} modules 用户要编译的模块列表
|
|
675
690
|
* @param { string } appName 小程序的名称
|
|
676
691
|
*/
|
|
677
|
-
function getModulesConfig(modules = [],
|
|
692
|
+
function getModulesConfig(modules = [], tmsConfig) {
|
|
693
|
+
const {
|
|
694
|
+
appName
|
|
695
|
+
} = tmsConfig;
|
|
678
696
|
const modulesConfig = [];
|
|
679
697
|
modules.forEach(moduleItem => {
|
|
680
698
|
const moduleConfigPath = resolve(moduleItem.path, MODULE_CONFIG_FILENAME);
|
|
681
699
|
let moduleConfig;
|
|
682
700
|
try {
|
|
683
|
-
|
|
701
|
+
// 模板渲染:先将 module.config.json 转为字符串,然后通过 preprocess 渲染
|
|
702
|
+
const moduleConfigJsonStr = fs.readFileSync(moduleConfigPath, 'utf-8');
|
|
703
|
+
const preprocessedStr = pp.preprocess(moduleConfigJsonStr, tmsConfig.templateVars || {}, 'json');
|
|
704
|
+
// fs.writeFileSync(resolve(moduleConfigPath), moduleConfigJsonStr, 'utf8');
|
|
705
|
+
moduleConfig = JSON5.parse(preprocessedStr);
|
|
684
706
|
} catch (e) {
|
|
685
707
|
throw new Error(`${moduleConfigPath}json解析报错: ${e}`);
|
|
686
708
|
}
|
|
@@ -785,11 +807,11 @@ var defaultTmsConfig = {
|
|
|
785
807
|
allModules.set(moduleItem.moduleName, moduleItem);
|
|
786
808
|
}
|
|
787
809
|
if (errorIsQuit) {
|
|
788
|
-
throw new Error(`${moduleItem.moduleName}模块的配置文件module.config.json在${moduleItem.path}
|
|
810
|
+
throw new Error(`${moduleItem.moduleName}模块的配置文件module.config.json在${moduleItem.path}目录下没有找到 ${moduleConfigPath}`);
|
|
789
811
|
}
|
|
790
812
|
return;
|
|
791
813
|
}
|
|
792
|
-
const [moduleConfig = {}] = getModulesConfig([moduleItem], tmsConfig
|
|
814
|
+
const [moduleConfig = {}] = getModulesConfig([moduleItem], tmsConfig);
|
|
793
815
|
if (!allModules.has(moduleItem.moduleName)) {
|
|
794
816
|
allModules.set(moduleItem.moduleName, checkModuleItem(tmsConfig, moduleItem, moduleConfig));
|
|
795
817
|
const dependenciesModules = getModulesByModuleNames(tmsConfig, moduleConfig === null || moduleConfig === void 0 ? void 0 : moduleConfig.dependencies);
|
|
@@ -818,9 +840,9 @@ var defaultTmsConfig = {
|
|
|
818
840
|
})(tmsMpconfig);
|
|
819
841
|
|
|
820
842
|
const fs$i = require$$0__default$1;
|
|
821
|
-
const path$
|
|
843
|
+
const path$f = require$$1__default$1;
|
|
822
844
|
const {
|
|
823
|
-
info: info$
|
|
845
|
+
info: info$i
|
|
824
846
|
} = log$1;
|
|
825
847
|
const {
|
|
826
848
|
relativeCwdPath
|
|
@@ -859,7 +881,7 @@ const copyFile = function (src, dest) {
|
|
|
859
881
|
if (fs$i.existsSync(dest)) {
|
|
860
882
|
fs$i.unlinkSync(dest);
|
|
861
883
|
}
|
|
862
|
-
const dir = path$
|
|
884
|
+
const dir = path$f.dirname(dest);
|
|
863
885
|
ensureDirExist$6(dir);
|
|
864
886
|
fs$i.copyFileSync(src, dest);
|
|
865
887
|
};
|
|
@@ -870,11 +892,11 @@ function diffContentCopyFile(originFile, destFile) {
|
|
|
870
892
|
const depDestContent = fs$i.readFileSync(destFile, 'utf8');
|
|
871
893
|
const depOriginContent = fs$i.readFileSync(originFile, 'utf8');
|
|
872
894
|
if (depDestContent !== depOriginContent) {
|
|
873
|
-
info$
|
|
895
|
+
info$i(`拷贝${relativeCwdPath(originFile)}内容到${relativeCwdPath(destFile)}`);
|
|
874
896
|
copyFile(originFile, destFile);
|
|
875
897
|
}
|
|
876
898
|
} else {
|
|
877
|
-
info$
|
|
899
|
+
info$i(`拷贝${relativeCwdPath(originFile)}内容到${relativeCwdPath(destFile)}`);
|
|
878
900
|
copyFile(originFile, destFile);
|
|
879
901
|
}
|
|
880
902
|
}
|
|
@@ -913,7 +935,7 @@ const fileInDir = (dir, file) => {
|
|
|
913
935
|
if (!fs$i.existsSync(dir) || !fs$i.existsSync(file)) {
|
|
914
936
|
return false;
|
|
915
937
|
}
|
|
916
|
-
const relativePath = path$
|
|
938
|
+
const relativePath = path$f.relative(dir, file);
|
|
917
939
|
if (relativePath.startsWith('..')) {
|
|
918
940
|
return false;
|
|
919
941
|
}
|
|
@@ -924,7 +946,7 @@ function findAllFilesOfDir(dir) {
|
|
|
924
946
|
function listFile(dir) {
|
|
925
947
|
const arr = fs$i.readdirSync(dir);
|
|
926
948
|
arr.forEach(item => {
|
|
927
|
-
const fullPath = path$
|
|
949
|
+
const fullPath = path$f.join(dir, item);
|
|
928
950
|
const stats = fs$i.statSync(fullPath);
|
|
929
951
|
if (stats.isDirectory()) {
|
|
930
952
|
listFile(fullPath);
|
|
@@ -949,7 +971,7 @@ var io$3 = {
|
|
|
949
971
|
};
|
|
950
972
|
|
|
951
973
|
const async = require$$0__default$4;
|
|
952
|
-
const ejs = require$$1__default$
|
|
974
|
+
const ejs = require$$1__default$4;
|
|
953
975
|
const render$1 = (files, metalsmith, next) => {
|
|
954
976
|
const keys = Object.keys(files);
|
|
955
977
|
const metadata = metalsmith.metadata();
|
|
@@ -965,9 +987,9 @@ const render$1 = (files, metalsmith, next) => {
|
|
|
965
987
|
var render_1 = render$1;
|
|
966
988
|
|
|
967
989
|
const fs$h = require$$0__default$1;
|
|
968
|
-
const inquirer$1 = require$$1__default$
|
|
990
|
+
const inquirer$1 = require$$1__default$5;
|
|
969
991
|
const {
|
|
970
|
-
resolve: resolve$
|
|
992
|
+
resolve: resolve$j
|
|
971
993
|
} = widgets;
|
|
972
994
|
const {
|
|
973
995
|
TEMPLATE_TKIT_DIR: TEMPLATE_TKIT_DIR$1
|
|
@@ -1009,7 +1031,7 @@ const isQuestionType = result => {
|
|
|
1009
1031
|
return true;
|
|
1010
1032
|
};
|
|
1011
1033
|
const ask$1 = templateDir => (files, metalsmith, next) => {
|
|
1012
|
-
const prompts = parseTemplateQuestions(resolve$
|
|
1034
|
+
const prompts = parseTemplateQuestions(resolve$j(templateDir, TEMPLATE_TKIT_DIR$1));
|
|
1013
1035
|
const metadata = metalsmith.metadata();
|
|
1014
1036
|
const filteredPrompts = prompts.filter(prompt => {
|
|
1015
1037
|
if (metadata[prompt.name] && `${metadata[prompt.name]}`.trim() !== '') {
|
|
@@ -1052,7 +1074,7 @@ const {
|
|
|
1052
1074
|
getGitUser: getGitUser$1
|
|
1053
1075
|
} = widgets;
|
|
1054
1076
|
const apiUrl = 'https://tim.map.qq.com/basic/tmskit/upload';
|
|
1055
|
-
const report$
|
|
1077
|
+
const report$b = (name, attrs = {}) => {
|
|
1056
1078
|
try {
|
|
1057
1079
|
const param = [];
|
|
1058
1080
|
param[27] = name;
|
|
@@ -1074,12 +1096,12 @@ const report$a = (name, attrs = {}) => {
|
|
|
1074
1096
|
// }
|
|
1075
1097
|
} catch (e) {}
|
|
1076
1098
|
};
|
|
1077
|
-
var report_1 = report$
|
|
1099
|
+
var report_1 = report$b;
|
|
1078
1100
|
|
|
1079
|
-
const path$
|
|
1101
|
+
const path$e = require$$1__default$1;
|
|
1080
1102
|
const fs$g = require$$0__default$1;
|
|
1081
1103
|
const shelljs$6 = require$$0__default$2;
|
|
1082
|
-
const inquirer = require$$1__default$
|
|
1104
|
+
const inquirer = require$$1__default$5;
|
|
1083
1105
|
const {
|
|
1084
1106
|
TEMPLATE_DIR,
|
|
1085
1107
|
TEMPLATE_URL,
|
|
@@ -1088,18 +1110,18 @@ const {
|
|
|
1088
1110
|
CREATE_TEMPLATE_QUESTION
|
|
1089
1111
|
} = constant;
|
|
1090
1112
|
const {
|
|
1091
|
-
resolve: resolve$
|
|
1113
|
+
resolve: resolve$i
|
|
1092
1114
|
} = widgets;
|
|
1093
1115
|
const io$2 = io$3;
|
|
1094
1116
|
const {
|
|
1095
1117
|
fail: fail$9,
|
|
1096
1118
|
succeed: succeed$1,
|
|
1097
|
-
info: info$
|
|
1119
|
+
info: info$h
|
|
1098
1120
|
} = log$1;
|
|
1099
1121
|
const generator = generator_1;
|
|
1100
1122
|
const request = require$$0__default$6;
|
|
1101
1123
|
const unzip = require$$10__default;
|
|
1102
|
-
const report$
|
|
1124
|
+
const report$a = report_1;
|
|
1103
1125
|
|
|
1104
1126
|
/**
|
|
1105
1127
|
* 如果该目录下面存在文件,换个名字
|
|
@@ -1154,11 +1176,11 @@ function downloadAndUnZipTemplate(templateDir, templateUrl, templateName) {
|
|
|
1154
1176
|
*/
|
|
1155
1177
|
async function create(projectName) {
|
|
1156
1178
|
const cwd = process.cwd();
|
|
1157
|
-
const targetDir = path$
|
|
1179
|
+
const targetDir = path$e.resolve(cwd, projectName);
|
|
1158
1180
|
const {
|
|
1159
1181
|
projectType
|
|
1160
1182
|
} = await inquirer.prompt(CREATE_TEMPLATE_QUESTION);
|
|
1161
|
-
report$
|
|
1183
|
+
report$a('create-start', {
|
|
1162
1184
|
projectType
|
|
1163
1185
|
});
|
|
1164
1186
|
|
|
@@ -1177,9 +1199,9 @@ async function create(projectName) {
|
|
|
1177
1199
|
await downloadAndUnZipTemplate(TEMPLATE_DIR, TEMPLATE_URL, TEMPLATE_NAME);
|
|
1178
1200
|
|
|
1179
1201
|
// 生成模板(1. 询问问题, 2. ejs生成模板 3.生成到目标目录)
|
|
1180
|
-
generator(path$
|
|
1202
|
+
generator(path$e.join(TEMPLATE_DIR, TEMPLATE_NAME, projectType), targetDir).then(() => {
|
|
1181
1203
|
shelljs$6.cd(projectName);
|
|
1182
|
-
const hookFilePath = resolve$
|
|
1204
|
+
const hookFilePath = resolve$i(projectName, TEMPLATE_TKIT_DIR, 'hooks.js');
|
|
1183
1205
|
if (fs$g.existsSync(hookFilePath)) {
|
|
1184
1206
|
const hooks = require(hookFilePath);
|
|
1185
1207
|
if (hooks.afterCreate) {
|
|
@@ -1193,21 +1215,21 @@ async function create(projectName) {
|
|
|
1193
1215
|
}
|
|
1194
1216
|
});
|
|
1195
1217
|
}
|
|
1196
|
-
shelljs$6.rm('-rf', resolve$
|
|
1218
|
+
shelljs$6.rm('-rf', resolve$i(projectName, TEMPLATE_TKIT_DIR));
|
|
1197
1219
|
}
|
|
1198
|
-
report$
|
|
1220
|
+
report$a('create-success', {
|
|
1199
1221
|
projectType
|
|
1200
1222
|
});
|
|
1201
1223
|
succeed$1('项目创建完成.');
|
|
1202
1224
|
}).catch(err => {
|
|
1203
1225
|
fail$9(err.message);
|
|
1204
|
-
info$
|
|
1226
|
+
info$h('详细的错误信息:', err);
|
|
1205
1227
|
});
|
|
1206
1228
|
}
|
|
1207
1229
|
var create_1 = create;
|
|
1208
1230
|
|
|
1209
1231
|
const fs$f = require$$0__default$1;
|
|
1210
|
-
const path$
|
|
1232
|
+
const path$d = require$$1__default$1;
|
|
1211
1233
|
const shellJs$3 = require$$0__default$2;
|
|
1212
1234
|
const {
|
|
1213
1235
|
ensureDirExist: ensureDirExist$5
|
|
@@ -1216,10 +1238,10 @@ const {
|
|
|
1216
1238
|
EXTEND_CMD
|
|
1217
1239
|
} = constant;
|
|
1218
1240
|
const {
|
|
1219
|
-
createTask: createTask$
|
|
1241
|
+
createTask: createTask$6
|
|
1220
1242
|
} = widgets;
|
|
1221
1243
|
const {
|
|
1222
|
-
info: info$
|
|
1244
|
+
info: info$g,
|
|
1223
1245
|
fail: fail$8
|
|
1224
1246
|
} = log$1;
|
|
1225
1247
|
|
|
@@ -1238,7 +1260,7 @@ async function installCmd(npmName, cmd) {
|
|
|
1238
1260
|
}, null, 2));
|
|
1239
1261
|
}
|
|
1240
1262
|
shellJs$3.cd(EXTEND_CMD);
|
|
1241
|
-
await createTask$
|
|
1263
|
+
await createTask$6(npmName => new Promise((resolve, reject) => {
|
|
1242
1264
|
const registry = cmd.registry ? `--registry=${cmd.registry}` : '';
|
|
1243
1265
|
shellJs$3.exec(`npm install --save ${npmName} ${registry}`, {
|
|
1244
1266
|
cwd: EXTEND_CMD,
|
|
@@ -1252,7 +1274,7 @@ async function installCmd(npmName, cmd) {
|
|
|
1252
1274
|
}), `开始下载${npmName}`, `下载${npmName}完成`)(npmName);
|
|
1253
1275
|
} catch (e) {
|
|
1254
1276
|
fail$8('构建出现错误:');
|
|
1255
|
-
info$
|
|
1277
|
+
info$g(e);
|
|
1256
1278
|
process.exit(1);
|
|
1257
1279
|
}
|
|
1258
1280
|
}
|
|
@@ -1272,7 +1294,7 @@ function loadExtendCmd$1() {
|
|
|
1272
1294
|
Object.keys(deps).forEach(name => {
|
|
1273
1295
|
// 检索cmd的npm包
|
|
1274
1296
|
if (!/^tmskit-cmd-|^@[^/]+\/tmskit-cmd-/.test(name)) return false;
|
|
1275
|
-
const cmdConfig = path$
|
|
1297
|
+
const cmdConfig = path$d.join(cmdNpmDir, name, 'tms.config.js');
|
|
1276
1298
|
if (fs$f.existsSync(cmdConfig)) {
|
|
1277
1299
|
cmdConfigs.push(cmdConfig);
|
|
1278
1300
|
}
|
|
@@ -1314,7 +1336,7 @@ const {
|
|
|
1314
1336
|
const {
|
|
1315
1337
|
global: global$b
|
|
1316
1338
|
} = global_1;
|
|
1317
|
-
function handleError$
|
|
1339
|
+
function handleError$9(error, isQuit = false) {
|
|
1318
1340
|
const errMsg = typeof error === 'object' ? error.message : error;
|
|
1319
1341
|
if (isQuit) {
|
|
1320
1342
|
fail$7(errMsg);
|
|
@@ -1329,7 +1351,7 @@ function handleError$8(error, isQuit = false) {
|
|
|
1329
1351
|
}
|
|
1330
1352
|
}
|
|
1331
1353
|
var handleError_1 = {
|
|
1332
|
-
handleError: handleError$
|
|
1354
|
+
handleError: handleError$9
|
|
1333
1355
|
};
|
|
1334
1356
|
|
|
1335
1357
|
/**
|
|
@@ -1338,25 +1360,26 @@ var handleError_1 = {
|
|
|
1338
1360
|
|
|
1339
1361
|
/* eslint-disable no-param-reassign */
|
|
1340
1362
|
const fs$e = require$$0__default$1;
|
|
1363
|
+
const pp$1 = require$$1__default$3;
|
|
1341
1364
|
const {
|
|
1342
1365
|
getSubPackages: getSubPackages$3,
|
|
1343
1366
|
getModulesConfig
|
|
1344
1367
|
} = tmsMpconfig.exports;
|
|
1345
1368
|
const {
|
|
1346
1369
|
fail: fail$6,
|
|
1347
|
-
info: info$
|
|
1370
|
+
info: info$f
|
|
1348
1371
|
} = log$1;
|
|
1349
1372
|
const {
|
|
1350
|
-
resolve: resolve$
|
|
1373
|
+
resolve: resolve$h,
|
|
1351
1374
|
filterField: filterField$7
|
|
1352
1375
|
} = widgets;
|
|
1353
1376
|
const {
|
|
1354
|
-
handleError: handleError$
|
|
1377
|
+
handleError: handleError$8
|
|
1355
1378
|
} = handleError_1;
|
|
1356
1379
|
const {
|
|
1357
1380
|
global: global$a
|
|
1358
1381
|
} = global_1;
|
|
1359
|
-
const report$
|
|
1382
|
+
const report$9 = report_1;
|
|
1360
1383
|
|
|
1361
1384
|
/**
|
|
1362
1385
|
* 更新appJson里面的主包配置
|
|
@@ -1366,7 +1389,7 @@ const report$8 = report_1;
|
|
|
1366
1389
|
*/
|
|
1367
1390
|
function updateMainPackages(appJson, mainPackages = []) {
|
|
1368
1391
|
let foundMainPackages = appJson.subpackages.filter(subpackage => mainPackages.includes(subpackage.name));
|
|
1369
|
-
if (foundMainPackages.length === 0) {
|
|
1392
|
+
if (foundMainPackages.length === 0 && appJson.pages.length === 0) {
|
|
1370
1393
|
// 没找到主包
|
|
1371
1394
|
foundMainPackages = [appJson.subpackages[0]];
|
|
1372
1395
|
}
|
|
@@ -1377,7 +1400,10 @@ function updateMainPackages(appJson, mainPackages = []) {
|
|
|
1377
1400
|
process.exit(-1);
|
|
1378
1401
|
}
|
|
1379
1402
|
subpackage.pages.forEach(page => {
|
|
1380
|
-
|
|
1403
|
+
const pagePath = `${subpackage.root}/${page}`;
|
|
1404
|
+
if (!appJson.pages.includes(pagePath)) {
|
|
1405
|
+
appJson.pages.push(pagePath);
|
|
1406
|
+
}
|
|
1381
1407
|
});
|
|
1382
1408
|
if (subpackage.plugins) {
|
|
1383
1409
|
Object.assign(appJson.plugins, subpackage.plugins);
|
|
@@ -1401,8 +1427,8 @@ const getAppJsonContent = sourceAppJsonPath => {
|
|
|
1401
1427
|
}
|
|
1402
1428
|
const appJson = JSON.parse(fs$e.readFileSync(sourceAppJsonPath), 'utf-8');
|
|
1403
1429
|
// 加入默认值
|
|
1404
|
-
appJson.subpackages = [];
|
|
1405
|
-
appJson.pages = [];
|
|
1430
|
+
appJson.subpackages = appJson.subpackages || [];
|
|
1431
|
+
appJson.pages = appJson.pages || [];
|
|
1406
1432
|
return appJson;
|
|
1407
1433
|
};
|
|
1408
1434
|
|
|
@@ -1462,15 +1488,15 @@ const fixAppJson = appJson => {
|
|
|
1462
1488
|
* @param {array} modules 用户要编译的模块列表
|
|
1463
1489
|
* @returns
|
|
1464
1490
|
*/
|
|
1465
|
-
async function buildOutputAppJson$
|
|
1491
|
+
async function buildOutputAppJson$3(tmsConfig, modules) {
|
|
1466
1492
|
try {
|
|
1467
1493
|
var _tmsConfig$hooks;
|
|
1468
1494
|
// 获取所有模块,合并模块依赖的模块
|
|
1469
|
-
const modulesConfig = getModulesConfig(modules, tmsConfig
|
|
1495
|
+
const modulesConfig = getModulesConfig(modules, tmsConfig, false);
|
|
1470
1496
|
// 获取所有的分包
|
|
1471
1497
|
const subPackages = getSubPackages$3(modulesConfig);
|
|
1472
1498
|
// 获取app.json的配置
|
|
1473
|
-
|
|
1499
|
+
let appJson = getAppJsonContent(resolve$h('./app.json'));
|
|
1474
1500
|
|
|
1475
1501
|
// 更新app.json中的subpackages
|
|
1476
1502
|
appJson.subpackages = subPackages;
|
|
@@ -1480,7 +1506,12 @@ async function buildOutputAppJson$2(tmsConfig, modules) {
|
|
|
1480
1506
|
fixAppJson(appJson);
|
|
1481
1507
|
// 更新主包,需在subpackages处理完成后执行, pages/
|
|
1482
1508
|
updateMainPackages(appJson, tmsConfig.mainPackages);
|
|
1483
|
-
|
|
1509
|
+
|
|
1510
|
+
// 模板渲染:先将 app.json 转为字符串,然后通过 preprocess 渲染
|
|
1511
|
+
const appJsonStr = JSON.stringify(appJson, null, 2);
|
|
1512
|
+
const preprocessedStr = pp$1.preprocess(appJsonStr, tmsConfig.templateVars || {}, 'json');
|
|
1513
|
+
fs$e.writeFileSync(resolve$h(`${tmsConfig.outputDir}/app.json`), preprocessedStr, 'utf8');
|
|
1514
|
+
appJson = JSON.parse(preprocessedStr);
|
|
1484
1515
|
if (typeof (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks = tmsConfig.hooks) === null || _tmsConfig$hooks === void 0 ? void 0 : _tmsConfig$hooks.updateAppJson) === 'function') {
|
|
1485
1516
|
var _tmsConfig$hooks2;
|
|
1486
1517
|
await (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks2 = tmsConfig.hooks) === null || _tmsConfig$hooks2 === void 0 ? void 0 : _tmsConfig$hooks2.updateAppJson({
|
|
@@ -1490,36 +1521,36 @@ async function buildOutputAppJson$2(tmsConfig, modules) {
|
|
|
1490
1521
|
appJson,
|
|
1491
1522
|
isDev: global$a.getData('isDev')
|
|
1492
1523
|
}));
|
|
1493
|
-
report$
|
|
1524
|
+
report$9('hooks:updateAppJson');
|
|
1494
1525
|
}
|
|
1495
1526
|
return appJson;
|
|
1496
1527
|
} catch (e) {
|
|
1497
|
-
handleError$
|
|
1498
|
-
info$
|
|
1528
|
+
handleError$8(`生成app.json出现错误: ${e}`);
|
|
1529
|
+
info$f(e);
|
|
1499
1530
|
}
|
|
1500
1531
|
}
|
|
1501
1532
|
var buildAppJson = {
|
|
1502
|
-
buildOutputAppJson: buildOutputAppJson$
|
|
1533
|
+
buildOutputAppJson: buildOutputAppJson$3
|
|
1503
1534
|
};
|
|
1504
1535
|
|
|
1505
1536
|
/**
|
|
1506
1537
|
* 下载第三方代码
|
|
1507
1538
|
*/
|
|
1508
1539
|
const MetalSmith = require$$0__default$5;
|
|
1509
|
-
const crypto$2 = require$$1__default$
|
|
1540
|
+
const crypto$2 = require$$1__default$6;
|
|
1510
1541
|
const {
|
|
1511
1542
|
downloadRepoForGit,
|
|
1512
1543
|
pullRepoForGit,
|
|
1513
|
-
resolve: resolve$
|
|
1544
|
+
resolve: resolve$g
|
|
1514
1545
|
} = widgets;
|
|
1515
1546
|
const {
|
|
1516
1547
|
fail: fail$5,
|
|
1517
|
-
info: info$
|
|
1548
|
+
info: info$e
|
|
1518
1549
|
} = log$1;
|
|
1519
1550
|
const fs$d = require$$0__default$1;
|
|
1520
1551
|
const shelljs$5 = require$$0__default$2;
|
|
1521
1552
|
const {
|
|
1522
|
-
handleError: handleError$
|
|
1553
|
+
handleError: handleError$7
|
|
1523
1554
|
} = handleError_1;
|
|
1524
1555
|
const {
|
|
1525
1556
|
global: global$9
|
|
@@ -1611,7 +1642,7 @@ async function cloneModules$1(sourceDir, targetDir, modules) {
|
|
|
1611
1642
|
}) => fn(...Object.keys(cParams).map(key => cParams[key])));
|
|
1612
1643
|
return Promise.all(callArr);
|
|
1613
1644
|
}).catch(e => {
|
|
1614
|
-
handleError$
|
|
1645
|
+
handleError$7(`下载代码${params.httpRepoUrl}出现错误:${e}`);
|
|
1615
1646
|
}));
|
|
1616
1647
|
});
|
|
1617
1648
|
await Promise.all(arrPromises);
|
|
@@ -1655,9 +1686,9 @@ function collectDownLoadTasksMap(sourceDir, targetDir, modules) {
|
|
|
1655
1686
|
// 根据gitUrl与branch计算md5
|
|
1656
1687
|
const md5Key = md5ByGitUrlBranch(gitUrl, branch);
|
|
1657
1688
|
// git源码临时存在的源目录
|
|
1658
|
-
const sourcePath = resolve$
|
|
1689
|
+
const sourcePath = resolve$g(sourceDir, md5Key);
|
|
1659
1690
|
// 模块源码要放到目标目录
|
|
1660
|
-
const targetPath = resolve$
|
|
1691
|
+
const targetPath = resolve$g(targetDir, path);
|
|
1661
1692
|
// 从git源码仓库中找到模块源码路径 (一个仓库存在存放多个模块的情况)
|
|
1662
1693
|
const sourceModulePath = gitPath ? `${sourcePath}/${gitPath}` : sourcePath;
|
|
1663
1694
|
|
|
@@ -1682,15 +1713,15 @@ function collectDownLoadTasksMap(sourceDir, targetDir, modules) {
|
|
|
1682
1713
|
let promiseTask;
|
|
1683
1714
|
if (fs$d.existsSync(sourcePath) && fs$d.existsSync(`${sourcePath}/.git`)) {
|
|
1684
1715
|
promiseTask = (gitUrl, sourcePath, branch, httpRepoUrl) => {
|
|
1685
|
-
info$
|
|
1716
|
+
info$e(`git pull:${httpRepoUrl} --branch: ${branch}`);
|
|
1686
1717
|
return pullRepoForGit(sourcePath, branch).catch(e => {
|
|
1687
|
-
info$
|
|
1718
|
+
info$e(`pull代码失败:${e}, 开始git clone: ${httpRepoUrl}:${branch}`);
|
|
1688
1719
|
return downloadRepoForGit(gitUrl, sourcePath, branch);
|
|
1689
1720
|
});
|
|
1690
1721
|
};
|
|
1691
1722
|
} else {
|
|
1692
1723
|
promiseTask = (gitUrl, sourcePath, branch, httpRepoUrl) => {
|
|
1693
|
-
info$
|
|
1724
|
+
info$e(`git clone: ${httpRepoUrl}`);
|
|
1694
1725
|
return downloadRepoForGit(gitUrl, sourcePath, branch);
|
|
1695
1726
|
};
|
|
1696
1727
|
}
|
|
@@ -1739,7 +1770,7 @@ var cloneModules_1 = {
|
|
|
1739
1770
|
};
|
|
1740
1771
|
|
|
1741
1772
|
const ci = require$$0__default$7;
|
|
1742
|
-
const path$
|
|
1773
|
+
const path$c = require$$1__default$1;
|
|
1743
1774
|
|
|
1744
1775
|
/**
|
|
1745
1776
|
* 获取小程序ci的Project对象
|
|
@@ -1752,7 +1783,7 @@ const getMpCi = ({
|
|
|
1752
1783
|
privateKey = 'TODO'
|
|
1753
1784
|
}) => {
|
|
1754
1785
|
var _projectCg$packOption, _projectCg$packOption2;
|
|
1755
|
-
const projectCg = require(path$
|
|
1786
|
+
const projectCg = require(path$c.join(projectPath, 'project.config.json'));
|
|
1756
1787
|
const ignores = (projectCg === null || projectCg === void 0 ? void 0 : (_projectCg$packOption = projectCg.packOptions) === null || _projectCg$packOption === void 0 ? void 0 : (_projectCg$packOption2 = _projectCg$packOption.ignore) === null || _projectCg$packOption2 === void 0 ? void 0 : _projectCg$packOption2.map(({
|
|
1757
1788
|
value
|
|
1758
1789
|
}) => value)) || [];
|
|
@@ -1864,14 +1895,34 @@ const uploadMp = async (params = {}) => {
|
|
|
1864
1895
|
onProgressUpdate: () => {}
|
|
1865
1896
|
});
|
|
1866
1897
|
};
|
|
1867
|
-
|
|
1898
|
+
const getDevSourceMap = async (params = {}) => {
|
|
1899
|
+
const {
|
|
1900
|
+
appId,
|
|
1901
|
+
projectPath,
|
|
1902
|
+
privateKey,
|
|
1903
|
+
robot,
|
|
1904
|
+
sourceMapSavePath
|
|
1905
|
+
} = params;
|
|
1906
|
+
const project = await getMpCi({
|
|
1907
|
+
appId,
|
|
1908
|
+
projectPath,
|
|
1909
|
+
privateKey
|
|
1910
|
+
});
|
|
1911
|
+
return await ci.getDevSourceMap({
|
|
1912
|
+
project,
|
|
1913
|
+
robot,
|
|
1914
|
+
sourceMapSavePath
|
|
1915
|
+
});
|
|
1916
|
+
};
|
|
1917
|
+
var mpCi$3 = {
|
|
1868
1918
|
buildMpNpm: buildMpNpm$1,
|
|
1869
1919
|
previewMp,
|
|
1870
|
-
uploadMp
|
|
1920
|
+
uploadMp,
|
|
1921
|
+
getDevSourceMap
|
|
1871
1922
|
};
|
|
1872
1923
|
|
|
1873
1924
|
const fs$c = require$$0__default$1;
|
|
1874
|
-
const path$
|
|
1925
|
+
const path$b = require$$1__default$1;
|
|
1875
1926
|
const {
|
|
1876
1927
|
NPM_CACHE_FILE
|
|
1877
1928
|
} = constant;
|
|
@@ -1890,7 +1941,7 @@ function getCache$1(projectDir, type) {
|
|
|
1890
1941
|
function setCache$1(projectDir, type = 'miniprogram_npm', data) {
|
|
1891
1942
|
const filePath = NPM_CACHE_FILE;
|
|
1892
1943
|
if (!fs$c.existsSync(filePath)) {
|
|
1893
|
-
const dir = path$
|
|
1944
|
+
const dir = path$b.dirname(filePath);
|
|
1894
1945
|
ensureDirExist$4(dir);
|
|
1895
1946
|
fs$c.writeFileSync(filePath, '{}');
|
|
1896
1947
|
}
|
|
@@ -1912,16 +1963,16 @@ var cache = {
|
|
|
1912
1963
|
* 本文件主要负责项目或者分包依赖的npm的安装
|
|
1913
1964
|
*/
|
|
1914
1965
|
const fs$b = require$$0__default$1;
|
|
1915
|
-
const fsExtra = require$$1__default$
|
|
1916
|
-
const crypto$1 = require$$1__default$
|
|
1917
|
-
const path$
|
|
1966
|
+
const fsExtra = require$$1__default$7;
|
|
1967
|
+
const crypto$1 = require$$1__default$6;
|
|
1968
|
+
const path$a = require$$1__default$1;
|
|
1918
1969
|
const shell = require$$0__default$2;
|
|
1919
1970
|
const log = log$1;
|
|
1920
1971
|
const {
|
|
1921
1972
|
npmInstall: npmInstall$2
|
|
1922
1973
|
} = widgets;
|
|
1923
1974
|
const {
|
|
1924
|
-
handleError: handleError$
|
|
1975
|
+
handleError: handleError$6
|
|
1925
1976
|
} = handleError_1;
|
|
1926
1977
|
const {
|
|
1927
1978
|
global: global$8
|
|
@@ -1959,15 +2010,15 @@ const collectNpmTasksMap = (packageJsonFiles, cacheDir) => {
|
|
|
1959
2010
|
};
|
|
1960
2011
|
if (Object.keys(md5Obj.dependencies).length !== 0) {
|
|
1961
2012
|
const md5Key = crypto$1.createHash('md5').update(JSON.stringify(md5Obj)).digest('hex');
|
|
1962
|
-
const cacheNMPath = path$
|
|
1963
|
-
const cacheNMTarFile = path$
|
|
2013
|
+
const cacheNMPath = path$a.join(cacheDir, md5Key);
|
|
2014
|
+
const cacheNMTarFile = path$a.join(cacheNMPath, 'node_modules.tar.gz');
|
|
1964
2015
|
|
|
1965
2016
|
// 下载后,添加回调函数 (拷贝node_modules.tar.gz到编译目录并解压)
|
|
1966
2017
|
const callback = {
|
|
1967
2018
|
params: {
|
|
1968
2019
|
cacheNMPath,
|
|
1969
2020
|
cacheNMTarFile,
|
|
1970
|
-
packageJsonDir: path$
|
|
2021
|
+
packageJsonDir: path$a.dirname(packageJsonPath),
|
|
1971
2022
|
shell
|
|
1972
2023
|
},
|
|
1973
2024
|
fn: async (cacheNMPath, cacheNMTarFile, packageJsonDir, shell) => {
|
|
@@ -2043,7 +2094,7 @@ const npmInstallAll$1 = async (subPackages, contextDir, cacheDir) => {
|
|
|
2043
2094
|
}) => fn(...Object.keys(cParams).map(key => cParams[key])));
|
|
2044
2095
|
return Promise.all(callArr);
|
|
2045
2096
|
}).catch(e => {
|
|
2046
|
-
handleError$
|
|
2097
|
+
handleError$6(`npm install ${params.packageJsonPath}出现错误:${e}`, true);
|
|
2047
2098
|
}));
|
|
2048
2099
|
});
|
|
2049
2100
|
await Promise.all(arrPromises);
|
|
@@ -2080,7 +2131,7 @@ const findFilesByFilter = (startPath, filter) => {
|
|
|
2080
2131
|
}
|
|
2081
2132
|
const files = fs$b.readdirSync(startPath);
|
|
2082
2133
|
files.forEach(file => {
|
|
2083
|
-
const filename = path$
|
|
2134
|
+
const filename = path$a.join(startPath, file);
|
|
2084
2135
|
const stat = fs$b.lstatSync(filename);
|
|
2085
2136
|
// 当前文件是文件夹类型,继续递归
|
|
2086
2137
|
if (stat.isDirectory()) {
|
|
@@ -2104,10 +2155,10 @@ const findFilesByFilter = (startPath, filter) => {
|
|
|
2104
2155
|
const findAllPackageJson = (subRoots = [], contextDir) => {
|
|
2105
2156
|
const packageJsonName = 'package.json'; // 查找文件名
|
|
2106
2157
|
const cwd = contextDir || dirPath;
|
|
2107
|
-
const result = [path$
|
|
2158
|
+
const result = [path$a.join(cwd, packageJsonName)]; // 默认填充根目录下的package.json
|
|
2108
2159
|
|
|
2109
2160
|
subRoots.forEach(subRoot => {
|
|
2110
|
-
const toppath = path$
|
|
2161
|
+
const toppath = path$a.join(cwd, subRoot.root); // 从该目录开始查找package.json文件
|
|
2111
2162
|
const list = findFilesByFilter(toppath, packageJsonName);
|
|
2112
2163
|
result.push(...list);
|
|
2113
2164
|
});
|
|
@@ -2119,7 +2170,7 @@ var npm = {
|
|
|
2119
2170
|
findFilesByFilter
|
|
2120
2171
|
};
|
|
2121
2172
|
|
|
2122
|
-
const crypto = require$$1__default$
|
|
2173
|
+
const crypto = require$$1__default$6;
|
|
2123
2174
|
const fs$a = require$$0__default$1;
|
|
2124
2175
|
function fileMd5$1(filePath) {
|
|
2125
2176
|
return new Promise((resolve, reject) => {
|
|
@@ -2142,15 +2193,15 @@ var md5 = {
|
|
|
2142
2193
|
};
|
|
2143
2194
|
|
|
2144
2195
|
const fs$9 = require$$0__default$1;
|
|
2145
|
-
const semver$1 = require$$1__default$
|
|
2196
|
+
const semver$1 = require$$1__default$8;
|
|
2146
2197
|
const {
|
|
2147
|
-
resolve: resolve$
|
|
2198
|
+
resolve: resolve$f,
|
|
2148
2199
|
getAbsolutePath: getAbsolutePath$5
|
|
2149
2200
|
} = widgets;
|
|
2150
|
-
const path$
|
|
2201
|
+
const path$9 = require$$1__default$1;
|
|
2151
2202
|
const shelljs$4 = require$$0__default$2;
|
|
2152
2203
|
const {
|
|
2153
|
-
handleError: handleError$
|
|
2204
|
+
handleError: handleError$5
|
|
2154
2205
|
} = handleError_1;
|
|
2155
2206
|
const getLatestVersion = npmName => {
|
|
2156
2207
|
const data = shelljs$4.exec(`npm view ${npmName} version`);
|
|
@@ -2165,8 +2216,8 @@ function collectPackageJson(subPackages, cwd, outputDir) {
|
|
|
2165
2216
|
const packageJsonName = 'package.json'; // 查找文件名
|
|
2166
2217
|
// 1.1根目录的package.json
|
|
2167
2218
|
const packageArr = [{
|
|
2168
|
-
srcPackageDir: path$
|
|
2169
|
-
destNpmDir: resolve$
|
|
2219
|
+
srcPackageDir: path$9.join(cwd, packageJsonName),
|
|
2220
|
+
destNpmDir: resolve$f(outputDir, 'node_modules')
|
|
2170
2221
|
}];
|
|
2171
2222
|
// 1.2模块的package.json
|
|
2172
2223
|
subPackages.forEach(item => {
|
|
@@ -2174,7 +2225,7 @@ function collectPackageJson(subPackages, cwd, outputDir) {
|
|
|
2174
2225
|
if (fs$9.existsSync(srcPackageDir)) {
|
|
2175
2226
|
packageArr.push({
|
|
2176
2227
|
srcPackageDir,
|
|
2177
|
-
destNpmDir: resolve$
|
|
2228
|
+
destNpmDir: resolve$f(outputDir, item.root, 'node_modules')
|
|
2178
2229
|
});
|
|
2179
2230
|
}
|
|
2180
2231
|
});
|
|
@@ -2189,7 +2240,7 @@ function readPackageDependencies(srcPackageDir) {
|
|
|
2189
2240
|
const json = packageJson ? JSON.parse(packageJson) : {};
|
|
2190
2241
|
dependencies = (json === null || json === void 0 ? void 0 : json.dependencies) || {};
|
|
2191
2242
|
} catch (e) {
|
|
2192
|
-
handleError$
|
|
2243
|
+
handleError$5(`解析${srcPackageDir}报错,请检查是否是正确的json配置项 ${e}`);
|
|
2193
2244
|
}
|
|
2194
2245
|
return dependencies;
|
|
2195
2246
|
}
|
|
@@ -2214,11 +2265,11 @@ const checkPackageVersion$1 = packageArr => {
|
|
|
2214
2265
|
const dependencies = readPackageDependencies(item.srcPackageDir);
|
|
2215
2266
|
const dependenciesKeys = Object.keys(dependencies);
|
|
2216
2267
|
for (const key of dependenciesKeys) {
|
|
2217
|
-
const depPath = path$
|
|
2268
|
+
const depPath = path$9.join(item.destNpmDir, key);
|
|
2218
2269
|
if (!fs$9.existsSync(depPath)) {
|
|
2219
2270
|
return true;
|
|
2220
2271
|
}
|
|
2221
|
-
const depPackagePath = path$
|
|
2272
|
+
const depPackagePath = path$9.join(depPath, 'package.json');
|
|
2222
2273
|
if (fs$9.existsSync(depPackagePath)) {
|
|
2223
2274
|
const packageData = require(depPackagePath);
|
|
2224
2275
|
if (dependencies[key] === 'latest') {
|
|
@@ -2242,17 +2293,17 @@ var checkDependencies = {
|
|
|
2242
2293
|
|
|
2243
2294
|
const shelljs$3 = require$$0__default$2;
|
|
2244
2295
|
const fs$8 = require$$0__default$1;
|
|
2245
|
-
const path$
|
|
2296
|
+
const path$8 = require$$1__default$1;
|
|
2246
2297
|
const io$1 = io$3;
|
|
2247
2298
|
const {
|
|
2248
|
-
createTask: createTask$
|
|
2249
|
-
resolve: resolve$
|
|
2299
|
+
createTask: createTask$5,
|
|
2300
|
+
resolve: resolve$e,
|
|
2250
2301
|
getAbsolutePath: getAbsolutePath$4,
|
|
2251
2302
|
filterField: filterField$6
|
|
2252
2303
|
} = widgets;
|
|
2253
2304
|
const {
|
|
2254
2305
|
buildMpNpm
|
|
2255
|
-
} = mpCi$
|
|
2306
|
+
} = mpCi$3;
|
|
2256
2307
|
const {
|
|
2257
2308
|
global: global$7
|
|
2258
2309
|
} = global_1;
|
|
@@ -2267,7 +2318,7 @@ const {
|
|
|
2267
2318
|
npmInstallAll
|
|
2268
2319
|
} = npm;
|
|
2269
2320
|
const {
|
|
2270
|
-
info: info$
|
|
2321
|
+
info: info$d
|
|
2271
2322
|
} = log$1;
|
|
2272
2323
|
const {
|
|
2273
2324
|
fileMd5
|
|
@@ -2281,41 +2332,41 @@ async function install$3(tmsConfig, subPackages, useCache = true) {
|
|
|
2281
2332
|
// 加npm install之前的钩子
|
|
2282
2333
|
if (typeof (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks = tmsConfig.hooks) === null || _tmsConfig$hooks === void 0 ? void 0 : _tmsConfig$hooks.beforeNpmInstall) === 'function') {
|
|
2283
2334
|
var _tmsConfig$hooks2;
|
|
2284
|
-
info$
|
|
2335
|
+
info$d('—————— 执行beforeNpmInstall ————');
|
|
2285
2336
|
await (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks2 = tmsConfig.hooks) === null || _tmsConfig$hooks2 === void 0 ? void 0 : _tmsConfig$hooks2.beforeNpmInstall({
|
|
2286
2337
|
tmsConfig: filterField$6(tmsConfig, ['gitAccount']),
|
|
2287
2338
|
cmdOptions: global$7.getData('cmdOptions')
|
|
2288
2339
|
}));
|
|
2289
|
-
info$
|
|
2340
|
+
info$d('—————— 执行beforeNpmInstall 完成 ————');
|
|
2290
2341
|
}
|
|
2291
|
-
const npmInstallRes = await createTask$
|
|
2342
|
+
const npmInstallRes = await createTask$5(npmInstall$1, '小程序 开始npm install', '小程序npm install 完成')(tmsConfig, subPackages, useCache);
|
|
2292
2343
|
|
|
2293
2344
|
// 如果npm install 没有命中缓存,则说明node_module有更新,此时必须构建miniprogram_npm
|
|
2294
2345
|
if (!npmInstallRes.isCache) {
|
|
2295
2346
|
// 构建miniprogram_npm, 不使用缓存
|
|
2296
|
-
await createTask$
|
|
2347
|
+
await createTask$5(mpCiInstall, '开始构建miniprogram_npm', '构建miniprogram_npm 完成')(tmsConfig, subPackages, false);
|
|
2297
2348
|
} else {
|
|
2298
2349
|
// 构建miniprogram_npm
|
|
2299
|
-
await createTask$
|
|
2350
|
+
await createTask$5(mpCiInstall, '开始构建miniprogram_npm', '构建miniprogram_npm 完成')(tmsConfig, subPackages, useCache);
|
|
2300
2351
|
}
|
|
2301
2352
|
shelljs$3.cd(cwd);
|
|
2302
2353
|
}
|
|
2303
2354
|
async function npmInstall$1(tmsConfig, subPackages, useCache) {
|
|
2304
2355
|
// 如果依赖没有更新和使用缓存数据(则命中缓存)
|
|
2305
|
-
if (!isDependenciesUpdate(subPackages, resolve$
|
|
2306
|
-
info$
|
|
2356
|
+
if (!isDependenciesUpdate(subPackages, resolve$e('./'), tmsConfig.outputDir) && useCache) {
|
|
2357
|
+
info$d('node_modules命中缓存');
|
|
2307
2358
|
return {
|
|
2308
2359
|
isCache: true
|
|
2309
2360
|
};
|
|
2310
2361
|
}
|
|
2311
2362
|
// 拷贝模块的package.json到编译输出目录
|
|
2312
2363
|
subPackages.forEach(item => {
|
|
2313
|
-
const outputModuleDir = resolve$
|
|
2364
|
+
const outputModuleDir = resolve$e(`${tmsConfig.outputDir}/${item.root}`);
|
|
2314
2365
|
io$1.ensureDirExist(outputModuleDir);
|
|
2315
2366
|
const modulePackagePath = `${getAbsolutePath$4(item.path)}/package.json`;
|
|
2316
2367
|
if (fs$8.existsSync(modulePackagePath)) shelljs$3.cp('-Rf', modulePackagePath, outputModuleDir);
|
|
2317
2368
|
});
|
|
2318
|
-
await npmInstallAll(subPackages, resolve$
|
|
2369
|
+
await npmInstallAll(subPackages, resolve$e(tmsConfig.outputDir), NODE_MODULES_DIR$1);
|
|
2319
2370
|
return {
|
|
2320
2371
|
isCache: false
|
|
2321
2372
|
};
|
|
@@ -2324,12 +2375,12 @@ async function npmInstall$1(tmsConfig, subPackages, useCache) {
|
|
|
2324
2375
|
// 构建miniprogram_npm
|
|
2325
2376
|
async function mpCiInstall(tmsConfig, subPackages, useCache) {
|
|
2326
2377
|
const packageJsonFiles = [];
|
|
2327
|
-
const rootPackFile = resolve$
|
|
2378
|
+
const rootPackFile = resolve$e(`${tmsConfig.outputDir}/package.json`);
|
|
2328
2379
|
if (fs$8.existsSync(rootPackFile)) {
|
|
2329
2380
|
packageJsonFiles.push(rootPackFile);
|
|
2330
2381
|
}
|
|
2331
2382
|
subPackages.forEach(item => {
|
|
2332
|
-
const packageJsonFile = resolve$
|
|
2383
|
+
const packageJsonFile = resolve$e(`${tmsConfig.outputDir}/${item.root}/package.json`);
|
|
2333
2384
|
if (fs$8.existsSync(packageJsonFile)) {
|
|
2334
2385
|
packageJsonFiles.push(packageJsonFile);
|
|
2335
2386
|
}
|
|
@@ -2342,8 +2393,8 @@ async function mpCiInstall(tmsConfig, subPackages, useCache) {
|
|
|
2342
2393
|
if (useCache) {
|
|
2343
2394
|
let flag = true;
|
|
2344
2395
|
await Promise.all(packageJsonFiles.map(async item => {
|
|
2345
|
-
const packageDir = path$
|
|
2346
|
-
const mpDir = resolve$
|
|
2396
|
+
const packageDir = path$8.dirname(item);
|
|
2397
|
+
const mpDir = resolve$e(`${packageDir}/miniprogram_npm`);
|
|
2347
2398
|
const md5Value = await getMNPMd5(packageDir);
|
|
2348
2399
|
const preCache = getCache(mpDir, 'miniprogram_npm');
|
|
2349
2400
|
// console.log('miniprogram_npm', preCache, md5Value);
|
|
@@ -2355,14 +2406,14 @@ async function mpCiInstall(tmsConfig, subPackages, useCache) {
|
|
|
2355
2406
|
isCache = flag;
|
|
2356
2407
|
}
|
|
2357
2408
|
if (isCache) {
|
|
2358
|
-
info$
|
|
2409
|
+
info$d('miniprogram_npm命中缓存');
|
|
2359
2410
|
return;
|
|
2360
2411
|
}
|
|
2361
2412
|
|
|
2362
2413
|
// 即将构建,在cache中标记开始
|
|
2363
2414
|
await Promise.all(packageJsonFiles.map(async item => {
|
|
2364
|
-
const packageDir = path$
|
|
2365
|
-
const mpDir = resolve$
|
|
2415
|
+
const packageDir = path$8.dirname(item);
|
|
2416
|
+
const mpDir = resolve$e(`${packageDir}/miniprogram_npm`);
|
|
2366
2417
|
setCache(mpDir, 'miniprogram_npm', {
|
|
2367
2418
|
md5: '',
|
|
2368
2419
|
status: statusMap.doing
|
|
@@ -2370,14 +2421,14 @@ async function mpCiInstall(tmsConfig, subPackages, useCache) {
|
|
|
2370
2421
|
}));
|
|
2371
2422
|
await buildMpNpm({
|
|
2372
2423
|
appId: tmsConfig.appId,
|
|
2373
|
-
projectPath: resolve$
|
|
2424
|
+
projectPath: resolve$e('./'),
|
|
2374
2425
|
privateKey: tmsConfig.privateKey
|
|
2375
2426
|
});
|
|
2376
2427
|
|
|
2377
2428
|
// 构建成功后,计算md5写入cache
|
|
2378
2429
|
await Promise.all(packageJsonFiles.map(async item => {
|
|
2379
|
-
const packageDir = path$
|
|
2380
|
-
const mpDir = resolve$
|
|
2430
|
+
const packageDir = path$8.dirname(item);
|
|
2431
|
+
const mpDir = resolve$e(`${packageDir}/miniprogram_npm`);
|
|
2381
2432
|
const md5Value = await getMNPMd5(packageDir);
|
|
2382
2433
|
setCache(mpDir, 'miniprogram_npm', {
|
|
2383
2434
|
md5: md5Value,
|
|
@@ -2398,7 +2449,7 @@ async function getMNPMd5(cwd) {
|
|
|
2398
2449
|
cwd,
|
|
2399
2450
|
...shellJsOption
|
|
2400
2451
|
});
|
|
2401
|
-
const tarDir = path$
|
|
2452
|
+
const tarDir = path$8.join(cwd, './miniprogram_npm.tar.gz');
|
|
2402
2453
|
const md5Value = await fileMd5(tarDir);
|
|
2403
2454
|
shelljs$3.rm('-rf', tarDir);
|
|
2404
2455
|
return md5Value;
|
|
@@ -2411,11 +2462,11 @@ const shelljs$2 = require$$0__default$2;
|
|
|
2411
2462
|
const fs$7 = require$$0__default$1;
|
|
2412
2463
|
const io = io$3;
|
|
2413
2464
|
const {
|
|
2414
|
-
resolve: resolve$
|
|
2415
|
-
createTask: createTask$
|
|
2465
|
+
resolve: resolve$d,
|
|
2466
|
+
createTask: createTask$4
|
|
2416
2467
|
} = widgets;
|
|
2417
2468
|
const {
|
|
2418
|
-
buildOutputAppJson: buildOutputAppJson$
|
|
2469
|
+
buildOutputAppJson: buildOutputAppJson$2
|
|
2419
2470
|
} = buildAppJson;
|
|
2420
2471
|
const {
|
|
2421
2472
|
MODULE_CODE_DIR: MODULE_CODE_DIR$1,
|
|
@@ -2430,7 +2481,7 @@ const {
|
|
|
2430
2481
|
} = tmsMpconfig.exports;
|
|
2431
2482
|
const {
|
|
2432
2483
|
fail: fail$4,
|
|
2433
|
-
info: info$
|
|
2484
|
+
info: info$c
|
|
2434
2485
|
} = log$1;
|
|
2435
2486
|
const install$2 = install_1;
|
|
2436
2487
|
|
|
@@ -2442,17 +2493,17 @@ const install$2 = install_1;
|
|
|
2442
2493
|
* @returns
|
|
2443
2494
|
*/
|
|
2444
2495
|
const cpFilesToOutput = function (tmsConfig, defaultFiles) {
|
|
2445
|
-
const outputDir = resolve$
|
|
2496
|
+
const outputDir = resolve$d(tmsConfig.outputDir);
|
|
2446
2497
|
io.ensureDirExist(outputDir);
|
|
2447
2498
|
defaultFiles.forEach(item => {
|
|
2448
|
-
if (fs$7.existsSync(resolve$
|
|
2449
|
-
shelljs$2.cp('-rf', resolve$
|
|
2499
|
+
if (fs$7.existsSync(resolve$d(item))) {
|
|
2500
|
+
shelljs$2.cp('-rf', resolve$d(item), resolve$d(tmsConfig.outputDir, item));
|
|
2450
2501
|
}
|
|
2451
2502
|
});
|
|
2452
2503
|
};
|
|
2453
2504
|
async function task(tmsConfig, targetModules) {
|
|
2454
2505
|
// 下载和移动代码
|
|
2455
|
-
await createTask$
|
|
2506
|
+
await createTask$4(cloneModules, '开始下载模块代码', '下载模块代码码完成')(MODULE_CODE_DIR$1, resolve$d('./'), targetModules);
|
|
2456
2507
|
|
|
2457
2508
|
// 获取所有模块,合并模块依赖的模块
|
|
2458
2509
|
const newModules = getModulesByMergeDepModules$2(tmsConfig, targetModules, true);
|
|
@@ -2460,13 +2511,13 @@ async function task(tmsConfig, targetModules) {
|
|
|
2460
2511
|
const newSubPackages = getSubPackages$2(newModules);
|
|
2461
2512
|
|
|
2462
2513
|
// 拷贝相关配置文件到输出目录
|
|
2463
|
-
await createTask$
|
|
2514
|
+
await createTask$4(cpFilesToOutput, '开始拷贝文件到编译输出目录', '拷贝文件到编译输出目录完成')(tmsConfig, DEFAULT_COPY_CONFIG$1);
|
|
2464
2515
|
|
|
2465
2516
|
// install
|
|
2466
2517
|
await install$2(tmsConfig, newSubPackages, true);
|
|
2467
2518
|
|
|
2468
2519
|
// 动态生成编译后的app.json;
|
|
2469
|
-
await createTask$
|
|
2520
|
+
await createTask$4(buildOutputAppJson$2, '开始生成编译后的app.json', '生成编译后的app.json完成')(tmsConfig, newModules);
|
|
2470
2521
|
return {
|
|
2471
2522
|
modules: newModules,
|
|
2472
2523
|
subPackages: newSubPackages
|
|
@@ -2479,7 +2530,7 @@ async function init$3(tmsConfig, targetModules) {
|
|
|
2479
2530
|
} catch (error) {
|
|
2480
2531
|
const errMsg = typeof error === 'object' ? error.message : error;
|
|
2481
2532
|
fail$4(`初始化流程出现错误: ${errMsg}`);
|
|
2482
|
-
info$
|
|
2533
|
+
info$c('详细的错误信息', error);
|
|
2483
2534
|
process.exit(1);
|
|
2484
2535
|
}
|
|
2485
2536
|
}
|
|
@@ -2501,24 +2552,119 @@ function mpProjectJson$1() {
|
|
|
2501
2552
|
}
|
|
2502
2553
|
var mpProjectJson_1 = mpProjectJson$1;
|
|
2503
2554
|
|
|
2555
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
2556
|
+
const through$1 = require$$0__default$8;
|
|
2557
|
+
const pp = require$$1__default$3;
|
|
2558
|
+
const path$7 = require$$1__default$1;
|
|
2559
|
+
const chalk$4 = require$$3__default;
|
|
2560
|
+
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
2561
|
+
|
|
2562
|
+
// 允许渲染的文件类型列表
|
|
2563
|
+
const TEMPLATE_FILE_EXTENSIONS = ['.json', '.js', '.ts', '.wxml', '.wxss', '.wxs', '.css', '.less', '.scss'];
|
|
2564
|
+
|
|
2565
|
+
/**
|
|
2566
|
+
* 获取预处理器类型
|
|
2567
|
+
* @param {string} extName 文件扩展名
|
|
2568
|
+
* @returns {string} 预处理器类型
|
|
2569
|
+
*/
|
|
2570
|
+
const getPreprocessType = extName => {
|
|
2571
|
+
const type = extName.replace('.', '');
|
|
2572
|
+
if (type === 'wxml') return 'html';
|
|
2573
|
+
if (type === 'wxs') return 'js';
|
|
2574
|
+
if (type === 'wxss') return 'css';
|
|
2575
|
+
return type;
|
|
2576
|
+
};
|
|
2577
|
+
|
|
2578
|
+
/**
|
|
2579
|
+
* 获取错误上下文信息
|
|
2580
|
+
* @param {string} content 文件内容
|
|
2581
|
+
* @param {number} errorLine 错误行号
|
|
2582
|
+
* @param {number} contextLines 上下文行数
|
|
2583
|
+
* @returns {string} 格式化的错误上下文
|
|
2584
|
+
*/
|
|
2585
|
+
const getErrorContext = (content, errorLine, contextLines = 2) => {
|
|
2586
|
+
const lines = content.split('\n');
|
|
2587
|
+
const start = Math.max(1, errorLine - contextLines);
|
|
2588
|
+
const end = Math.min(lines.length, errorLine + contextLines);
|
|
2589
|
+
let context = '';
|
|
2590
|
+
for (let i = start; i <= end; i++) {
|
|
2591
|
+
const marker = i === errorLine ? ' >> ' : ' ';
|
|
2592
|
+
context += `${marker}${i}| ${lines[i - 1]}\n`;
|
|
2593
|
+
}
|
|
2594
|
+
return context;
|
|
2595
|
+
};
|
|
2596
|
+
|
|
2597
|
+
/**
|
|
2598
|
+
* 打印错误信息
|
|
2599
|
+
* @param {string} filePath 文件路径
|
|
2600
|
+
* @param {string} context 错误上下文
|
|
2601
|
+
* @param {Error} error 错误对象
|
|
2602
|
+
*/
|
|
2603
|
+
const printError = (filePath, context, error) => {
|
|
2604
|
+
console.error(`${chalk$4.yellow('渲染模板出错,请检查处理:')}\n${chalk$4.yellow('文件:')}\n${chalk$4.yellow(filePath)}\n${chalk$4.yellow('错误位置:')}\n${chalk$4.gray(context)}\n${chalk$4.red('错误信息:')}\n${chalk$4.red(error.message)}\n${chalk$4.gray('--------------------------------')}`);
|
|
2605
|
+
};
|
|
2606
|
+
|
|
2607
|
+
/**
|
|
2608
|
+
* 模板渲染插件
|
|
2609
|
+
* @param {Object} tmsConfig 配置对象
|
|
2610
|
+
* @returns {Object} through2 转换流
|
|
2611
|
+
*/
|
|
2612
|
+
var tmsTemplateRender = function tmsTemplateRender(tmsConfig) {
|
|
2613
|
+
return through$1.obj((file, encoding, callback) => {
|
|
2614
|
+
if (!file.isBuffer()) {
|
|
2615
|
+
return callback(null, file);
|
|
2616
|
+
}
|
|
2617
|
+
const extName = path$7.extname(file.path).toLowerCase();
|
|
2618
|
+
if (!TEMPLATE_FILE_EXTENSIONS.includes(extName)) {
|
|
2619
|
+
return callback(null, file);
|
|
2620
|
+
}
|
|
2621
|
+
const content = file.contents.toString(encoding);
|
|
2622
|
+
try {
|
|
2623
|
+
const vars = tmsConfig.templateVars || {};
|
|
2624
|
+
const ppType = getPreprocessType(extName);
|
|
2625
|
+
// 手动检查 @echo 引用的变量是否存在
|
|
2626
|
+
const echoPattern = /\/\* @echo (\w+) \*\//g;
|
|
2627
|
+
let match;
|
|
2628
|
+
while ((match = echoPattern.exec(content)) !== null) {
|
|
2629
|
+
const variableName = match[1];
|
|
2630
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
2631
|
+
if (!vars.hasOwnProperty(variableName)) {
|
|
2632
|
+
const error = new Error(`变量 ${variableName} 未定义`);
|
|
2633
|
+
error.line = content.substring(0, match.index).split('\n').length;
|
|
2634
|
+
throw error;
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
const rendered = pp.preprocess(content, vars, ppType);
|
|
2638
|
+
// eslint-disable-next-line no-param-reassign
|
|
2639
|
+
file.contents = Buffer.from(rendered);
|
|
2640
|
+
} catch (err) {
|
|
2641
|
+
const context = getErrorContext(content, err.line || 1);
|
|
2642
|
+
printError(file.path, context, err);
|
|
2643
|
+
// 直接抛出异常,中断编译流程
|
|
2644
|
+
throw new Error(`模板渲染失败: ${file.path}\n${err.message}`);
|
|
2645
|
+
}
|
|
2646
|
+
callback(null, file);
|
|
2647
|
+
});
|
|
2648
|
+
};
|
|
2649
|
+
|
|
2504
2650
|
const {
|
|
2505
2651
|
src: src$2,
|
|
2506
2652
|
dest: dest$1
|
|
2507
|
-
} = require$$0__default$
|
|
2653
|
+
} = require$$0__default$9;
|
|
2508
2654
|
const path$6 = require$$1__default$1;
|
|
2509
2655
|
const minimatch = require$$2__default;
|
|
2510
2656
|
const gulpif = require$$3__default$1;
|
|
2511
2657
|
const mpProjectJson = mpProjectJson_1;
|
|
2512
2658
|
const {
|
|
2513
|
-
resolve: resolve$
|
|
2659
|
+
resolve: resolve$c
|
|
2514
2660
|
} = widgets;
|
|
2515
|
-
const through = require$$
|
|
2661
|
+
const through = require$$0__default$8;
|
|
2516
2662
|
const {
|
|
2517
2663
|
fail: fail$3
|
|
2518
2664
|
} = log$1;
|
|
2519
2665
|
const getTargetFile$2 = (sourceFile, module, outputDir) => {
|
|
2520
|
-
const sourceFileRelativeModule = path$6.relative(resolve$
|
|
2521
|
-
const targetFile = resolve$
|
|
2666
|
+
const sourceFileRelativeModule = path$6.relative(resolve$c(module.from), sourceFile);
|
|
2667
|
+
const targetFile = resolve$c(outputDir, module.to, sourceFileRelativeModule);
|
|
2522
2668
|
return targetFile;
|
|
2523
2669
|
};
|
|
2524
2670
|
const addPlugins = function (tmsConfig, srcPipe, pluginParams) {
|
|
@@ -2529,7 +2675,7 @@ const addPlugins = function (tmsConfig, srcPipe, pluginParams) {
|
|
|
2529
2675
|
glob: '**/project.config.json',
|
|
2530
2676
|
action: mpProjectJson()
|
|
2531
2677
|
}, ...plugins];
|
|
2532
|
-
return newPlugins.reduce((
|
|
2678
|
+
return newPlugins.reduce((currentPipe, pluginItem) => currentPipe.pipe(gulpif(vinyl => minimatch(vinyl.path, pluginItem.glob), through.obj(function (vinyl, enc, next) {
|
|
2533
2679
|
const sourceFile = vinyl.history[0];
|
|
2534
2680
|
pluginItem.action({
|
|
2535
2681
|
tmsConfig,
|
|
@@ -2558,6 +2704,12 @@ var compile$1 = function (tmsConfig, {
|
|
|
2558
2704
|
let srcPipe = src$2(newGlobValue, {
|
|
2559
2705
|
...srcOption
|
|
2560
2706
|
});
|
|
2707
|
+
|
|
2708
|
+
// 在文件读取后,插件处理之前先加入模板渲染插件
|
|
2709
|
+
const templateRender = tmsTemplateRender;
|
|
2710
|
+
srcPipe = srcPipe.pipe(templateRender(tmsConfig));
|
|
2711
|
+
|
|
2712
|
+
// 后续步骤继续执行其他插件
|
|
2561
2713
|
const pluginParams = {
|
|
2562
2714
|
module,
|
|
2563
2715
|
isDev
|
|
@@ -2573,15 +2725,15 @@ var compile$1 = function (tmsConfig, {
|
|
|
2573
2725
|
|
|
2574
2726
|
/* eslint-disable */
|
|
2575
2727
|
// 该文件源于npm包 gulp-watch 但内部有bug, 故源码进行单独修改
|
|
2576
|
-
const assign = require$$0__default$
|
|
2728
|
+
const assign = require$$0__default$a;
|
|
2577
2729
|
const path$5 = require$$1__default$1;
|
|
2578
2730
|
const PluginError = require$$2__default$1;
|
|
2579
2731
|
const fancyLog = require$$3__default$2;
|
|
2580
|
-
const colors = require$$4__default$
|
|
2732
|
+
const colors = require$$4__default$2;
|
|
2581
2733
|
const chokidar = require$$5__default;
|
|
2582
2734
|
const {
|
|
2583
2735
|
Duplex
|
|
2584
|
-
} = require$$6__default
|
|
2736
|
+
} = require$$6__default;
|
|
2585
2737
|
const vinyl = require$$7__default;
|
|
2586
2738
|
const File = require$$8__default;
|
|
2587
2739
|
const anymatch = require$$9__default;
|
|
@@ -2720,14 +2872,14 @@ const path$4 = require$$1__default$1;
|
|
|
2720
2872
|
const shellJs$2 = require$$0__default$2;
|
|
2721
2873
|
const {
|
|
2722
2874
|
series: series$2
|
|
2723
|
-
} = require$$0__default$
|
|
2875
|
+
} = require$$0__default$9;
|
|
2724
2876
|
const {
|
|
2725
|
-
info: info$
|
|
2877
|
+
info: info$b,
|
|
2726
2878
|
warn: warn$1,
|
|
2727
2879
|
fail: fail$2
|
|
2728
2880
|
} = log$1;
|
|
2729
2881
|
const {
|
|
2730
|
-
resolve: resolve$
|
|
2882
|
+
resolve: resolve$b,
|
|
2731
2883
|
filterField: filterField$5
|
|
2732
2884
|
} = widgets;
|
|
2733
2885
|
const {
|
|
@@ -2736,7 +2888,7 @@ const {
|
|
|
2736
2888
|
const {
|
|
2737
2889
|
checkPackageVersion
|
|
2738
2890
|
} = checkDependencies;
|
|
2739
|
-
const report$
|
|
2891
|
+
const report$8 = report_1;
|
|
2740
2892
|
const TIP_MAP = {
|
|
2741
2893
|
'package.json': {
|
|
2742
2894
|
tip: '依赖版本有变动,请重新执行tmskit run dev',
|
|
@@ -2763,14 +2915,14 @@ const logTip = (fileName, sourceFile, targetFile, tipMap) => {
|
|
|
2763
2915
|
return;
|
|
2764
2916
|
}
|
|
2765
2917
|
}
|
|
2766
|
-
info$
|
|
2918
|
+
info$b(`${fileName}有更新`);
|
|
2767
2919
|
} catch (e) {
|
|
2768
2920
|
fail$2(`${sourceFile}文件更新提示出现错误: ${e.message}`);
|
|
2769
2921
|
}
|
|
2770
2922
|
};
|
|
2771
2923
|
const getTargetFile$1 = (sourceFile, module, outputDir) => {
|
|
2772
|
-
const sourceFileRelativeModule = path$4.relative(resolve$
|
|
2773
|
-
return resolve$
|
|
2924
|
+
const sourceFileRelativeModule = path$4.relative(resolve$b(module.from), sourceFile);
|
|
2925
|
+
return resolve$b(outputDir, module.to, sourceFileRelativeModule);
|
|
2774
2926
|
};
|
|
2775
2927
|
var watch_1 = function (globValue, watchOptions, callback, module) {
|
|
2776
2928
|
watch$2(globValue, {
|
|
@@ -2787,7 +2939,7 @@ var watch_1 = function (globValue, watchOptions, callback, module) {
|
|
|
2787
2939
|
targetFile = path$4.join(module.to, filePath);
|
|
2788
2940
|
}
|
|
2789
2941
|
if (vinyl.event === 'unlink' || vinyl.event === 'unlinkDir') {
|
|
2790
|
-
info$
|
|
2942
|
+
info$b(`删除${sourceFileName}`);
|
|
2791
2943
|
shellJs$2.rm('-rf', targetFile);
|
|
2792
2944
|
updateFileHook(tmsConfig, sourceFile, targetFile, vinyl.event);
|
|
2793
2945
|
return;
|
|
@@ -2836,7 +2988,7 @@ async function updateFileHook(tmsConfig, sourceFile, targetFile, type) {
|
|
|
2836
2988
|
targetFile,
|
|
2837
2989
|
type
|
|
2838
2990
|
});
|
|
2839
|
-
report$
|
|
2991
|
+
report$8('hooks:updateFile');
|
|
2840
2992
|
}
|
|
2841
2993
|
}
|
|
2842
2994
|
|
|
@@ -2847,15 +2999,15 @@ const chalk$3 = require$$3__default;
|
|
|
2847
2999
|
const {
|
|
2848
3000
|
parallel: parallel$1,
|
|
2849
3001
|
series: series$1
|
|
2850
|
-
} = require$$0__default$
|
|
3002
|
+
} = require$$0__default$9;
|
|
2851
3003
|
const {
|
|
2852
|
-
resolve: resolve$
|
|
3004
|
+
resolve: resolve$a,
|
|
2853
3005
|
mergeMap,
|
|
2854
3006
|
filterField: filterField$4,
|
|
2855
3007
|
getAbsolutePath: getAbsolutePath$3
|
|
2856
3008
|
} = widgets;
|
|
2857
3009
|
const {
|
|
2858
|
-
buildOutputAppJson
|
|
3010
|
+
buildOutputAppJson: buildOutputAppJson$1
|
|
2859
3011
|
} = buildAppJson;
|
|
2860
3012
|
const {
|
|
2861
3013
|
DEFAULT_COPY_CONFIG
|
|
@@ -2863,9 +3015,9 @@ const {
|
|
|
2863
3015
|
const compile = compile$1;
|
|
2864
3016
|
const watch$1 = watch_1;
|
|
2865
3017
|
const {
|
|
2866
|
-
info: info$
|
|
3018
|
+
info: info$a
|
|
2867
3019
|
} = log$1;
|
|
2868
|
-
const report$
|
|
3020
|
+
const report$7 = report_1;
|
|
2869
3021
|
const {
|
|
2870
3022
|
global: global$5
|
|
2871
3023
|
} = global_1;
|
|
@@ -2875,12 +3027,12 @@ var dev$4 = async (tmsConfig, modules, isDev = true) => {
|
|
|
2875
3027
|
|
|
2876
3028
|
// 监听根目录的文件
|
|
2877
3029
|
mergeMap(compileTasksMap, compile(tmsConfig, {
|
|
2878
|
-
glob: DEFAULT_COPY_CONFIG.map(item => resolve$
|
|
3030
|
+
glob: DEFAULT_COPY_CONFIG.map(item => resolve$a(item)),
|
|
2879
3031
|
module: {
|
|
2880
|
-
from: resolve$
|
|
2881
|
-
to: resolve$
|
|
3032
|
+
from: resolve$a(),
|
|
3033
|
+
to: resolve$a(tmsConfig.outputDir)
|
|
2882
3034
|
},
|
|
2883
|
-
destPath: resolve$
|
|
3035
|
+
destPath: resolve$a(tmsConfig.outputDir),
|
|
2884
3036
|
srcOption: {
|
|
2885
3037
|
allowEmpty: true
|
|
2886
3038
|
},
|
|
@@ -2916,12 +3068,12 @@ var dev$4 = async (tmsConfig, modules, isDev = true) => {
|
|
|
2916
3068
|
...moduleItem
|
|
2917
3069
|
};
|
|
2918
3070
|
const srcModulePath = getAbsolutePath$3(moduleItem.path);
|
|
2919
|
-
const buildModulePath = resolve$
|
|
3071
|
+
const buildModulePath = resolve$a(tmsConfig.outputDir, moduleItem.modulePath);
|
|
2920
3072
|
if (isDev) {
|
|
2921
3073
|
// 监听模块配置文件
|
|
2922
3074
|
watch$1([`${srcModulePath}/**/module.config.json`], {
|
|
2923
3075
|
events: watchEvents
|
|
2924
|
-
}, () => buildOutputAppJson(tmsConfig, modules, isDev), {
|
|
3076
|
+
}, () => buildOutputAppJson$1(tmsConfig, modules, isDev), {
|
|
2925
3077
|
from: srcModulePath,
|
|
2926
3078
|
to: buildModulePath
|
|
2927
3079
|
});
|
|
@@ -2930,12 +3082,14 @@ var dev$4 = async (tmsConfig, modules, isDev = true) => {
|
|
|
2930
3082
|
const newPath = getAbsolutePath$3(ePath, srcModulePath);
|
|
2931
3083
|
const ext = path$3.extname(ePath).slice(1);
|
|
2932
3084
|
if (ext) {
|
|
2933
|
-
return `!${resolve$
|
|
3085
|
+
return `!${resolve$a(srcModulePath, newPath)}`;
|
|
2934
3086
|
}
|
|
2935
|
-
return `!${resolve$
|
|
3087
|
+
return `!${resolve$a(srcModulePath, newPath)}/**/*`;
|
|
2936
3088
|
});
|
|
3089
|
+
const moduleConfigPath = `${srcModulePath}/**/module.config.json`;
|
|
3090
|
+
const moduleConfigGlob = tmsConfig.isKeepModuleConfig ? `${moduleConfigPath}` : `!${moduleConfigPath}`;
|
|
2937
3091
|
mergeMap(compileTasksMap, compile(tmsConfig, {
|
|
2938
|
-
glob: [`${srcModulePath}/**/*`,
|
|
3092
|
+
glob: [`${srcModulePath}/**/*`, moduleConfigGlob, ...excludes],
|
|
2939
3093
|
destPath: buildModulePath,
|
|
2940
3094
|
module: {
|
|
2941
3095
|
from: srcModulePath,
|
|
@@ -2979,7 +3133,7 @@ var dev$4 = async (tmsConfig, modules, isDev = true) => {
|
|
|
2979
3133
|
let eTime;
|
|
2980
3134
|
const spinner = ora$1();
|
|
2981
3135
|
function start(cb) {
|
|
2982
|
-
info$
|
|
3136
|
+
info$a('启动编译...');
|
|
2983
3137
|
spinner.start();
|
|
2984
3138
|
sTime = new Date().getTime();
|
|
2985
3139
|
cb();
|
|
@@ -2988,12 +3142,12 @@ var dev$4 = async (tmsConfig, modules, isDev = true) => {
|
|
|
2988
3142
|
var _tmsConfig$hooks;
|
|
2989
3143
|
if (isDev) {
|
|
2990
3144
|
// 监听app.json
|
|
2991
|
-
watch$1([resolve$
|
|
3145
|
+
watch$1([resolve$a('app.json')], {
|
|
2992
3146
|
ignoreInitial: false,
|
|
2993
3147
|
events: watchEvents
|
|
2994
|
-
}, async () => await buildOutputAppJson(tmsConfig, modules, isDev), {
|
|
2995
|
-
from: resolve$
|
|
2996
|
-
to: resolve$
|
|
3148
|
+
}, async () => await buildOutputAppJson$1(tmsConfig, modules, isDev), {
|
|
3149
|
+
from: resolve$a(),
|
|
3150
|
+
to: resolve$a(tmsConfig.outputDir)
|
|
2997
3151
|
});
|
|
2998
3152
|
// 监听其他文件
|
|
2999
3153
|
compileTasksMap.forEach(({
|
|
@@ -3006,7 +3160,7 @@ var dev$4 = async (tmsConfig, modules, isDev = true) => {
|
|
|
3006
3160
|
}, taskFn, module);
|
|
3007
3161
|
});
|
|
3008
3162
|
} else {
|
|
3009
|
-
await buildOutputAppJson(tmsConfig, modules, isDev);
|
|
3163
|
+
await buildOutputAppJson$1(tmsConfig, modules, isDev);
|
|
3010
3164
|
}
|
|
3011
3165
|
eTime = new Date().getTime() - sTime;
|
|
3012
3166
|
if (typeof (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks = tmsConfig.hooks) === null || _tmsConfig$hooks === void 0 ? void 0 : _tmsConfig$hooks.afterFirstCompile) === 'function') {
|
|
@@ -3017,7 +3171,7 @@ var dev$4 = async (tmsConfig, modules, isDev = true) => {
|
|
|
3017
3171
|
modules,
|
|
3018
3172
|
cmdOptions: global$5.getData('cmdOptions')
|
|
3019
3173
|
}));
|
|
3020
|
-
report$
|
|
3174
|
+
report$7('hooks:afterCompile');
|
|
3021
3175
|
}
|
|
3022
3176
|
spinner.succeed(chalk$3.green(`首次编译完成, 耗时${eTime / 1000}s, 微信开发者工具打开项目即可预览。`));
|
|
3023
3177
|
spinner.stop();
|
|
@@ -3036,16 +3190,19 @@ var dev$4 = async (tmsConfig, modules, isDev = true) => {
|
|
|
3036
3190
|
const shelljs$1 = require$$0__default$2;
|
|
3037
3191
|
const compileDev = dev$4;
|
|
3038
3192
|
const {
|
|
3039
|
-
resolve: resolve$
|
|
3193
|
+
resolve: resolve$9,
|
|
3040
3194
|
filterField: filterField$3
|
|
3041
3195
|
} = widgets;
|
|
3042
3196
|
const init$2 = init_1;
|
|
3197
|
+
const {
|
|
3198
|
+
buildOutputAppJson
|
|
3199
|
+
} = buildAppJson;
|
|
3043
3200
|
const {
|
|
3044
3201
|
getModulesByMergeDepModules: getModulesByMergeDepModules$1,
|
|
3045
3202
|
getSubPackages: getSubPackages$1
|
|
3046
3203
|
} = tmsMpconfig.exports;
|
|
3047
3204
|
const {
|
|
3048
|
-
info: info$
|
|
3205
|
+
info: info$9
|
|
3049
3206
|
} = log$1;
|
|
3050
3207
|
const {
|
|
3051
3208
|
global: global$4
|
|
@@ -3054,7 +3211,7 @@ const {
|
|
|
3054
3211
|
MODULE_CODE_DIR,
|
|
3055
3212
|
NODE_MODULES_DIR
|
|
3056
3213
|
} = constant;
|
|
3057
|
-
const report$
|
|
3214
|
+
const report$6 = report_1;
|
|
3058
3215
|
// const { recommendVersion } = require('../../../core/recommendVersion');
|
|
3059
3216
|
|
|
3060
3217
|
// 用户编译分包时,需要将dist中其他分包(主包不能删除)的内容删除,否则其他分包的内容混入到主包(导致主包的体积超2M)
|
|
@@ -3066,7 +3223,7 @@ function delOtherPackages(tmsConfig, targetSubPackages) {
|
|
|
3066
3223
|
const targetSubPackagesName = targetSubPackages.map(item => item.name);
|
|
3067
3224
|
allSubPackages.forEach(item => {
|
|
3068
3225
|
if (item.root && targetSubPackagesName.indexOf(item.name) === -1) {
|
|
3069
|
-
const moduleRootDir = resolve$
|
|
3226
|
+
const moduleRootDir = resolve$9(`${tmsConfig.outputDir}/${item.root}`);
|
|
3070
3227
|
shelljs$1.rm('-rf', `${moduleRootDir}/*`, {
|
|
3071
3228
|
silent: true
|
|
3072
3229
|
});
|
|
@@ -3081,7 +3238,7 @@ async function dev$3(tmsConfig, targetModules) {
|
|
|
3081
3238
|
noCache
|
|
3082
3239
|
} = global$4.getData('cmdOptions');
|
|
3083
3240
|
if (noCache) {
|
|
3084
|
-
shelljs$1.rm('-rf', resolve$
|
|
3241
|
+
shelljs$1.rm('-rf', resolve$9(tmsConfig.outputDir));
|
|
3085
3242
|
shelljs$1.rm('-rf', MODULE_CODE_DIR);
|
|
3086
3243
|
shelljs$1.rm('-rf', NODE_MODULES_DIR);
|
|
3087
3244
|
}
|
|
@@ -3093,7 +3250,10 @@ async function dev$3(tmsConfig, targetModules) {
|
|
|
3093
3250
|
subPackages,
|
|
3094
3251
|
modules: newModules
|
|
3095
3252
|
} = await init$2(tmsConfig, targetModules);
|
|
3096
|
-
|
|
3253
|
+
|
|
3254
|
+
// 在启动开发环境前主动执行生成 app.json
|
|
3255
|
+
await buildOutputAppJson(tmsConfig, newModules);
|
|
3256
|
+
info$9('当前dev启动的有效模块', newModules.map(item => item.moduleName).sort());
|
|
3097
3257
|
if (typeof (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks = tmsConfig.hooks) === null || _tmsConfig$hooks === void 0 ? void 0 : _tmsConfig$hooks.beforeFirstCompile) === 'function') {
|
|
3098
3258
|
var _tmsConfig$hooks2;
|
|
3099
3259
|
await (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks2 = tmsConfig.hooks) === null || _tmsConfig$hooks2 === void 0 ? void 0 : _tmsConfig$hooks2.beforeFirstCompile({
|
|
@@ -3102,7 +3262,7 @@ async function dev$3(tmsConfig, targetModules) {
|
|
|
3102
3262
|
modules: newModules,
|
|
3103
3263
|
cmdOptions: global$4.getData('cmdOptions')
|
|
3104
3264
|
}));
|
|
3105
|
-
report$
|
|
3265
|
+
report$6('hooks:beforeCompile');
|
|
3106
3266
|
}
|
|
3107
3267
|
delOtherPackages(tmsConfig, subPackages);
|
|
3108
3268
|
compileDev(tmsConfig, newModules, true);
|
|
@@ -3116,26 +3276,26 @@ var build$2 = async (tmsConfig, newModules, isDev) => {
|
|
|
3116
3276
|
|
|
3117
3277
|
const shelljs = require$$0__default$2;
|
|
3118
3278
|
const {
|
|
3119
|
-
resolve: resolve$
|
|
3279
|
+
resolve: resolve$8,
|
|
3120
3280
|
filterField: filterField$2
|
|
3121
3281
|
} = widgets;
|
|
3122
3282
|
const init$1 = init_1;
|
|
3123
3283
|
const {
|
|
3124
|
-
info: info$
|
|
3284
|
+
info: info$8
|
|
3125
3285
|
} = log$1;
|
|
3126
3286
|
const compileBuild = build$2;
|
|
3127
|
-
const report$
|
|
3287
|
+
const report$5 = report_1;
|
|
3128
3288
|
const {
|
|
3129
3289
|
global: global$3
|
|
3130
3290
|
} = global_1;
|
|
3131
3291
|
async function build$1(tmsConfig, targetModules) {
|
|
3132
3292
|
var _tmsConfig$hooks;
|
|
3133
3293
|
// 开始构建前,清理输出目录
|
|
3134
|
-
await shelljs.rm('-rf', resolve$
|
|
3294
|
+
await shelljs.rm('-rf', resolve$8(tmsConfig.outputDir));
|
|
3135
3295
|
const {
|
|
3136
3296
|
modules: newModules
|
|
3137
3297
|
} = await init$1(tmsConfig, targetModules);
|
|
3138
|
-
info$
|
|
3298
|
+
info$8('当前build有效模块', newModules.map(item => item.moduleName).sort());
|
|
3139
3299
|
const isDev = false;
|
|
3140
3300
|
if (typeof (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks = tmsConfig.hooks) === null || _tmsConfig$hooks === void 0 ? void 0 : _tmsConfig$hooks.beforeFirstCompile) === 'function') {
|
|
3141
3301
|
var _tmsConfig$hooks2;
|
|
@@ -3145,7 +3305,7 @@ async function build$1(tmsConfig, targetModules) {
|
|
|
3145
3305
|
modules: newModules,
|
|
3146
3306
|
cmdOptions: global$3.getData('cmdOptions')
|
|
3147
3307
|
}));
|
|
3148
|
-
report$
|
|
3308
|
+
report$5('hooks:beforeCompile');
|
|
3149
3309
|
}
|
|
3150
3310
|
compileBuild(tmsConfig, newModules, isDev);
|
|
3151
3311
|
}
|
|
@@ -3171,7 +3331,7 @@ function getAllSize$2(data = {}) {
|
|
|
3171
3331
|
}
|
|
3172
3332
|
return allSize;
|
|
3173
3333
|
}
|
|
3174
|
-
const getDesc$
|
|
3334
|
+
const getDesc$3 = (desc = '') => {
|
|
3175
3335
|
const user = getGitUser();
|
|
3176
3336
|
const date = moment().format('YYYY-MM-DD HH:mm:ss');
|
|
3177
3337
|
return `构建描述:${desc}; 构建人: ${user}; 构建时间:${date}`;
|
|
@@ -3189,24 +3349,24 @@ const getDetaultVersion = () => {
|
|
|
3189
3349
|
};
|
|
3190
3350
|
var utils = {
|
|
3191
3351
|
getAllSize: getAllSize$2,
|
|
3192
|
-
getDesc: getDesc$
|
|
3352
|
+
getDesc: getDesc$3,
|
|
3193
3353
|
outputInfo: outputInfo$2,
|
|
3194
3354
|
getDetaultVersion
|
|
3195
3355
|
};
|
|
3196
3356
|
|
|
3197
|
-
const mpCi$
|
|
3357
|
+
const mpCi$2 = mpCi$3;
|
|
3198
3358
|
const fs$4 = require$$0__default$1;
|
|
3199
3359
|
const {
|
|
3200
|
-
resolve: resolve$
|
|
3201
|
-
createTask: createTask$
|
|
3360
|
+
resolve: resolve$7,
|
|
3361
|
+
createTask: createTask$3,
|
|
3202
3362
|
getAbsolutePath: getAbsolutePath$1,
|
|
3203
3363
|
filterField: filterField$1
|
|
3204
3364
|
} = widgets;
|
|
3205
3365
|
const {
|
|
3206
|
-
handleError: handleError$
|
|
3366
|
+
handleError: handleError$4
|
|
3207
3367
|
} = handleError_1;
|
|
3208
3368
|
const {
|
|
3209
|
-
info: info$
|
|
3369
|
+
info: info$7
|
|
3210
3370
|
} = log$1;
|
|
3211
3371
|
const {
|
|
3212
3372
|
global: global$2
|
|
@@ -3214,10 +3374,10 @@ const {
|
|
|
3214
3374
|
const {
|
|
3215
3375
|
getAllSize: getAllSize$1,
|
|
3216
3376
|
outputInfo: outputInfo$1,
|
|
3217
|
-
getDesc: getDesc$
|
|
3377
|
+
getDesc: getDesc$2
|
|
3218
3378
|
} = utils;
|
|
3219
|
-
const report$
|
|
3220
|
-
const handleParams$
|
|
3379
|
+
const report$4 = report_1;
|
|
3380
|
+
const handleParams$2 = (tmsConfig, cmdOptions) => {
|
|
3221
3381
|
const params = {
|
|
3222
3382
|
...(tmsConfig.preview ? tmsConfig.preview : {}),
|
|
3223
3383
|
...cmdOptions
|
|
@@ -3225,10 +3385,10 @@ const handleParams$1 = (tmsConfig, cmdOptions) => {
|
|
|
3225
3385
|
return {
|
|
3226
3386
|
...params,
|
|
3227
3387
|
appId: params.appId || tmsConfig.appId,
|
|
3228
|
-
projectPath: resolve$
|
|
3388
|
+
projectPath: resolve$7(tmsConfig.outputDir),
|
|
3229
3389
|
privateKey: params.privateKey || tmsConfig.privateKey,
|
|
3230
3390
|
robot: params.robot || 30,
|
|
3231
|
-
desc: params.desc || getDesc$
|
|
3391
|
+
desc: params.desc || getDesc$2(params.desc),
|
|
3232
3392
|
qrcodeOutputDest: getAbsolutePath$1(params.qrcodeOutputDest || '')
|
|
3233
3393
|
};
|
|
3234
3394
|
};
|
|
@@ -3241,7 +3401,7 @@ const handleParams$1 = (tmsConfig, cmdOptions) => {
|
|
|
3241
3401
|
async function preview$1(tmsConfig, cmdOptions) {
|
|
3242
3402
|
try {
|
|
3243
3403
|
var _tmsConfig$hooks;
|
|
3244
|
-
const params = handleParams$
|
|
3404
|
+
const params = handleParams$2(tmsConfig, cmdOptions);
|
|
3245
3405
|
if (typeof (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks = tmsConfig.hooks) === null || _tmsConfig$hooks === void 0 ? void 0 : _tmsConfig$hooks.beforePreview) === 'function') {
|
|
3246
3406
|
var _tmsConfig$hooks2;
|
|
3247
3407
|
await (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks2 = tmsConfig.hooks) === null || _tmsConfig$hooks2 === void 0 ? void 0 : _tmsConfig$hooks2.beforePreview({
|
|
@@ -3249,10 +3409,10 @@ async function preview$1(tmsConfig, cmdOptions) {
|
|
|
3249
3409
|
cmdOptions: global$2.getData('cmdOptions'),
|
|
3250
3410
|
params
|
|
3251
3411
|
}));
|
|
3252
|
-
report$
|
|
3412
|
+
report$4('hooks:beforePreview');
|
|
3253
3413
|
}
|
|
3254
3414
|
;
|
|
3255
|
-
const previewRes = await createTask$
|
|
3415
|
+
const previewRes = await createTask$3(mpCi$2.previewMp, '正在构建预览码', '构建预览码完成')({
|
|
3256
3416
|
...params
|
|
3257
3417
|
});
|
|
3258
3418
|
const allSize = getAllSize$1(previewRes);
|
|
@@ -3267,25 +3427,25 @@ async function preview$1(tmsConfig, cmdOptions) {
|
|
|
3267
3427
|
...previewRes
|
|
3268
3428
|
});
|
|
3269
3429
|
}
|
|
3270
|
-
info$
|
|
3430
|
+
info$7('预览包大小:', `${allSize}k`);
|
|
3271
3431
|
} catch (e) {
|
|
3272
3432
|
console.log('详细错误:', e);
|
|
3273
|
-
handleError$
|
|
3433
|
+
handleError$4(`预览错误: ${e.message}`, true);
|
|
3274
3434
|
}
|
|
3275
3435
|
}
|
|
3276
3436
|
var preview_1 = preview$1;
|
|
3277
3437
|
|
|
3278
|
-
const mpCi = mpCi$
|
|
3438
|
+
const mpCi$1 = mpCi$3;
|
|
3279
3439
|
const {
|
|
3280
|
-
resolve: resolve$
|
|
3281
|
-
createTask: createTask$
|
|
3440
|
+
resolve: resolve$6,
|
|
3441
|
+
createTask: createTask$2,
|
|
3282
3442
|
filterField
|
|
3283
3443
|
} = widgets;
|
|
3284
3444
|
const {
|
|
3285
|
-
handleError: handleError$
|
|
3445
|
+
handleError: handleError$3
|
|
3286
3446
|
} = handleError_1;
|
|
3287
3447
|
const {
|
|
3288
|
-
info: info$
|
|
3448
|
+
info: info$6
|
|
3289
3449
|
} = log$1;
|
|
3290
3450
|
const {
|
|
3291
3451
|
global: global$1
|
|
@@ -3293,10 +3453,10 @@ const {
|
|
|
3293
3453
|
const {
|
|
3294
3454
|
getAllSize,
|
|
3295
3455
|
outputInfo,
|
|
3296
|
-
getDesc
|
|
3456
|
+
getDesc: getDesc$1
|
|
3297
3457
|
} = utils;
|
|
3298
|
-
const report$
|
|
3299
|
-
const handleParams = (tmsConfig, cmdOptions) => {
|
|
3458
|
+
const report$3 = report_1;
|
|
3459
|
+
const handleParams$1 = (tmsConfig, cmdOptions) => {
|
|
3300
3460
|
const params = {
|
|
3301
3461
|
...(tmsConfig.upload ? tmsConfig.upload : {}),
|
|
3302
3462
|
...cmdOptions
|
|
@@ -3307,10 +3467,10 @@ const handleParams = (tmsConfig, cmdOptions) => {
|
|
|
3307
3467
|
return {
|
|
3308
3468
|
...params,
|
|
3309
3469
|
appId: params.appId || tmsConfig.appId,
|
|
3310
|
-
projectPath: resolve$
|
|
3470
|
+
projectPath: resolve$6(tmsConfig.outputDir),
|
|
3311
3471
|
privateKey: params.privateKey || tmsConfig.privateKey,
|
|
3312
3472
|
robot: params.robot || 30,
|
|
3313
|
-
desc: params.desc || getDesc(params.desc)
|
|
3473
|
+
desc: params.desc || getDesc$1(params.desc)
|
|
3314
3474
|
};
|
|
3315
3475
|
};
|
|
3316
3476
|
|
|
@@ -3322,7 +3482,7 @@ const handleParams = (tmsConfig, cmdOptions) => {
|
|
|
3322
3482
|
async function upload$1(tmsConfig, cmdOptions) {
|
|
3323
3483
|
try {
|
|
3324
3484
|
var _tmsConfig$hooks;
|
|
3325
|
-
const params = handleParams(tmsConfig, cmdOptions);
|
|
3485
|
+
const params = handleParams$1(tmsConfig, cmdOptions);
|
|
3326
3486
|
if (typeof (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks = tmsConfig.hooks) === null || _tmsConfig$hooks === void 0 ? void 0 : _tmsConfig$hooks.beforeUpload) === 'function') {
|
|
3327
3487
|
var _tmsConfig$hooks2;
|
|
3328
3488
|
await (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks2 = tmsConfig.hooks) === null || _tmsConfig$hooks2 === void 0 ? void 0 : _tmsConfig$hooks2.beforeUpload({
|
|
@@ -3330,10 +3490,10 @@ async function upload$1(tmsConfig, cmdOptions) {
|
|
|
3330
3490
|
cmdOptions: global$1.getData('cmdOptions'),
|
|
3331
3491
|
params
|
|
3332
3492
|
}));
|
|
3333
|
-
report$
|
|
3493
|
+
report$3('hooks:beforeUpload');
|
|
3334
3494
|
}
|
|
3335
3495
|
;
|
|
3336
|
-
const uploadRes = await createTask$
|
|
3496
|
+
const uploadRes = await createTask$2(mpCi$1.uploadMp, '正在上传小程序代码', '上传小程序代码完成')({
|
|
3337
3497
|
...params
|
|
3338
3498
|
});
|
|
3339
3499
|
const allSize = getAllSize(uploadRes);
|
|
@@ -3343,14 +3503,65 @@ async function upload$1(tmsConfig, cmdOptions) {
|
|
|
3343
3503
|
...uploadRes
|
|
3344
3504
|
});
|
|
3345
3505
|
}
|
|
3346
|
-
info$
|
|
3506
|
+
info$6(`上传包大小: ${allSize}k; 上传包版本: ${params.version}`);
|
|
3347
3507
|
} catch (e) {
|
|
3348
3508
|
console.log('详细错误:', e);
|
|
3349
|
-
handleError$
|
|
3509
|
+
handleError$3(`上传错误: ${e.message}`, true);
|
|
3350
3510
|
}
|
|
3351
3511
|
}
|
|
3352
3512
|
var upload_1 = upload$1;
|
|
3353
3513
|
|
|
3514
|
+
const mpCi = mpCi$3;
|
|
3515
|
+
const {
|
|
3516
|
+
resolve: resolve$5,
|
|
3517
|
+
createTask: createTask$1
|
|
3518
|
+
} = widgets;
|
|
3519
|
+
const {
|
|
3520
|
+
handleError: handleError$2
|
|
3521
|
+
} = handleError_1;
|
|
3522
|
+
const {
|
|
3523
|
+
info: info$5
|
|
3524
|
+
} = log$1;
|
|
3525
|
+
const {
|
|
3526
|
+
getDesc
|
|
3527
|
+
} = utils;
|
|
3528
|
+
const report$2 = report_1;
|
|
3529
|
+
const handleParams = (tmsConfig, cmdOptions) => {
|
|
3530
|
+
const params = {
|
|
3531
|
+
...(tmsConfig.upload ? tmsConfig.upload : {}),
|
|
3532
|
+
...cmdOptions
|
|
3533
|
+
};
|
|
3534
|
+
return {
|
|
3535
|
+
sourceMapSavePath: './sourcemap.zip',
|
|
3536
|
+
...params,
|
|
3537
|
+
appId: params.appId || tmsConfig.appId,
|
|
3538
|
+
projectPath: resolve$5(tmsConfig.outputDir),
|
|
3539
|
+
privateKey: params.privateKey || tmsConfig.privateKey,
|
|
3540
|
+
robot: params.robot || 30,
|
|
3541
|
+
desc: params.desc || getDesc(params.desc)
|
|
3542
|
+
};
|
|
3543
|
+
};
|
|
3544
|
+
|
|
3545
|
+
/**
|
|
3546
|
+
* 获取sourcemap
|
|
3547
|
+
* @param {object} tmsConfig
|
|
3548
|
+
* @param {object} cmdOptions {version: '2022.28.5', desc: '', robot: 2, infoOutput: './a.txt' }
|
|
3549
|
+
*/
|
|
3550
|
+
async function sourcemap$1(tmsConfig, cmdOptions) {
|
|
3551
|
+
try {
|
|
3552
|
+
const params = handleParams(tmsConfig, cmdOptions);
|
|
3553
|
+
report$2('sourcemap');
|
|
3554
|
+
await createTask$1(mpCi.getDevSourceMap, '正在获取小程序代码sourcemap', '获取小程序代码sourcemap完成')({
|
|
3555
|
+
...params
|
|
3556
|
+
});
|
|
3557
|
+
info$5(`sourcemap文件已保存到${params.sourceMapSavePath}`);
|
|
3558
|
+
} catch (e) {
|
|
3559
|
+
console.log('详细错误:', e);
|
|
3560
|
+
handleError$2(`获取sourcemap错误: ${e.message}`, true);
|
|
3561
|
+
}
|
|
3562
|
+
}
|
|
3563
|
+
var sourcemap_1 = sourcemap$1;
|
|
3564
|
+
|
|
3354
3565
|
const {
|
|
3355
3566
|
resolve: resolve$4,
|
|
3356
3567
|
getAbsolutePath
|
|
@@ -3536,7 +3747,7 @@ const {
|
|
|
3536
3747
|
dest,
|
|
3537
3748
|
parallel,
|
|
3538
3749
|
series
|
|
3539
|
-
} = require$$0__default$
|
|
3750
|
+
} = require$$0__default$9;
|
|
3540
3751
|
const watch = gulpWatch;
|
|
3541
3752
|
const {
|
|
3542
3753
|
info: info$2,
|
|
@@ -3684,6 +3895,7 @@ const build = build_1;
|
|
|
3684
3895
|
const install = install_1;
|
|
3685
3896
|
const preview = preview_1;
|
|
3686
3897
|
const upload = upload_1;
|
|
3898
|
+
const sourcemap = sourcemap_1;
|
|
3687
3899
|
const cloudLink = link;
|
|
3688
3900
|
const cloudDev = dev$1;
|
|
3689
3901
|
const {
|
|
@@ -3821,6 +4033,12 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
3821
4033
|
appName: tmsConfig.appName
|
|
3822
4034
|
});
|
|
3823
4035
|
return;
|
|
4036
|
+
case 'sourcemap':
|
|
4037
|
+
sourcemap(tmsConfig);
|
|
4038
|
+
report$1('run:sourcemap', {
|
|
4039
|
+
appName: tmsConfig.appName
|
|
4040
|
+
});
|
|
4041
|
+
return;
|
|
3824
4042
|
default:
|
|
3825
4043
|
return;
|
|
3826
4044
|
}
|
|
@@ -3880,6 +4098,13 @@ var entry = [{
|
|
|
3880
4098
|
action: cmdOptions => {
|
|
3881
4099
|
run_1('upload', cmdOptions);
|
|
3882
4100
|
}
|
|
4101
|
+
}, {
|
|
4102
|
+
command: 'sourcemap',
|
|
4103
|
+
description: '获取sourcemap',
|
|
4104
|
+
options: [],
|
|
4105
|
+
action: cmdOptions => {
|
|
4106
|
+
run_1('sourcemap', cmdOptions);
|
|
4107
|
+
}
|
|
3883
4108
|
}, {
|
|
3884
4109
|
command: 'cloud-dev',
|
|
3885
4110
|
description: '云函数开发',
|
|
@@ -3903,7 +4128,7 @@ var entry = [{
|
|
|
3903
4128
|
|
|
3904
4129
|
var require$$12 = {
|
|
3905
4130
|
name: "@tmsfe/tmskit",
|
|
3906
|
-
version: "0.0.
|
|
4131
|
+
version: "0.0.39",
|
|
3907
4132
|
description: "tmskit",
|
|
3908
4133
|
main: "dist/index.cjs",
|
|
3909
4134
|
bin: {
|
|
@@ -3956,6 +4181,8 @@ var require$$12 = {
|
|
|
3956
4181
|
"gulp-watch": "^5.0.1",
|
|
3957
4182
|
htmlparser2: "^7.2.0",
|
|
3958
4183
|
inquirer: "^7.3.3",
|
|
4184
|
+
json5: "^2.2.3",
|
|
4185
|
+
preprocess: "^3.2.0",
|
|
3959
4186
|
leven: "3.1.0",
|
|
3960
4187
|
lodash: "^4.17.21",
|
|
3961
4188
|
metalsmith: "^2.3.0",
|
|
@@ -3988,7 +4215,7 @@ var require$$12 = {
|
|
|
3988
4215
|
}
|
|
3989
4216
|
};
|
|
3990
4217
|
|
|
3991
|
-
const semver = require$$1__default$
|
|
4218
|
+
const semver = require$$1__default$8;
|
|
3992
4219
|
const packageJson = require$$12;
|
|
3993
4220
|
const chalk$1 = require$$3__default;
|
|
3994
4221
|
const {
|
|
@@ -4024,7 +4251,7 @@ var check_1 = check$1;
|
|
|
4024
4251
|
|
|
4025
4252
|
/* eslint-disable no-param-reassign */
|
|
4026
4253
|
const chalk = require$$3__default;
|
|
4027
|
-
const commander = require$$1__default$
|
|
4254
|
+
const commander = require$$1__default$9;
|
|
4028
4255
|
const path = require$$1__default$1;
|
|
4029
4256
|
const fs = require$$0__default$1;
|
|
4030
4257
|
const {
|