@tmsfe/tmskit 0.0.24-beta.0 → 0.0.26
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 +345 -486
- package/package.json +5 -5
- package/src/entry.js +1 -1
- package/src/scripts/run/dev/index.js +2 -2
- package/src/scripts/run/index.js +6 -6
- package/src/scripts/run/preview/index.js +2 -2
- package/src/scripts/run/preview/utils.js +3 -3
- package/src/scripts/run/upload/index.js +5 -5
- package/src/core/cache.js +0 -36
package/dist/index.cjs.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var require$$
|
|
3
|
+
var require$$0 = require('chalk');
|
|
4
4
|
var require$$1 = require('moment');
|
|
5
|
-
var require$$0 = require('ora');
|
|
5
|
+
var require$$0$1 = require('ora');
|
|
6
6
|
var require$$1$1 = require('path');
|
|
7
|
-
var require$$0$
|
|
8
|
-
var require$$
|
|
7
|
+
var require$$0$2 = require('fs');
|
|
8
|
+
var require$$0$3 = require('shelljs');
|
|
9
9
|
var require$$4 = require('glob-ignore');
|
|
10
10
|
var require$$1$2 = require('os');
|
|
11
|
-
var require$$0$
|
|
12
|
-
var require$$0$
|
|
11
|
+
var require$$0$4 = require('lodash');
|
|
12
|
+
var require$$0$5 = require('async');
|
|
13
13
|
var require$$1$3 = require('ejs');
|
|
14
14
|
var require$$1$4 = require('inquirer');
|
|
15
|
-
var require$$0$
|
|
16
|
-
var require$$0$
|
|
15
|
+
var require$$0$6 = require('metalsmith');
|
|
16
|
+
var require$$0$7 = require('request');
|
|
17
17
|
var require$$10 = require('unzipper');
|
|
18
18
|
var require$$1$5 = require('crypto');
|
|
19
|
-
var require$$0$
|
|
19
|
+
var require$$0$8 = require('miniprogram-ci');
|
|
20
20
|
var require$$1$6 = require('fs-extra');
|
|
21
21
|
var require$$1$7 = require('semver');
|
|
22
|
-
var require$$0$
|
|
23
|
-
var require$$2
|
|
24
|
-
var require$$3
|
|
22
|
+
var require$$0$9 = require('gulp');
|
|
23
|
+
var require$$2 = require('minimatch');
|
|
24
|
+
var require$$3 = require('gulp-if');
|
|
25
25
|
var require$$6 = require('through2');
|
|
26
|
-
var require$$0$
|
|
27
|
-
var require$$3$
|
|
26
|
+
var require$$0$a = require('object-assign');
|
|
27
|
+
var require$$3$1 = require('fancy-log');
|
|
28
28
|
var require$$4$1 = require('ansi-colors');
|
|
29
29
|
var require$$5 = require('chokidar');
|
|
30
30
|
var require$$6$1 = require('readable-stream');
|
|
@@ -32,38 +32,38 @@ var require$$7 = require('vinyl-file');
|
|
|
32
32
|
var require$$8 = require('vinyl');
|
|
33
33
|
var require$$9 = require('anymatch');
|
|
34
34
|
var require$$11 = require('glob-parent');
|
|
35
|
-
var require$$2$
|
|
35
|
+
var require$$2$1 = require('plugin-error');
|
|
36
36
|
var require$$10$1 = require('path-is-absolute');
|
|
37
37
|
var require$$12$1 = require('slash');
|
|
38
38
|
var require$$1$8 = require('commander');
|
|
39
39
|
|
|
40
40
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
41
41
|
|
|
42
|
-
var require$$3__default = /*#__PURE__*/_interopDefaultLegacy(require$$3);
|
|
43
|
-
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
44
42
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
45
|
-
var require$$1__default
|
|
43
|
+
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
46
44
|
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
|
47
|
-
var require$$
|
|
48
|
-
var require$$4__default = /*#__PURE__*/_interopDefaultLegacy(require$$4);
|
|
49
|
-
var require$$1__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$1$2);
|
|
45
|
+
var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
|
50
46
|
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
|
|
51
47
|
var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
|
|
52
|
-
var require$$
|
|
53
|
-
var require$$1__default$
|
|
48
|
+
var require$$4__default = /*#__PURE__*/_interopDefaultLegacy(require$$4);
|
|
49
|
+
var require$$1__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$1$2);
|
|
54
50
|
var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$4);
|
|
55
51
|
var require$$0__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$0$5);
|
|
52
|
+
var require$$1__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$1$3);
|
|
53
|
+
var require$$1__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$1$4);
|
|
54
|
+
var require$$0__default$6 = /*#__PURE__*/_interopDefaultLegacy(require$$0$6);
|
|
55
|
+
var require$$0__default$7 = /*#__PURE__*/_interopDefaultLegacy(require$$0$7);
|
|
56
56
|
var require$$10__default = /*#__PURE__*/_interopDefaultLegacy(require$$10);
|
|
57
57
|
var require$$1__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$1$5);
|
|
58
|
-
var require$$0__default$
|
|
58
|
+
var require$$0__default$8 = /*#__PURE__*/_interopDefaultLegacy(require$$0$8);
|
|
59
59
|
var require$$1__default$6 = /*#__PURE__*/_interopDefaultLegacy(require$$1$6);
|
|
60
60
|
var require$$1__default$7 = /*#__PURE__*/_interopDefaultLegacy(require$$1$7);
|
|
61
|
-
var require$$0__default$
|
|
62
|
-
var require$$2__default
|
|
63
|
-
var require$$3__default
|
|
61
|
+
var require$$0__default$9 = /*#__PURE__*/_interopDefaultLegacy(require$$0$9);
|
|
62
|
+
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
63
|
+
var require$$3__default = /*#__PURE__*/_interopDefaultLegacy(require$$3);
|
|
64
64
|
var require$$6__default = /*#__PURE__*/_interopDefaultLegacy(require$$6);
|
|
65
|
-
var require$$0__default$
|
|
66
|
-
var require$$3__default$
|
|
65
|
+
var require$$0__default$a = /*#__PURE__*/_interopDefaultLegacy(require$$0$a);
|
|
66
|
+
var require$$3__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$3$1);
|
|
67
67
|
var require$$4__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$4$1);
|
|
68
68
|
var require$$5__default = /*#__PURE__*/_interopDefaultLegacy(require$$5);
|
|
69
69
|
var require$$6__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$6$1);
|
|
@@ -71,14 +71,14 @@ var require$$7__default = /*#__PURE__*/_interopDefaultLegacy(require$$7);
|
|
|
71
71
|
var require$$8__default = /*#__PURE__*/_interopDefaultLegacy(require$$8);
|
|
72
72
|
var require$$9__default = /*#__PURE__*/_interopDefaultLegacy(require$$9);
|
|
73
73
|
var require$$11__default = /*#__PURE__*/_interopDefaultLegacy(require$$11);
|
|
74
|
-
var require$$2__default$
|
|
74
|
+
var require$$2__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$2$1);
|
|
75
75
|
var require$$10__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$10$1);
|
|
76
76
|
var require$$12__default = /*#__PURE__*/_interopDefaultLegacy(require$$12$1);
|
|
77
77
|
var require$$1__default$8 = /*#__PURE__*/_interopDefaultLegacy(require$$1$8);
|
|
78
78
|
|
|
79
79
|
var src$2 = {};
|
|
80
80
|
|
|
81
|
-
const chalk$
|
|
81
|
+
const chalk$3 = require$$0__default;
|
|
82
82
|
const moment$1 = require$$1__default;
|
|
83
83
|
/**
|
|
84
84
|
* 本文件提供无依赖的在终端打印彩色文字的方法。
|
|
@@ -121,25 +121,25 @@ const succeed$2 = (message = '') => {
|
|
|
121
121
|
|
|
122
122
|
|
|
123
123
|
const warn$2 = message => {
|
|
124
|
-
console.log(`${moment$1().format('YYYY-MM-DD HH:mm:ss')}`, chalk$
|
|
124
|
+
console.log(`${moment$1().format('YYYY-MM-DD HH:mm:ss')}`, chalk$3.yellow(message));
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
const info$g = (...args) => console.log(`${moment$1().format('YYYY-MM-DD HH:mm:ss')}`, ...args);
|
|
128
128
|
|
|
129
|
-
const infoNoTime$
|
|
129
|
+
const infoNoTime$1 = (...args) => console.log(...args);
|
|
130
130
|
|
|
131
131
|
var log$1 = {
|
|
132
132
|
fail: fail$9,
|
|
133
133
|
succeed: succeed$2,
|
|
134
134
|
warn: warn$2,
|
|
135
135
|
info: info$g,
|
|
136
|
-
infoNoTime: infoNoTime$
|
|
136
|
+
infoNoTime: infoNoTime$1
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
const ora$1 = require$$0__default;
|
|
140
|
-
const path$
|
|
141
|
-
const fs$
|
|
142
|
-
const shelljs$
|
|
139
|
+
const ora$1 = require$$0__default$1;
|
|
140
|
+
const path$f = require$$1__default$1;
|
|
141
|
+
const fs$h = require$$0__default$2;
|
|
142
|
+
const shelljs$7 = require$$0__default$3;
|
|
143
143
|
const glob = require$$4__default;
|
|
144
144
|
const {
|
|
145
145
|
info: info$f
|
|
@@ -152,7 +152,7 @@ const shelljsOptions = {
|
|
|
152
152
|
const cwd = process.cwd();
|
|
153
153
|
|
|
154
154
|
function resolve$g(...args) {
|
|
155
|
-
return path$
|
|
155
|
+
return path$f.resolve(cwd, ...args);
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* 判断变量是否是一个数组
|
|
@@ -186,20 +186,20 @@ function downloadRepoForGit$1(url, dest, branch) {
|
|
|
186
186
|
const cwd = process.cwd();
|
|
187
187
|
return new Promise((resolve, reject) => {
|
|
188
188
|
// 如果目标目录不存在
|
|
189
|
-
if (fs$
|
|
190
|
-
shelljs$
|
|
189
|
+
if (fs$h.existsSync(dest)) {
|
|
190
|
+
shelljs$7.rm('-rf', path$f.join(dest));
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
shelljs$
|
|
194
|
-
shelljs$
|
|
195
|
-
shelljs$
|
|
193
|
+
shelljs$7.mkdir('-p', dest);
|
|
194
|
+
shelljs$7.cd(dest);
|
|
195
|
+
shelljs$7.exec(`git clone ${url} ${dest} --branch ${branch} --depth 1`, {
|
|
196
196
|
silent: true
|
|
197
197
|
}, (code, stdout, stderr) => {
|
|
198
198
|
if (code !== 0) {
|
|
199
199
|
reject(stderr);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
shelljs$
|
|
202
|
+
shelljs$7.cd(cwd);
|
|
203
203
|
resolve();
|
|
204
204
|
});
|
|
205
205
|
});
|
|
@@ -215,16 +215,16 @@ function downloadRepoForGit$1(url, dest, branch) {
|
|
|
215
215
|
function pullRepoForGit$1(dest, branch) {
|
|
216
216
|
const cwd = process.cwd();
|
|
217
217
|
return new Promise((resolve, reject) => {
|
|
218
|
-
shelljs$
|
|
219
|
-
shelljs$
|
|
220
|
-
shelljs$
|
|
218
|
+
shelljs$7.cd(dest);
|
|
219
|
+
shelljs$7.exec('git config pull.rebase false', shelljsOptions);
|
|
220
|
+
shelljs$7.exec(`git pull origin ${branch}`, {
|
|
221
221
|
silent: true
|
|
222
222
|
}, (code, stdout, stderr) => {
|
|
223
223
|
if (code !== 0) {
|
|
224
224
|
reject(stderr);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
shelljs$
|
|
227
|
+
shelljs$7.cd(cwd);
|
|
228
228
|
resolve();
|
|
229
229
|
});
|
|
230
230
|
});
|
|
@@ -240,7 +240,7 @@ function pullRepoForGit$1(dest, branch) {
|
|
|
240
240
|
function npmInstall$2(dir, npmConfig) {
|
|
241
241
|
return new Promise((resolve, reject) => {
|
|
242
242
|
const registry = getNpmRegistry(npmConfig);
|
|
243
|
-
shelljs$
|
|
243
|
+
shelljs$7.exec(`npm install --production ${registry}`, {
|
|
244
244
|
cwd: dir,
|
|
245
245
|
silent: true
|
|
246
246
|
}, (code, stdout, stderr) => {
|
|
@@ -322,7 +322,7 @@ const mergeMap$1 = function (obj, src) {
|
|
|
322
322
|
};
|
|
323
323
|
|
|
324
324
|
const relativeCwdPath$1 = function (file) {
|
|
325
|
-
return path$
|
|
325
|
+
return path$f.relative(process.cwd(), file);
|
|
326
326
|
};
|
|
327
327
|
/**
|
|
328
328
|
* 从一个对象中,检索出去几个字段
|
|
@@ -365,7 +365,7 @@ function getAbsolutePath$5(pathDir, cwd = '') {
|
|
|
365
365
|
} // 版本比较 => 1(大于), 0(等于), -1(小于)
|
|
366
366
|
|
|
367
367
|
|
|
368
|
-
function versionCompare
|
|
368
|
+
function versionCompare(v1, v2) {
|
|
369
369
|
// 将两个版本号拆成数组
|
|
370
370
|
const arr1 = v1.split('.');
|
|
371
371
|
const arr2 = v2.split('.');
|
|
@@ -386,7 +386,7 @@ function versionCompare$1(v1, v2) {
|
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
function getGitUser$2() {
|
|
389
|
-
const res = shelljs$
|
|
389
|
+
const res = shelljs$7.exec('git config user.name', {
|
|
390
390
|
async: false,
|
|
391
391
|
silent: true
|
|
392
392
|
});
|
|
@@ -408,32 +408,32 @@ var widgets = {
|
|
|
408
408
|
findFiles,
|
|
409
409
|
getAbsolutePath: getAbsolutePath$5,
|
|
410
410
|
getNpmRegistry,
|
|
411
|
-
versionCompare
|
|
411
|
+
versionCompare,
|
|
412
412
|
getGitUser: getGitUser$2
|
|
413
413
|
};
|
|
414
414
|
|
|
415
415
|
var tmsMpconfig = {exports: {}};
|
|
416
416
|
|
|
417
|
-
const path$
|
|
417
|
+
const path$e = require$$1__default$1;
|
|
418
418
|
const os = require$$1__default$2; // 用户目录
|
|
419
419
|
|
|
420
420
|
const HOME_DIR = os.homedir(); // 所有文件的缓存目录
|
|
421
421
|
|
|
422
|
-
const CACHE_DIR = path$
|
|
422
|
+
const CACHE_DIR = path$e.resolve(HOME_DIR, '.tmskit'); // 版本管理的CDN地址
|
|
423
423
|
|
|
424
|
-
const VERSION_URL
|
|
424
|
+
const VERSION_URL = 'https://tms-web-1g1czzwka2fd06f2-1301126013.tcloudbaseapp.com/tmskit-template/version.json'; // version缓存文件
|
|
425
425
|
|
|
426
|
-
const VERSION_CACHE_FILE
|
|
426
|
+
const VERSION_CACHE_FILE = path$e.resolve(CACHE_DIR, 'version_cache_file.json'); // npm缓存文件
|
|
427
427
|
|
|
428
|
-
const NPM_CACHE_FILE$1 = path$
|
|
428
|
+
const NPM_CACHE_FILE$1 = path$e.resolve(CACHE_DIR, 'npm_cache_file.json'); // 脚手架模板代码所在目录
|
|
429
429
|
|
|
430
|
-
const TEMPLATE_DIR$1 = path$
|
|
430
|
+
const TEMPLATE_DIR$1 = path$e.resolve(CACHE_DIR, 'template'); // 第三方模块源码存放的临时缓存目录
|
|
431
431
|
|
|
432
|
-
const MODULE_CODE_DIR$2 = path$
|
|
432
|
+
const MODULE_CODE_DIR$2 = path$e.resolve(CACHE_DIR, 'modules_code'); // 缓存分包node_modules的目录
|
|
433
433
|
|
|
434
|
-
const NODE_MODULES_DIR$2 = path$
|
|
434
|
+
const NODE_MODULES_DIR$2 = path$e.resolve(CACHE_DIR, 'node_modules'); // 扩展命令源码的存放处
|
|
435
435
|
|
|
436
|
-
const EXTEND_CMD$1 = path$
|
|
436
|
+
const EXTEND_CMD$1 = path$e.resolve(CACHE_DIR, 'cmd'); // 创建模板的名称
|
|
437
437
|
|
|
438
438
|
const TEMPLATE_NAME$1 = 'tmskit-template'; // 脚手架模板的远程地址
|
|
439
439
|
|
|
@@ -451,7 +451,7 @@ const DEFAULT_CLOUD_MODULE_DIR = './cloud'; // 模块的配置文件的名称
|
|
|
451
451
|
const MODULE_CONFIG_FILENAME = 'module.config.json'; // 默认的webpack entry
|
|
452
452
|
|
|
453
453
|
const DEFAULT_WEBPACK_ENTRY = {
|
|
454
|
-
app: path$
|
|
454
|
+
app: path$e.resolve(process.cwd(), 'app')
|
|
455
455
|
}; // 默认从源码拷贝到编译后的配置
|
|
456
456
|
|
|
457
457
|
const DEFAULT_COPY_CONFIG$2 = ['package.json', 'sitemap.json', 'project.config.json'];
|
|
@@ -482,7 +482,7 @@ var constant = {
|
|
|
482
482
|
HOME_DIR,
|
|
483
483
|
CACHE_DIR,
|
|
484
484
|
NPM_CACHE_FILE: NPM_CACHE_FILE$1,
|
|
485
|
-
VERSION_CACHE_FILE
|
|
485
|
+
VERSION_CACHE_FILE,
|
|
486
486
|
TEMPLATE_DIR: TEMPLATE_DIR$1,
|
|
487
487
|
TEMPLATE_NAME: TEMPLATE_NAME$1,
|
|
488
488
|
TMS_NAME: TMS_NAME$1,
|
|
@@ -500,7 +500,7 @@ var constant = {
|
|
|
500
500
|
DEFAULT_CLOUD_MODULE_DIR,
|
|
501
501
|
CREATE_TEMPLATE_QUESTION: CREATE_TEMPLATE_QUESTION$1,
|
|
502
502
|
TEMPLATE_URL: TEMPLATE_URL$1,
|
|
503
|
-
VERSION_URL
|
|
503
|
+
VERSION_URL
|
|
504
504
|
};
|
|
505
505
|
|
|
506
506
|
var defaultTmsConfig = {
|
|
@@ -554,8 +554,8 @@ var defaultTmsConfig = {
|
|
|
554
554
|
|
|
555
555
|
(function (module) {
|
|
556
556
|
/* eslint-disable no-param-reassign, no-nested-ternary */
|
|
557
|
-
const loadash = require$$0__default$
|
|
558
|
-
const fs = require$$0__default$
|
|
557
|
+
const loadash = require$$0__default$4;
|
|
558
|
+
const fs = require$$0__default$2;
|
|
559
559
|
const path = require$$1__default$1;
|
|
560
560
|
const {
|
|
561
561
|
TMS_CONFIG_FILENAME,
|
|
@@ -867,8 +867,8 @@ var defaultTmsConfig = {
|
|
|
867
867
|
};
|
|
868
868
|
})(tmsMpconfig);
|
|
869
869
|
|
|
870
|
-
const fs$
|
|
871
|
-
const path$
|
|
870
|
+
const fs$g = require$$0__default$2;
|
|
871
|
+
const path$d = require$$1__default$1;
|
|
872
872
|
const {
|
|
873
873
|
info: info$e
|
|
874
874
|
} = log$1;
|
|
@@ -881,12 +881,12 @@ const {
|
|
|
881
881
|
* @returns
|
|
882
882
|
*/
|
|
883
883
|
|
|
884
|
-
const isDirEmpty = dirname => fs$
|
|
884
|
+
const isDirEmpty = dirname => fs$g.promises.readdir(dirname).then(files => files.length === 0); // 判断是否是文件
|
|
885
885
|
|
|
886
886
|
|
|
887
887
|
const isFile = pathName => {
|
|
888
888
|
try {
|
|
889
|
-
const stat = fs$
|
|
889
|
+
const stat = fs$g.lstatSync(pathName);
|
|
890
890
|
return stat.isFile();
|
|
891
891
|
} catch {
|
|
892
892
|
return false;
|
|
@@ -898,9 +898,9 @@ const isFile = pathName => {
|
|
|
898
898
|
*/
|
|
899
899
|
|
|
900
900
|
|
|
901
|
-
const ensureDirExist$
|
|
902
|
-
if (!fs$
|
|
903
|
-
fs$
|
|
901
|
+
const ensureDirExist$4 = dirname => {
|
|
902
|
+
if (!fs$g.existsSync(dirname)) {
|
|
903
|
+
fs$g.mkdirSync(dirname, {
|
|
904
904
|
recursive: true
|
|
905
905
|
});
|
|
906
906
|
}
|
|
@@ -908,20 +908,20 @@ const ensureDirExist$5 = dirname => {
|
|
|
908
908
|
|
|
909
909
|
|
|
910
910
|
const copyFile = function (src, dest) {
|
|
911
|
-
if (fs$
|
|
912
|
-
fs$
|
|
911
|
+
if (fs$g.existsSync(dest)) {
|
|
912
|
+
fs$g.unlinkSync(dest);
|
|
913
913
|
}
|
|
914
914
|
|
|
915
|
-
const dir = path$
|
|
916
|
-
ensureDirExist$
|
|
917
|
-
fs$
|
|
915
|
+
const dir = path$d.dirname(dest);
|
|
916
|
+
ensureDirExist$4(dir);
|
|
917
|
+
fs$g.copyFileSync(src, dest);
|
|
918
918
|
}; // 判断文件内容是否一致,不一致再进行拷贝
|
|
919
919
|
|
|
920
920
|
|
|
921
921
|
function diffContentCopyFile(originFile, destFile) {
|
|
922
|
-
if (fs$
|
|
923
|
-
const depDestContent = fs$
|
|
924
|
-
const depOriginContent = fs$
|
|
922
|
+
if (fs$g.existsSync(destFile)) {
|
|
923
|
+
const depDestContent = fs$g.readFileSync(destFile, 'utf8');
|
|
924
|
+
const depOriginContent = fs$g.readFileSync(originFile, 'utf8');
|
|
925
925
|
|
|
926
926
|
if (depDestContent !== depOriginContent) {
|
|
927
927
|
info$e(`拷贝${relativeCwdPath(originFile)}内容到${relativeCwdPath(destFile)}`);
|
|
@@ -939,7 +939,7 @@ function ext(filePath, extensions) {
|
|
|
939
939
|
let extPath = ''; // try catch需要包裹:用来处理'./lib/timer'没有后缀的情况
|
|
940
940
|
|
|
941
941
|
try {
|
|
942
|
-
const stat = fs$
|
|
942
|
+
const stat = fs$g.lstatSync(newFilePath);
|
|
943
943
|
|
|
944
944
|
if (stat.isDirectory()) {
|
|
945
945
|
extPath = newFilePath[newFilePath.length - 1] === '/' ? 'index' : '/index';
|
|
@@ -950,7 +950,7 @@ function ext(filePath, extensions) {
|
|
|
950
950
|
for (const ext of extensions) {
|
|
951
951
|
const file = newFilePath.endsWith(ext) ? newFilePath : newFilePath + ext;
|
|
952
952
|
|
|
953
|
-
if (fs$
|
|
953
|
+
if (fs$g.existsSync(file)) {
|
|
954
954
|
return {
|
|
955
955
|
ext,
|
|
956
956
|
extPath: extPath + ext,
|
|
@@ -968,11 +968,11 @@ function ext(filePath, extensions) {
|
|
|
968
968
|
|
|
969
969
|
|
|
970
970
|
const fileInDir = (dir, file) => {
|
|
971
|
-
if (!fs$
|
|
971
|
+
if (!fs$g.existsSync(dir) || !fs$g.existsSync(file)) {
|
|
972
972
|
return false;
|
|
973
973
|
}
|
|
974
974
|
|
|
975
|
-
const relativePath = path$
|
|
975
|
+
const relativePath = path$d.relative(dir, file);
|
|
976
976
|
|
|
977
977
|
if (relativePath.startsWith('..')) {
|
|
978
978
|
return false;
|
|
@@ -985,10 +985,10 @@ function findAllFilesOfDir(dir) {
|
|
|
985
985
|
const list = [];
|
|
986
986
|
|
|
987
987
|
function listFile(dir) {
|
|
988
|
-
const arr = fs$
|
|
988
|
+
const arr = fs$g.readdirSync(dir);
|
|
989
989
|
arr.forEach(item => {
|
|
990
|
-
const fullPath = path$
|
|
991
|
-
const stats = fs$
|
|
990
|
+
const fullPath = path$d.join(dir, item);
|
|
991
|
+
const stats = fs$g.statSync(fullPath);
|
|
992
992
|
|
|
993
993
|
if (stats.isDirectory()) {
|
|
994
994
|
listFile(fullPath);
|
|
@@ -1007,14 +1007,14 @@ var io$3 = {
|
|
|
1007
1007
|
isDirEmpty,
|
|
1008
1008
|
copyFile,
|
|
1009
1009
|
diffContentCopyFile,
|
|
1010
|
-
ensureDirExist: ensureDirExist$
|
|
1010
|
+
ensureDirExist: ensureDirExist$4,
|
|
1011
1011
|
ext,
|
|
1012
1012
|
fileInDir,
|
|
1013
1013
|
isFile,
|
|
1014
1014
|
findAllFilesOfDir
|
|
1015
1015
|
};
|
|
1016
1016
|
|
|
1017
|
-
const async = require$$0__default$
|
|
1017
|
+
const async = require$$0__default$5;
|
|
1018
1018
|
const ejs = require$$1__default$3;
|
|
1019
1019
|
|
|
1020
1020
|
const render$1 = (files, metalsmith, next) => {
|
|
@@ -1034,8 +1034,8 @@ const render$1 = (files, metalsmith, next) => {
|
|
|
1034
1034
|
|
|
1035
1035
|
var render_1 = render$1;
|
|
1036
1036
|
|
|
1037
|
-
const fs$
|
|
1038
|
-
const inquirer$
|
|
1037
|
+
const fs$f = require$$0__default$2;
|
|
1038
|
+
const inquirer$1 = require$$1__default$4;
|
|
1039
1039
|
const {
|
|
1040
1040
|
resolve: resolve$f
|
|
1041
1041
|
} = widgets;
|
|
@@ -1051,12 +1051,12 @@ const {
|
|
|
1051
1051
|
const parseTemplateQuestions = dir => {
|
|
1052
1052
|
let prompts = [];
|
|
1053
1053
|
|
|
1054
|
-
if (!fs$
|
|
1054
|
+
if (!fs$f.existsSync(`${dir}/questions.json`)) {
|
|
1055
1055
|
return prompts;
|
|
1056
1056
|
}
|
|
1057
1057
|
|
|
1058
1058
|
try {
|
|
1059
|
-
const json = JSON.parse(fs$
|
|
1059
|
+
const json = JSON.parse(fs$f.readFileSync(`${dir}/questions.json`));
|
|
1060
1060
|
|
|
1061
1061
|
if (Array.isArray(json) && json.length > 0) {
|
|
1062
1062
|
json.forEach((item, index) => {
|
|
@@ -1098,7 +1098,7 @@ const ask$1 = templateDir => (files, metalsmith, next) => {
|
|
|
1098
1098
|
|
|
1099
1099
|
return true;
|
|
1100
1100
|
});
|
|
1101
|
-
inquirer$
|
|
1101
|
+
inquirer$1.prompt(filteredPrompts).then(res => {
|
|
1102
1102
|
for (const prompt of filteredPrompts) {
|
|
1103
1103
|
metadata[prompt.name] = res[prompt.name];
|
|
1104
1104
|
}
|
|
@@ -1114,7 +1114,7 @@ var ask_1 = ask$1;
|
|
|
1114
1114
|
const FILES_TO_IGNORE$1 = ['node_modules'];
|
|
1115
1115
|
var ignoreFiles = FILES_TO_IGNORE$1;
|
|
1116
1116
|
|
|
1117
|
-
const Metalsmith = require$$0__default$
|
|
1117
|
+
const Metalsmith = require$$0__default$6;
|
|
1118
1118
|
const render = render_1;
|
|
1119
1119
|
const ask = ask_1;
|
|
1120
1120
|
const FILES_TO_IGNORE = ignoreFiles;
|
|
@@ -1131,7 +1131,7 @@ const generator$1 = (buildDir, distDir, preMetadata = {}) => new Promise((resolv
|
|
|
1131
1131
|
|
|
1132
1132
|
var generator_1 = generator$1;
|
|
1133
1133
|
|
|
1134
|
-
const request$
|
|
1134
|
+
const request$1 = require$$0__default$7;
|
|
1135
1135
|
const {
|
|
1136
1136
|
getGitUser: getGitUser$1
|
|
1137
1137
|
} = widgets;
|
|
@@ -1150,7 +1150,7 @@ const report$a = (name, attrs = {}) => {
|
|
|
1150
1150
|
}
|
|
1151
1151
|
|
|
1152
1152
|
;
|
|
1153
|
-
request$
|
|
1153
|
+
request$1.post({
|
|
1154
1154
|
url: apiUrl,
|
|
1155
1155
|
json: {
|
|
1156
1156
|
param
|
|
@@ -1163,10 +1163,10 @@ const report$a = (name, attrs = {}) => {
|
|
|
1163
1163
|
|
|
1164
1164
|
var report_1 = report$a;
|
|
1165
1165
|
|
|
1166
|
-
const path$
|
|
1167
|
-
const fs$
|
|
1168
|
-
const shelljs$
|
|
1169
|
-
const inquirer
|
|
1166
|
+
const path$c = require$$1__default$1;
|
|
1167
|
+
const fs$e = require$$0__default$2;
|
|
1168
|
+
const shelljs$6 = require$$0__default$3;
|
|
1169
|
+
const inquirer = require$$1__default$4;
|
|
1170
1170
|
const {
|
|
1171
1171
|
TEMPLATE_DIR,
|
|
1172
1172
|
TEMPLATE_URL,
|
|
@@ -1184,7 +1184,7 @@ const {
|
|
|
1184
1184
|
info: info$d
|
|
1185
1185
|
} = log$1;
|
|
1186
1186
|
const generator = generator_1;
|
|
1187
|
-
const request
|
|
1187
|
+
const request = require$$0__default$7;
|
|
1188
1188
|
const unzip = require$$10__default;
|
|
1189
1189
|
const report$9 = report_1;
|
|
1190
1190
|
/**
|
|
@@ -1195,13 +1195,13 @@ const report$9 = report_1;
|
|
|
1195
1195
|
|
|
1196
1196
|
async function createProjectDir(targetDir) {
|
|
1197
1197
|
// 如果目录非空或者已经存在,提示用户,做选择
|
|
1198
|
-
if (fs$
|
|
1198
|
+
if (fs$e.existsSync(targetDir)) {
|
|
1199
1199
|
if (!(await io$2.isDirEmpty(targetDir))) {
|
|
1200
1200
|
fail$8('该目录名已经存在,换个项目名字吧~');
|
|
1201
1201
|
process.exit(1);
|
|
1202
1202
|
}
|
|
1203
1203
|
} else {
|
|
1204
|
-
shelljs$
|
|
1204
|
+
shelljs$6.mkdir('-p', targetDir);
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
1207
1207
|
/**
|
|
@@ -1216,14 +1216,14 @@ async function createProjectDir(targetDir) {
|
|
|
1216
1216
|
function downloadAndUnZipTemplate(templateDir, templateUrl, templateName) {
|
|
1217
1217
|
return new Promise((resolve, reject) => {
|
|
1218
1218
|
const localZipPath = `${templateDir}/${templateName}.zip`;
|
|
1219
|
-
const stream = fs$
|
|
1220
|
-
request
|
|
1219
|
+
const stream = fs$e.createWriteStream(localZipPath);
|
|
1220
|
+
request(`${templateUrl}?v=${new Date().getTime()}`).pipe(stream).on('close', err => {
|
|
1221
1221
|
if (err) {
|
|
1222
1222
|
reject(err);
|
|
1223
1223
|
return;
|
|
1224
1224
|
}
|
|
1225
1225
|
|
|
1226
|
-
fs$
|
|
1226
|
+
fs$e.createReadStream(localZipPath).pipe(unzip.Extract({
|
|
1227
1227
|
path: templateDir
|
|
1228
1228
|
})).on('close', err => {
|
|
1229
1229
|
if (err) {
|
|
@@ -1245,46 +1245,46 @@ function downloadAndUnZipTemplate(templateDir, templateUrl, templateName) {
|
|
|
1245
1245
|
|
|
1246
1246
|
async function create(projectName) {
|
|
1247
1247
|
const cwd = process.cwd();
|
|
1248
|
-
const targetDir = path$
|
|
1248
|
+
const targetDir = path$c.resolve(cwd, projectName);
|
|
1249
1249
|
const {
|
|
1250
1250
|
projectType
|
|
1251
|
-
} = await inquirer
|
|
1251
|
+
} = await inquirer.prompt(CREATE_TEMPLATE_QUESTION);
|
|
1252
1252
|
report$9('create-start', {
|
|
1253
1253
|
projectType
|
|
1254
1254
|
}); // 创建项目目录
|
|
1255
1255
|
|
|
1256
1256
|
await createProjectDir(targetDir); // 新创建缓存目录
|
|
1257
1257
|
|
|
1258
|
-
if (fs$
|
|
1259
|
-
shelljs$
|
|
1258
|
+
if (fs$e.existsSync(TEMPLATE_DIR)) {
|
|
1259
|
+
shelljs$6.rm('-rf', TEMPLATE_DIR);
|
|
1260
1260
|
}
|
|
1261
1261
|
|
|
1262
|
-
fs$
|
|
1262
|
+
fs$e.mkdirSync(TEMPLATE_DIR, {
|
|
1263
1263
|
recursive: true
|
|
1264
1264
|
}); // 下载和解压模板
|
|
1265
1265
|
|
|
1266
1266
|
await downloadAndUnZipTemplate(TEMPLATE_DIR, TEMPLATE_URL, TEMPLATE_NAME); // 生成模板(1. 询问问题, 2. ejs生成模板 3.生成到目标目录)
|
|
1267
1267
|
|
|
1268
|
-
generator(path$
|
|
1269
|
-
shelljs$
|
|
1268
|
+
generator(path$c.join(TEMPLATE_DIR, TEMPLATE_NAME, projectType), targetDir).then(() => {
|
|
1269
|
+
shelljs$6.cd(projectName);
|
|
1270
1270
|
const hookFilePath = resolve$e(projectName, TEMPLATE_TKIT_DIR, 'hooks.js');
|
|
1271
1271
|
|
|
1272
|
-
if (fs$
|
|
1272
|
+
if (fs$e.existsSync(hookFilePath)) {
|
|
1273
1273
|
const hooks = require(hookFilePath);
|
|
1274
1274
|
|
|
1275
1275
|
if (hooks.afterCreate) {
|
|
1276
1276
|
hooks.afterCreate.forEach(item => {
|
|
1277
1277
|
if (typeof item === 'function') {
|
|
1278
|
-
item.call(null, shelljs$
|
|
1278
|
+
item.call(null, shelljs$6, {
|
|
1279
1279
|
projectName
|
|
1280
1280
|
});
|
|
1281
1281
|
} else {
|
|
1282
|
-
shelljs$
|
|
1282
|
+
shelljs$6.exec(item);
|
|
1283
1283
|
}
|
|
1284
1284
|
});
|
|
1285
1285
|
}
|
|
1286
1286
|
|
|
1287
|
-
shelljs$
|
|
1287
|
+
shelljs$6.rm('-rf', resolve$e(projectName, TEMPLATE_TKIT_DIR));
|
|
1288
1288
|
}
|
|
1289
1289
|
|
|
1290
1290
|
report$9('create-success', {
|
|
@@ -1299,11 +1299,11 @@ async function create(projectName) {
|
|
|
1299
1299
|
|
|
1300
1300
|
var create_1 = create;
|
|
1301
1301
|
|
|
1302
|
-
const fs$
|
|
1303
|
-
const path$
|
|
1304
|
-
const shellJs$1 = require$$
|
|
1302
|
+
const fs$d = require$$0__default$2;
|
|
1303
|
+
const path$b = require$$1__default$1;
|
|
1304
|
+
const shellJs$1 = require$$0__default$3;
|
|
1305
1305
|
const {
|
|
1306
|
-
ensureDirExist: ensureDirExist$
|
|
1306
|
+
ensureDirExist: ensureDirExist$3
|
|
1307
1307
|
} = io$3;
|
|
1308
1308
|
const {
|
|
1309
1309
|
EXTEND_CMD
|
|
@@ -1325,9 +1325,9 @@ async function installCmd(npmName, cmd) {
|
|
|
1325
1325
|
try {
|
|
1326
1326
|
const cmdPackageJson = `${EXTEND_CMD}/package.json`;
|
|
1327
1327
|
|
|
1328
|
-
if (!fs$
|
|
1329
|
-
ensureDirExist$
|
|
1330
|
-
fs$
|
|
1328
|
+
if (!fs$d.existsSync(cmdPackageJson)) {
|
|
1329
|
+
ensureDirExist$3(EXTEND_CMD);
|
|
1330
|
+
fs$d.writeFileSync(cmdPackageJson, JSON.stringify({
|
|
1331
1331
|
dependencies: {}
|
|
1332
1332
|
}, null, 2));
|
|
1333
1333
|
}
|
|
@@ -1362,17 +1362,17 @@ function loadExtendCmd$1() {
|
|
|
1362
1362
|
const cmdPackageJson = `${EXTEND_CMD}/package.json`;
|
|
1363
1363
|
const cmdNpmDir = `${EXTEND_CMD}/node_modules`;
|
|
1364
1364
|
|
|
1365
|
-
if (fs$
|
|
1366
|
-
const content = fs$
|
|
1365
|
+
if (fs$d.existsSync(cmdPackageJson)) {
|
|
1366
|
+
const content = fs$d.readFileSync(cmdPackageJson, 'utf8');
|
|
1367
1367
|
const json = JSON.parse(content);
|
|
1368
1368
|
const deps = json.dependencies || {};
|
|
1369
1369
|
const cmdConfigs = [];
|
|
1370
1370
|
Object.keys(deps).forEach(name => {
|
|
1371
1371
|
// 检索cmd的npm包
|
|
1372
1372
|
if (!/^tmskit-cmd-|^@[^/]+\/tmskit-cmd-/.test(name)) return false;
|
|
1373
|
-
const cmdConfig = path$
|
|
1373
|
+
const cmdConfig = path$b.join(cmdNpmDir, name, 'tms.config.js');
|
|
1374
1374
|
|
|
1375
|
-
if (fs$
|
|
1375
|
+
if (fs$d.existsSync(cmdConfig)) {
|
|
1376
1376
|
cmdConfigs.push(cmdConfig);
|
|
1377
1377
|
}
|
|
1378
1378
|
});
|
|
@@ -1446,7 +1446,7 @@ var handleError_1 = {
|
|
|
1446
1446
|
*/
|
|
1447
1447
|
/* eslint-disable no-param-reassign */
|
|
1448
1448
|
|
|
1449
|
-
const fs$
|
|
1449
|
+
const fs$c = require$$0__default$2;
|
|
1450
1450
|
const {
|
|
1451
1451
|
getSubPackages: getSubPackages$3,
|
|
1452
1452
|
getModulesConfig
|
|
@@ -1509,12 +1509,12 @@ function updateMainPackages(appJson, mainPackages = []) {
|
|
|
1509
1509
|
|
|
1510
1510
|
|
|
1511
1511
|
const getAppJsonContent = sourceAppJsonPath => {
|
|
1512
|
-
if (!fs$
|
|
1512
|
+
if (!fs$c.existsSync(sourceAppJsonPath)) {
|
|
1513
1513
|
fail$5(`当前路径 ${sourceAppJsonPath} 没找到app.json`);
|
|
1514
1514
|
process.exit(1);
|
|
1515
1515
|
}
|
|
1516
1516
|
|
|
1517
|
-
const appJson = JSON.parse(fs$
|
|
1517
|
+
const appJson = JSON.parse(fs$c.readFileSync(sourceAppJsonPath), 'utf-8'); // 加入默认值
|
|
1518
1518
|
|
|
1519
1519
|
appJson.subpackages = [];
|
|
1520
1520
|
appJson.pages = [];
|
|
@@ -1601,7 +1601,7 @@ function buildOutputAppJson$2(tmsConfig, modules) {
|
|
|
1601
1601
|
fixAppJson(appJson); // 更新主包,需在subpackages处理完成后执行, pages/
|
|
1602
1602
|
|
|
1603
1603
|
updateMainPackages(appJson, tmsConfig.mainPackages);
|
|
1604
|
-
fs$
|
|
1604
|
+
fs$c.writeFileSync(resolve$d(`${tmsConfig.outputDir}/app.json`), JSON.stringify(appJson, null, 2), 'utf8');
|
|
1605
1605
|
|
|
1606
1606
|
if (typeof (tmsConfig === null || tmsConfig === void 0 ? void 0 : (_tmsConfig$hooks = tmsConfig.hooks) === null || _tmsConfig$hooks === void 0 ? void 0 : _tmsConfig$hooks.updateAppJson) === 'function') {
|
|
1607
1607
|
var _tmsConfig$hooks2;
|
|
@@ -1630,7 +1630,7 @@ var buildAppJson = {
|
|
|
1630
1630
|
/**
|
|
1631
1631
|
* 下载第三方代码
|
|
1632
1632
|
*/
|
|
1633
|
-
const MetalSmith = require$$0__default$
|
|
1633
|
+
const MetalSmith = require$$0__default$6;
|
|
1634
1634
|
const crypto$2 = require$$1__default$5;
|
|
1635
1635
|
const {
|
|
1636
1636
|
downloadRepoForGit,
|
|
@@ -1641,8 +1641,8 @@ const {
|
|
|
1641
1641
|
fail: fail$4,
|
|
1642
1642
|
info: info$a
|
|
1643
1643
|
} = log$1;
|
|
1644
|
-
const fs$
|
|
1645
|
-
const shelljs$
|
|
1644
|
+
const fs$b = require$$0__default$2;
|
|
1645
|
+
const shelljs$5 = require$$0__default$3;
|
|
1646
1646
|
const {
|
|
1647
1647
|
handleError: handleError$5
|
|
1648
1648
|
} = handleError_1;
|
|
@@ -1684,8 +1684,8 @@ function replaceGitUrlAccount(httpRepoUrl, moduleName) {
|
|
|
1684
1684
|
|
|
1685
1685
|
|
|
1686
1686
|
function moveFile(sourceDir, targetDir, ignore = []) {
|
|
1687
|
-
if (fs$
|
|
1688
|
-
shelljs$
|
|
1687
|
+
if (fs$b.existsSync(targetDir)) {
|
|
1688
|
+
shelljs$5.rm('-rf', targetDir);
|
|
1689
1689
|
} // 删除不是文件夹的文件
|
|
1690
1690
|
|
|
1691
1691
|
|
|
@@ -1745,7 +1745,7 @@ async function cloneModules$1(sourceDir, targetDir, modules) {
|
|
|
1745
1745
|
}));
|
|
1746
1746
|
});
|
|
1747
1747
|
await Promise.all(arrPromises);
|
|
1748
|
-
shelljs$
|
|
1748
|
+
shelljs$5.cd(cwd);
|
|
1749
1749
|
}
|
|
1750
1750
|
/**
|
|
1751
1751
|
* 收集下载模块代码的任务
|
|
@@ -1798,8 +1798,8 @@ function collectDownLoadTasksMap(sourceDir, targetDir, modules) {
|
|
|
1798
1798
|
targetPath
|
|
1799
1799
|
},
|
|
1800
1800
|
fn: async (sourceModulePath, targetPath) => {
|
|
1801
|
-
if (fs$
|
|
1802
|
-
shelljs$
|
|
1801
|
+
if (fs$b.existsSync(targetPath)) {
|
|
1802
|
+
shelljs$5.rm('-rf', `${targetPath}/*`);
|
|
1803
1803
|
}
|
|
1804
1804
|
|
|
1805
1805
|
await moveFile(`${sourceModulePath}`, targetPath, ['node_modules', '.git']);
|
|
@@ -1813,7 +1813,7 @@ function collectDownLoadTasksMap(sourceDir, targetDir, modules) {
|
|
|
1813
1813
|
} else {
|
|
1814
1814
|
let promiseTask;
|
|
1815
1815
|
|
|
1816
|
-
if (fs$
|
|
1816
|
+
if (fs$b.existsSync(sourcePath) && fs$b.existsSync(`${sourcePath}/.git`)) {
|
|
1817
1817
|
promiseTask = (gitUrl, sourcePath, branch, httpRepoUrl) => {
|
|
1818
1818
|
info$a(`git pull:${httpRepoUrl} --branch: ${branch}`);
|
|
1819
1819
|
return pullRepoForGit(sourcePath, branch);
|
|
@@ -1861,7 +1861,7 @@ function checkRemoteModGitUrlBranch(sourceDir, moduleInfo) {
|
|
|
1861
1861
|
const gitUrl = replaceGitUrlAccount(httpRepoUrl, moduleName);
|
|
1862
1862
|
const md5Key = md5ByGitUrlBranch(gitUrl, buildGitTag);
|
|
1863
1863
|
|
|
1864
|
-
if (!fs$
|
|
1864
|
+
if (!fs$b.existsSync(`${sourceDir}/${md5Key}`)) {
|
|
1865
1865
|
return true;
|
|
1866
1866
|
}
|
|
1867
1867
|
}
|
|
@@ -1874,8 +1874,8 @@ var cloneModules_1 = {
|
|
|
1874
1874
|
checkRemoteModGitUrlBranch
|
|
1875
1875
|
};
|
|
1876
1876
|
|
|
1877
|
-
const ci = require$$0__default$
|
|
1878
|
-
const path$
|
|
1877
|
+
const ci = require$$0__default$8;
|
|
1878
|
+
const path$a = require$$1__default$1;
|
|
1879
1879
|
/**
|
|
1880
1880
|
* 获取小程序ci的Project对象
|
|
1881
1881
|
* @returns {Object} 小程序ci对象
|
|
@@ -1889,7 +1889,7 @@ const getMpCi = ({
|
|
|
1889
1889
|
}) => {
|
|
1890
1890
|
var _projectCg$packOption, _projectCg$packOption2;
|
|
1891
1891
|
|
|
1892
|
-
const projectCg = require(path$
|
|
1892
|
+
const projectCg = require(path$a.join(projectPath, 'project.config.json'));
|
|
1893
1893
|
|
|
1894
1894
|
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(({
|
|
1895
1895
|
value
|
|
@@ -2016,13 +2016,13 @@ var mpCi$2 = {
|
|
|
2016
2016
|
uploadMp
|
|
2017
2017
|
};
|
|
2018
2018
|
|
|
2019
|
-
const fs$
|
|
2020
|
-
const path$
|
|
2019
|
+
const fs$a = require$$0__default$2;
|
|
2020
|
+
const path$9 = require$$1__default$1;
|
|
2021
2021
|
const {
|
|
2022
2022
|
NPM_CACHE_FILE
|
|
2023
2023
|
} = constant;
|
|
2024
2024
|
const {
|
|
2025
|
-
ensureDirExist: ensureDirExist$
|
|
2025
|
+
ensureDirExist: ensureDirExist$2
|
|
2026
2026
|
} = io$3;
|
|
2027
2027
|
|
|
2028
2028
|
function getCache$1(projectDir, type) {
|
|
@@ -2030,7 +2030,7 @@ function getCache$1(projectDir, type) {
|
|
|
2030
2030
|
|
|
2031
2031
|
const filePath = NPM_CACHE_FILE;
|
|
2032
2032
|
|
|
2033
|
-
if (!fs$
|
|
2033
|
+
if (!fs$a.existsSync(filePath)) {
|
|
2034
2034
|
return null;
|
|
2035
2035
|
}
|
|
2036
2036
|
|
|
@@ -2042,10 +2042,10 @@ function getCache$1(projectDir, type) {
|
|
|
2042
2042
|
function setCache$1(projectDir, type = 'miniprogram_npm', data) {
|
|
2043
2043
|
const filePath = NPM_CACHE_FILE;
|
|
2044
2044
|
|
|
2045
|
-
if (!fs$
|
|
2046
|
-
const dir = path$
|
|
2047
|
-
ensureDirExist$
|
|
2048
|
-
fs$
|
|
2045
|
+
if (!fs$a.existsSync(filePath)) {
|
|
2046
|
+
const dir = path$9.dirname(filePath);
|
|
2047
|
+
ensureDirExist$2(dir);
|
|
2048
|
+
fs$a.writeFileSync(filePath, '{}');
|
|
2049
2049
|
}
|
|
2050
2050
|
|
|
2051
2051
|
const content = require(filePath);
|
|
@@ -2057,7 +2057,7 @@ function setCache$1(projectDir, type = 'miniprogram_npm', data) {
|
|
|
2057
2057
|
content[projectDir] = {
|
|
2058
2058
|
[type]: data
|
|
2059
2059
|
};
|
|
2060
|
-
fs$
|
|
2060
|
+
fs$a.writeFileSync(filePath, JSON.stringify(content, null, 2));
|
|
2061
2061
|
}
|
|
2062
2062
|
|
|
2063
2063
|
var cache = {
|
|
@@ -2068,11 +2068,11 @@ var cache = {
|
|
|
2068
2068
|
/**
|
|
2069
2069
|
* 本文件主要负责项目或者分包依赖的npm的安装
|
|
2070
2070
|
*/
|
|
2071
|
-
const fs$
|
|
2071
|
+
const fs$9 = require$$0__default$2;
|
|
2072
2072
|
const fsExtra = require$$1__default$6;
|
|
2073
2073
|
const crypto$1 = require$$1__default$5;
|
|
2074
|
-
const path$
|
|
2075
|
-
const shell = require$$
|
|
2074
|
+
const path$8 = require$$1__default$1;
|
|
2075
|
+
const shell = require$$0__default$3;
|
|
2076
2076
|
const log = log$1;
|
|
2077
2077
|
const {
|
|
2078
2078
|
npmInstall: npmInstall$1
|
|
@@ -2105,7 +2105,7 @@ const collectNpmTasksMap = (packageJsonFiles, cacheDir) => {
|
|
|
2105
2105
|
const npmTasksMap = new Map();
|
|
2106
2106
|
|
|
2107
2107
|
for (const packageJsonPath of packageJsonFiles) {
|
|
2108
|
-
const packageContent = fs$
|
|
2108
|
+
const packageContent = fs$9.readFileSync(packageJsonPath);
|
|
2109
2109
|
let packageJson;
|
|
2110
2110
|
|
|
2111
2111
|
try {
|
|
@@ -2120,14 +2120,14 @@ const collectNpmTasksMap = (packageJsonFiles, cacheDir) => {
|
|
|
2120
2120
|
|
|
2121
2121
|
if (Object.keys(md5Obj.dependencies).length !== 0) {
|
|
2122
2122
|
const md5Key = crypto$1.createHash('md5').update(JSON.stringify(md5Obj)).digest('hex');
|
|
2123
|
-
const cacheNMPath = path$
|
|
2124
|
-
const cacheNMTarFile = path$
|
|
2123
|
+
const cacheNMPath = path$8.join(cacheDir, md5Key);
|
|
2124
|
+
const cacheNMTarFile = path$8.join(cacheNMPath, 'node_modules.tar.gz'); // 下载后,添加回调函数 (拷贝node_modules.tar.gz到编译目录并解压)
|
|
2125
2125
|
|
|
2126
2126
|
const callback = {
|
|
2127
2127
|
params: {
|
|
2128
2128
|
cacheNMPath,
|
|
2129
2129
|
cacheNMTarFile,
|
|
2130
|
-
packageJsonDir: path$
|
|
2130
|
+
packageJsonDir: path$8.dirname(packageJsonPath),
|
|
2131
2131
|
shell
|
|
2132
2132
|
},
|
|
2133
2133
|
fn: async (cacheNMPath, cacheNMTarFile, packageJsonDir, shell) => {
|
|
@@ -2230,7 +2230,7 @@ const findFilesByFilter = (startPath, filter) => {
|
|
|
2230
2230
|
|
|
2231
2231
|
const find = (startPath, filter) => {
|
|
2232
2232
|
// 目录不存在
|
|
2233
|
-
if (!fs$
|
|
2233
|
+
if (!fs$9.existsSync(startPath)) {
|
|
2234
2234
|
log.fail(`${startPath}目录不存在`);
|
|
2235
2235
|
process.exit(-1);
|
|
2236
2236
|
return;
|
|
@@ -2243,10 +2243,10 @@ const findFilesByFilter = (startPath, filter) => {
|
|
|
2243
2243
|
return;
|
|
2244
2244
|
}
|
|
2245
2245
|
|
|
2246
|
-
const files = fs$
|
|
2246
|
+
const files = fs$9.readdirSync(startPath);
|
|
2247
2247
|
files.forEach(file => {
|
|
2248
|
-
const filename = path$
|
|
2249
|
-
const stat = fs$
|
|
2248
|
+
const filename = path$8.join(startPath, file);
|
|
2249
|
+
const stat = fs$9.lstatSync(filename); // 当前文件是文件夹类型,继续递归
|
|
2250
2250
|
|
|
2251
2251
|
if (stat.isDirectory()) {
|
|
2252
2252
|
find(filename, filter);
|
|
@@ -2272,10 +2272,10 @@ const findAllPackageJson = (subRoots = [], contextDir) => {
|
|
|
2272
2272
|
const packageJsonName = 'package.json'; // 查找文件名
|
|
2273
2273
|
|
|
2274
2274
|
const cwd = contextDir || dirPath;
|
|
2275
|
-
const result = [path$
|
|
2275
|
+
const result = [path$8.join(cwd, packageJsonName)]; // 默认填充根目录下的package.json
|
|
2276
2276
|
|
|
2277
2277
|
subRoots.forEach(subRoot => {
|
|
2278
|
-
const toppath = path$
|
|
2278
|
+
const toppath = path$8.join(cwd, subRoot.root); // 从该目录开始查找package.json文件
|
|
2279
2279
|
|
|
2280
2280
|
const list = findFilesByFilter(toppath, packageJsonName);
|
|
2281
2281
|
result.push(...list);
|
|
@@ -2290,12 +2290,12 @@ var npm = {
|
|
|
2290
2290
|
};
|
|
2291
2291
|
|
|
2292
2292
|
const crypto = require$$1__default$5;
|
|
2293
|
-
const fs$
|
|
2293
|
+
const fs$8 = require$$0__default$2;
|
|
2294
2294
|
|
|
2295
2295
|
function fileMd5$1(filePath) {
|
|
2296
2296
|
return new Promise((resolve, reject) => {
|
|
2297
2297
|
const md5sum = crypto.createHash('md5');
|
|
2298
|
-
const stream = fs$
|
|
2298
|
+
const stream = fs$8.ReadStream(filePath);
|
|
2299
2299
|
stream.on('data', d => {
|
|
2300
2300
|
md5sum.update(d);
|
|
2301
2301
|
});
|
|
@@ -2313,20 +2313,20 @@ var md5 = {
|
|
|
2313
2313
|
fileMd5: fileMd5$1
|
|
2314
2314
|
};
|
|
2315
2315
|
|
|
2316
|
-
const fs$
|
|
2316
|
+
const fs$7 = require$$0__default$2;
|
|
2317
2317
|
const semver$1 = require$$1__default$7;
|
|
2318
2318
|
const {
|
|
2319
2319
|
resolve: resolve$b,
|
|
2320
2320
|
getAbsolutePath: getAbsolutePath$4
|
|
2321
2321
|
} = widgets;
|
|
2322
|
-
const path$
|
|
2323
|
-
const shelljs$
|
|
2322
|
+
const path$7 = require$$1__default$1;
|
|
2323
|
+
const shelljs$4 = require$$0__default$3;
|
|
2324
2324
|
const {
|
|
2325
2325
|
handleError: handleError$3
|
|
2326
2326
|
} = handleError_1;
|
|
2327
2327
|
|
|
2328
2328
|
const getLatestVersion = npmName => {
|
|
2329
|
-
const data = shelljs$
|
|
2329
|
+
const data = shelljs$4.exec(`npm view ${npmName} version`);
|
|
2330
2330
|
|
|
2331
2331
|
if (data.code === 0) {
|
|
2332
2332
|
return data.stdout;
|
|
@@ -2341,14 +2341,14 @@ function collectPackageJson(subPackages, cwd, outputDir) {
|
|
|
2341
2341
|
// 1.1根目录的package.json
|
|
2342
2342
|
|
|
2343
2343
|
const packageArr = [{
|
|
2344
|
-
srcPackageDir: path$
|
|
2344
|
+
srcPackageDir: path$7.join(cwd, packageJsonName),
|
|
2345
2345
|
destNpmDir: resolve$b(outputDir, 'node_modules')
|
|
2346
2346
|
}]; // 1.2模块的package.json
|
|
2347
2347
|
|
|
2348
2348
|
subPackages.forEach(item => {
|
|
2349
2349
|
const srcPackageDir = `${getAbsolutePath$4(item.path)}/package.json`;
|
|
2350
2350
|
|
|
2351
|
-
if (fs$
|
|
2351
|
+
if (fs$7.existsSync(srcPackageDir)) {
|
|
2352
2352
|
packageArr.push({
|
|
2353
2353
|
srcPackageDir,
|
|
2354
2354
|
destNpmDir: resolve$b(outputDir, item.root, 'node_modules')
|
|
@@ -2360,7 +2360,7 @@ function collectPackageJson(subPackages, cwd, outputDir) {
|
|
|
2360
2360
|
|
|
2361
2361
|
|
|
2362
2362
|
function readPackageDependencies(srcPackageDir) {
|
|
2363
|
-
const packageJson = fs$
|
|
2363
|
+
const packageJson = fs$7.readFileSync(srcPackageDir, 'utf-8');
|
|
2364
2364
|
let dependencies = {};
|
|
2365
2365
|
|
|
2366
2366
|
try {
|
|
@@ -2395,15 +2395,15 @@ const checkPackageVersion$1 = packageArr => {
|
|
|
2395
2395
|
const dependenciesKeys = Object.keys(dependencies);
|
|
2396
2396
|
|
|
2397
2397
|
for (const key of dependenciesKeys) {
|
|
2398
|
-
const depPath = path$
|
|
2398
|
+
const depPath = path$7.join(item.destNpmDir, key);
|
|
2399
2399
|
|
|
2400
|
-
if (!fs$
|
|
2400
|
+
if (!fs$7.existsSync(depPath)) {
|
|
2401
2401
|
return true;
|
|
2402
2402
|
}
|
|
2403
2403
|
|
|
2404
|
-
const depPackagePath = path$
|
|
2404
|
+
const depPackagePath = path$7.join(depPath, 'package.json');
|
|
2405
2405
|
|
|
2406
|
-
if (fs$
|
|
2406
|
+
if (fs$7.existsSync(depPackagePath)) {
|
|
2407
2407
|
const packageData = require(depPackagePath);
|
|
2408
2408
|
|
|
2409
2409
|
if (dependencies[key] === 'latest') {
|
|
@@ -2429,9 +2429,9 @@ var checkDependencies = {
|
|
|
2429
2429
|
checkPackageVersion: checkPackageVersion$1
|
|
2430
2430
|
};
|
|
2431
2431
|
|
|
2432
|
-
const shelljs$
|
|
2433
|
-
const fs$
|
|
2434
|
-
const path$
|
|
2432
|
+
const shelljs$3 = require$$0__default$3;
|
|
2433
|
+
const fs$6 = require$$0__default$2;
|
|
2434
|
+
const path$6 = require$$1__default$1;
|
|
2435
2435
|
const io$1 = io$3;
|
|
2436
2436
|
const {
|
|
2437
2437
|
createTask: createTask$3,
|
|
@@ -2473,7 +2473,7 @@ async function install$2(tmsConfig, subPackages, useCache = true) {
|
|
|
2473
2473
|
await createTask$3(mpCiInstall, '开始构建miniprogram_npm', '构建miniprogram_npm 完成')(tmsConfig, subPackages, useCache);
|
|
2474
2474
|
}
|
|
2475
2475
|
|
|
2476
|
-
shelljs$
|
|
2476
|
+
shelljs$3.cd(cwd);
|
|
2477
2477
|
}
|
|
2478
2478
|
|
|
2479
2479
|
async function npmInstall(tmsConfig, subPackages, useCache) {
|
|
@@ -2490,7 +2490,7 @@ async function npmInstall(tmsConfig, subPackages, useCache) {
|
|
|
2490
2490
|
const outputModuleDir = resolve$a(`${tmsConfig.outputDir}/${item.root}`);
|
|
2491
2491
|
io$1.ensureDirExist(outputModuleDir);
|
|
2492
2492
|
const modulePackagePath = `${getAbsolutePath$3(item.path)}/package.json`;
|
|
2493
|
-
if (fs$
|
|
2493
|
+
if (fs$6.existsSync(modulePackagePath)) shelljs$3.cp('-Rf', modulePackagePath, outputModuleDir);
|
|
2494
2494
|
});
|
|
2495
2495
|
await npmInstallAll(subPackages, resolve$a(tmsConfig.outputDir), NODE_MODULES_DIR$1);
|
|
2496
2496
|
return {
|
|
@@ -2503,14 +2503,14 @@ async function mpCiInstall(tmsConfig, subPackages, useCache) {
|
|
|
2503
2503
|
const packageJsonFiles = [];
|
|
2504
2504
|
const rootPackFile = resolve$a(`${tmsConfig.outputDir}/package.json`);
|
|
2505
2505
|
|
|
2506
|
-
if (fs$
|
|
2506
|
+
if (fs$6.existsSync(rootPackFile)) {
|
|
2507
2507
|
packageJsonFiles.push(rootPackFile);
|
|
2508
2508
|
}
|
|
2509
2509
|
|
|
2510
2510
|
subPackages.forEach(item => {
|
|
2511
2511
|
const packageJsonFile = resolve$a(`${tmsConfig.outputDir}/${item.root}/package.json`);
|
|
2512
2512
|
|
|
2513
|
-
if (fs$
|
|
2513
|
+
if (fs$6.existsSync(packageJsonFile)) {
|
|
2514
2514
|
packageJsonFiles.push(packageJsonFile);
|
|
2515
2515
|
}
|
|
2516
2516
|
});
|
|
@@ -2523,7 +2523,7 @@ async function mpCiInstall(tmsConfig, subPackages, useCache) {
|
|
|
2523
2523
|
if (useCache) {
|
|
2524
2524
|
let flag = true;
|
|
2525
2525
|
await Promise.all(packageJsonFiles.map(async item => {
|
|
2526
|
-
const packageDir = path$
|
|
2526
|
+
const packageDir = path$6.dirname(item);
|
|
2527
2527
|
const mpDir = resolve$a(`${packageDir}/miniprogram_npm`);
|
|
2528
2528
|
const md5Value = await getMNPMd5(packageDir);
|
|
2529
2529
|
const preCache = getCache(mpDir, 'miniprogram_npm'); // console.log('miniprogram_npm', preCache, md5Value);
|
|
@@ -2543,7 +2543,7 @@ async function mpCiInstall(tmsConfig, subPackages, useCache) {
|
|
|
2543
2543
|
|
|
2544
2544
|
|
|
2545
2545
|
await Promise.all(packageJsonFiles.map(async item => {
|
|
2546
|
-
const packageDir = path$
|
|
2546
|
+
const packageDir = path$6.dirname(item);
|
|
2547
2547
|
const mpDir = resolve$a(`${packageDir}/miniprogram_npm`);
|
|
2548
2548
|
setCache(mpDir, 'miniprogram_npm', {
|
|
2549
2549
|
md5: '',
|
|
@@ -2557,7 +2557,7 @@ async function mpCiInstall(tmsConfig, subPackages, useCache) {
|
|
|
2557
2557
|
}); // 构建成功后,计算md5写入cache
|
|
2558
2558
|
|
|
2559
2559
|
await Promise.all(packageJsonFiles.map(async item => {
|
|
2560
|
-
const packageDir = path$
|
|
2560
|
+
const packageDir = path$6.dirname(item);
|
|
2561
2561
|
const mpDir = resolve$a(`${packageDir}/miniprogram_npm`);
|
|
2562
2562
|
const md5Value = await getMNPMd5(packageDir);
|
|
2563
2563
|
setCache(mpDir, 'miniprogram_npm', {
|
|
@@ -2573,16 +2573,16 @@ async function getMNPMd5(cwd) {
|
|
|
2573
2573
|
async: false,
|
|
2574
2574
|
silent: true
|
|
2575
2575
|
};
|
|
2576
|
-
shelljs$
|
|
2576
|
+
shelljs$3.cd(cwd);
|
|
2577
2577
|
|
|
2578
|
-
if (fs$
|
|
2579
|
-
shelljs$
|
|
2578
|
+
if (fs$6.existsSync('miniprogram_npm')) {
|
|
2579
|
+
shelljs$3.exec('tar -cvf ./miniprogram_npm.tar.gz ./miniprogram_npm', {
|
|
2580
2580
|
cwd,
|
|
2581
2581
|
...shellJsOption
|
|
2582
2582
|
});
|
|
2583
|
-
const tarDir = path$
|
|
2583
|
+
const tarDir = path$6.join(cwd, './miniprogram_npm.tar.gz');
|
|
2584
2584
|
const md5Value = await fileMd5(tarDir);
|
|
2585
|
-
shelljs$
|
|
2585
|
+
shelljs$3.rm('-rf', tarDir);
|
|
2586
2586
|
return md5Value;
|
|
2587
2587
|
}
|
|
2588
2588
|
|
|
@@ -2591,8 +2591,8 @@ async function getMNPMd5(cwd) {
|
|
|
2591
2591
|
|
|
2592
2592
|
var install_1 = install$2;
|
|
2593
2593
|
|
|
2594
|
-
const shelljs$
|
|
2595
|
-
const fs$
|
|
2594
|
+
const shelljs$2 = require$$0__default$3;
|
|
2595
|
+
const fs$5 = require$$0__default$2;
|
|
2596
2596
|
const io = io$3;
|
|
2597
2597
|
const {
|
|
2598
2598
|
resolve: resolve$9,
|
|
@@ -2629,8 +2629,8 @@ const cpFilesToOutput = function (tmsConfig, defaultFiles) {
|
|
|
2629
2629
|
const outputDir = resolve$9(tmsConfig.outputDir);
|
|
2630
2630
|
io.ensureDirExist(outputDir);
|
|
2631
2631
|
defaultFiles.forEach(item => {
|
|
2632
|
-
if (fs$
|
|
2633
|
-
shelljs$
|
|
2632
|
+
if (fs$5.existsSync(resolve$9(item))) {
|
|
2633
|
+
shelljs$2.cp('-rf', resolve$9(item), resolve$9(tmsConfig.outputDir, item));
|
|
2634
2634
|
}
|
|
2635
2635
|
});
|
|
2636
2636
|
};
|
|
@@ -2690,10 +2690,10 @@ var mpProjectJson_1 = mpProjectJson$1;
|
|
|
2690
2690
|
const {
|
|
2691
2691
|
src: src$1,
|
|
2692
2692
|
dest
|
|
2693
|
-
} = require$$0__default$
|
|
2694
|
-
const path$
|
|
2695
|
-
const minimatch = require$$2__default
|
|
2696
|
-
const gulpif = require$$3__default
|
|
2693
|
+
} = require$$0__default$9;
|
|
2694
|
+
const path$5 = require$$1__default$1;
|
|
2695
|
+
const minimatch = require$$2__default;
|
|
2696
|
+
const gulpif = require$$3__default;
|
|
2697
2697
|
const mpProjectJson = mpProjectJson_1;
|
|
2698
2698
|
const {
|
|
2699
2699
|
resolve: resolve$8
|
|
@@ -2704,7 +2704,7 @@ const {
|
|
|
2704
2704
|
} = log$1;
|
|
2705
2705
|
|
|
2706
2706
|
const getTargetFile$1 = (sourceFile, module, outputDir) => {
|
|
2707
|
-
const sourceFileRelativeModule = path$
|
|
2707
|
+
const sourceFileRelativeModule = path$5.relative(resolve$8(module.from), sourceFile);
|
|
2708
2708
|
const targetFile = resolve$8(outputDir, module.to, sourceFileRelativeModule);
|
|
2709
2709
|
return targetFile;
|
|
2710
2710
|
};
|
|
@@ -2762,10 +2762,10 @@ var compile$1 = function (tmsConfig, {
|
|
|
2762
2762
|
/* eslint-disable */
|
|
2763
2763
|
// 该文件源于npm包 gulp-watch 但内部有bug, 故源码进行单独修改
|
|
2764
2764
|
|
|
2765
|
-
const assign = require$$0__default$
|
|
2766
|
-
const path$
|
|
2767
|
-
const PluginError = require$$2__default$
|
|
2768
|
-
const fancyLog = require$$3__default$
|
|
2765
|
+
const assign = require$$0__default$a;
|
|
2766
|
+
const path$4 = require$$1__default$1;
|
|
2767
|
+
const PluginError = require$$2__default$1;
|
|
2768
|
+
const fancyLog = require$$3__default$1;
|
|
2769
2769
|
const colors = require$$4__default$1;
|
|
2770
2770
|
const chokidar = require$$5__default;
|
|
2771
2771
|
const {
|
|
@@ -2808,10 +2808,10 @@ function watch$2(globs, opts, cb) {
|
|
|
2808
2808
|
|
|
2809
2809
|
function resolveFilepath(filepath) {
|
|
2810
2810
|
if (pathIsAbsolute(filepath)) {
|
|
2811
|
-
return path$
|
|
2811
|
+
return path$4.normalize(filepath);
|
|
2812
2812
|
}
|
|
2813
2813
|
|
|
2814
|
-
return path$
|
|
2814
|
+
return path$4.resolve(opts.cwd || process.cwd(), filepath);
|
|
2815
2815
|
}
|
|
2816
2816
|
|
|
2817
2817
|
function resolveGlob(glob) {
|
|
@@ -2867,7 +2867,7 @@ function watch$2(globs, opts, cb) {
|
|
|
2867
2867
|
let glob;
|
|
2868
2868
|
let currentFilepath = filepath;
|
|
2869
2869
|
|
|
2870
|
-
while (!(glob = globs[anymatch(globs, currentFilepath, true)]) && currentFilepath !== (currentFilepath = path$
|
|
2870
|
+
while (!(glob = globs[anymatch(globs, currentFilepath, true)]) && currentFilepath !== (currentFilepath = path$4.dirname(currentFilepath))) {} // eslint-disable-line no-empty-blocks/no-empty-blocks
|
|
2871
2871
|
|
|
2872
2872
|
|
|
2873
2873
|
if (!glob) {
|
|
@@ -2876,7 +2876,7 @@ function watch$2(globs, opts, cb) {
|
|
|
2876
2876
|
}
|
|
2877
2877
|
|
|
2878
2878
|
if (!baseForced) {
|
|
2879
|
-
fileOpts.base = path$
|
|
2879
|
+
fileOpts.base = path$4.normalize(globParent(glob));
|
|
2880
2880
|
} // Do not stat deleted files
|
|
2881
2881
|
|
|
2882
2882
|
|
|
@@ -2936,11 +2936,11 @@ var gulpWatch = watch$2;
|
|
|
2936
2936
|
|
|
2937
2937
|
/* eslint-disable no-restricted-syntax */
|
|
2938
2938
|
const watch$1 = gulpWatch;
|
|
2939
|
-
const path$
|
|
2940
|
-
const shellJs = require$$
|
|
2939
|
+
const path$3 = require$$1__default$1;
|
|
2940
|
+
const shellJs = require$$0__default$3;
|
|
2941
2941
|
const {
|
|
2942
2942
|
series: series$1
|
|
2943
|
-
} = require$$0__default$
|
|
2943
|
+
} = require$$0__default$9;
|
|
2944
2944
|
const {
|
|
2945
2945
|
info: info$7,
|
|
2946
2946
|
warn: warn$1,
|
|
@@ -2992,7 +2992,7 @@ const logTip = (fileName, sourceFile, targetFile, tipMap) => {
|
|
|
2992
2992
|
};
|
|
2993
2993
|
|
|
2994
2994
|
const getTargetFile = (sourceFile, module, outputDir) => {
|
|
2995
|
-
const sourceFileRelativeModule = path$
|
|
2995
|
+
const sourceFileRelativeModule = path$3.relative(resolve$7(module.from), sourceFile);
|
|
2996
2996
|
const targetFile = resolve$7(outputDir, module.to, sourceFileRelativeModule);
|
|
2997
2997
|
return targetFile;
|
|
2998
2998
|
};
|
|
@@ -3036,13 +3036,13 @@ async function runCallback({
|
|
|
3036
3036
|
// callbacl.name === taskFn 代表进入gulp编译流程
|
|
3037
3037
|
// series为gulp编译串行执行,callback执行完毕后,执行updateFileHooks钩子
|
|
3038
3038
|
if (callback.name === 'taskFn') {
|
|
3039
|
-
series$1(callback.bind(null, [sourceFile], path$
|
|
3039
|
+
series$1(callback.bind(null, [sourceFile], path$3.dirname(targetFile)), cb => {
|
|
3040
3040
|
cb();
|
|
3041
3041
|
updateFileHook(tmsConfig, sourceFile, targetFile, type);
|
|
3042
3042
|
})();
|
|
3043
3043
|
} else {
|
|
3044
3044
|
// 普通的callback函数
|
|
3045
|
-
await callback([sourceFile], path$
|
|
3045
|
+
await callback([sourceFile], path$3.dirname(targetFile));
|
|
3046
3046
|
await updateFileHook(tmsConfig, sourceFile, targetFile, type);
|
|
3047
3047
|
}
|
|
3048
3048
|
} // 执行源码文件更新的钩子
|
|
@@ -3063,14 +3063,14 @@ async function updateFileHook(tmsConfig, sourceFile, targetFile, type) {
|
|
|
3063
3063
|
}
|
|
3064
3064
|
}
|
|
3065
3065
|
|
|
3066
|
-
const path$
|
|
3067
|
-
const fs$
|
|
3068
|
-
const ora = require$$0__default;
|
|
3069
|
-
const chalk$
|
|
3066
|
+
const path$2 = require$$1__default$1;
|
|
3067
|
+
const fs$4 = require$$0__default$2;
|
|
3068
|
+
const ora = require$$0__default$1;
|
|
3069
|
+
const chalk$2 = require$$0__default;
|
|
3070
3070
|
const {
|
|
3071
3071
|
parallel,
|
|
3072
3072
|
series
|
|
3073
|
-
} = require$$0__default$
|
|
3073
|
+
} = require$$0__default$9;
|
|
3074
3074
|
const {
|
|
3075
3075
|
resolve: resolve$6,
|
|
3076
3076
|
mergeMap,
|
|
@@ -3132,7 +3132,7 @@ var dev$3 = async (tmsConfig, modules, isDev = true) => {
|
|
|
3132
3132
|
|
|
3133
3133
|
const excludes = moduleItem.exclude.map(ePath => {
|
|
3134
3134
|
const newPath = getAbsolutePath$2(ePath, srcModulePath);
|
|
3135
|
-
const ext = path$
|
|
3135
|
+
const ext = path$2.extname(ePath).slice(1);
|
|
3136
3136
|
|
|
3137
3137
|
if (ext) {
|
|
3138
3138
|
return `!${resolve$6(srcModulePath, newPath)}`;
|
|
@@ -3160,7 +3160,7 @@ var dev$3 = async (tmsConfig, modules, isDev = true) => {
|
|
|
3160
3160
|
item.from = getAbsolutePath$2(item.from);
|
|
3161
3161
|
item.to = getAbsolutePath$2(item.to);
|
|
3162
3162
|
let glob = {};
|
|
3163
|
-
const ext = path$
|
|
3163
|
+
const ext = path$2.extname(item.from).slice(1);
|
|
3164
3164
|
|
|
3165
3165
|
if (ext) {
|
|
3166
3166
|
glob = [item.from];
|
|
@@ -3168,7 +3168,7 @@ var dev$3 = async (tmsConfig, modules, isDev = true) => {
|
|
|
3168
3168
|
glob = [`${item.from}/**/*`];
|
|
3169
3169
|
}
|
|
3170
3170
|
|
|
3171
|
-
const from = fs$
|
|
3171
|
+
const from = fs$4.lstatSync(item.from).isFile() ? path$2.dirname(item.from) : item.from;
|
|
3172
3172
|
mergeMap(compileTasksMap, compile(tmsConfig, {
|
|
3173
3173
|
glob,
|
|
3174
3174
|
destPath: item.to,
|
|
@@ -3235,7 +3235,7 @@ var dev$3 = async (tmsConfig, modules, isDev = true) => {
|
|
|
3235
3235
|
report$6('hooks:afterCompile');
|
|
3236
3236
|
}
|
|
3237
3237
|
|
|
3238
|
-
spinner.succeed(chalk$
|
|
3238
|
+
spinner.succeed(chalk$2.green(`首次编译完成, 耗时${eTime / 1000}s, 微信开发者工具打开项目即可预览。`));
|
|
3239
3239
|
spinner.stop();
|
|
3240
3240
|
cb();
|
|
3241
3241
|
}
|
|
@@ -3250,232 +3250,7 @@ var dev$3 = async (tmsConfig, modules, isDev = true) => {
|
|
|
3250
3250
|
series(start, parallel(...compileTasks), end)();
|
|
3251
3251
|
};
|
|
3252
3252
|
|
|
3253
|
-
|
|
3254
|
-
name: "@tmsfe/tmskit",
|
|
3255
|
-
version: "0.0.24",
|
|
3256
|
-
description: "tmskit",
|
|
3257
|
-
main: "dist/index.cjs",
|
|
3258
|
-
bin: {
|
|
3259
|
-
tmskit: "main.js"
|
|
3260
|
-
},
|
|
3261
|
-
files: [
|
|
3262
|
-
"build",
|
|
3263
|
-
"src",
|
|
3264
|
-
"dist",
|
|
3265
|
-
"main.js",
|
|
3266
|
-
"package.json"
|
|
3267
|
-
],
|
|
3268
|
-
scripts: {
|
|
3269
|
-
dev: "rollup -wc --environment TARGET:tmskit",
|
|
3270
|
-
build: "rollup -c --environment TARGET:tmskit",
|
|
3271
|
-
"pub:patch": "sh build/publish.sh patch",
|
|
3272
|
-
"pub:minor": "sh build/publish.sh minor",
|
|
3273
|
-
"pub:major": "sh build/publish.sh major"
|
|
3274
|
-
},
|
|
3275
|
-
author: "tms·web",
|
|
3276
|
-
license: "ISC",
|
|
3277
|
-
buildOptions: {
|
|
3278
|
-
formats: [
|
|
3279
|
-
"cjs"
|
|
3280
|
-
]
|
|
3281
|
-
},
|
|
3282
|
-
devDependencies: {
|
|
3283
|
-
"@rollup/plugin-babel": "^5.0.2",
|
|
3284
|
-
"@rollup/plugin-commonjs": "^19.0.0",
|
|
3285
|
-
"@rollup/plugin-json": "^4.0.3",
|
|
3286
|
-
rollup: "^2.6.1"
|
|
3287
|
-
},
|
|
3288
|
-
dependencies: {
|
|
3289
|
-
"ansi-colors": "1.1.0",
|
|
3290
|
-
anymatch: "^1.3.0",
|
|
3291
|
-
async: "^3.2.2",
|
|
3292
|
-
chalk: "^4.1.0",
|
|
3293
|
-
chokidar: "^3.5.3",
|
|
3294
|
-
commander: "^8.3.0",
|
|
3295
|
-
"copy-webpack-plugin": "^9.1.0",
|
|
3296
|
-
ejs: "^3.1.5",
|
|
3297
|
-
"fancy-log": "1.3.2",
|
|
3298
|
-
"fs-extra": "^10.0.1",
|
|
3299
|
-
"glob-ignore": "^1.0.2",
|
|
3300
|
-
"glob-parent": "^3.0.1",
|
|
3301
|
-
gulp: "^4.0.2",
|
|
3302
|
-
"gulp-if": "^3.0.0",
|
|
3303
|
-
"gulp-watch": "^5.0.1",
|
|
3304
|
-
htmlparser2: "^7.2.0",
|
|
3305
|
-
inquirer: "^7.3.3",
|
|
3306
|
-
leven: "3.1.0",
|
|
3307
|
-
lodash: "^4.17.21",
|
|
3308
|
-
metalsmith: "^2.3.0",
|
|
3309
|
-
minimatch: "^5.1.0",
|
|
3310
|
-
"miniprogram-ci": "1.8.25",
|
|
3311
|
-
moment: "^2.29.2",
|
|
3312
|
-
"object-assign": "^4.0.1",
|
|
3313
|
-
ora: "^5.1.0",
|
|
3314
|
-
"path-is-absolute": "^1.0.1",
|
|
3315
|
-
"plugin-error": "^1.0.0",
|
|
3316
|
-
postcss: "^8.4.6",
|
|
3317
|
-
precinct: "^8.3.1",
|
|
3318
|
-
"readable-stream": "^2.2.2",
|
|
3319
|
-
"replace-ext": "^2.0.0",
|
|
3320
|
-
request: "^2.88.2",
|
|
3321
|
-
shelljs: "^0.8.4",
|
|
3322
|
-
slash: "^1.0.0",
|
|
3323
|
-
"strip-comments": "^2.0.1",
|
|
3324
|
-
through2: "^4.0.2",
|
|
3325
|
-
unzipper: "^0.10.11",
|
|
3326
|
-
vinyl: "^2.1.0",
|
|
3327
|
-
"vinyl-file": "^2.0.0",
|
|
3328
|
-
"vinyl-sourcemaps-apply": "^0.2.0"
|
|
3329
|
-
},
|
|
3330
|
-
engines: {
|
|
3331
|
-
node: "^12.17.0 || >= 14.13.1"
|
|
3332
|
-
},
|
|
3333
|
-
jest: {
|
|
3334
|
-
testEnvironment: "jest-environment-node"
|
|
3335
|
-
}
|
|
3336
|
-
};
|
|
3337
|
-
|
|
3338
|
-
const fs$4 = require$$0__default$1;
|
|
3339
|
-
const path$2 = require$$1__default$1;
|
|
3340
|
-
const shelljs$2 = require$$2__default;
|
|
3341
|
-
const chalk$2 = require$$3__default;
|
|
3342
|
-
const request = require$$0__default$5;
|
|
3343
|
-
const inquirer = require$$1__default$4;
|
|
3344
|
-
const {
|
|
3345
|
-
infoNoTime: infoNoTime$1
|
|
3346
|
-
} = log$1;
|
|
3347
|
-
const packageJson$1 = require$$12;
|
|
3348
|
-
const {
|
|
3349
|
-
VERSION_CACHE_FILE,
|
|
3350
|
-
VERSION_URL
|
|
3351
|
-
} = constant;
|
|
3352
|
-
const {
|
|
3353
|
-
ensureDirExist: ensureDirExist$2
|
|
3354
|
-
} = io$3;
|
|
3355
|
-
const {
|
|
3356
|
-
versionCompare
|
|
3357
|
-
} = widgets; // 获取推荐的tmskit版本
|
|
3358
|
-
|
|
3359
|
-
function getRecommendVersion() {
|
|
3360
|
-
return new Promise((resolve, reject) => {
|
|
3361
|
-
request(`${VERSION_URL}?v=${new Date().getTime()}`, (error, response, body) => {
|
|
3362
|
-
if (!error && response && response.statusCode === 200) {
|
|
3363
|
-
resolve(JSON.parse(body));
|
|
3364
|
-
} else {
|
|
3365
|
-
reject(response.statusCode);
|
|
3366
|
-
}
|
|
3367
|
-
});
|
|
3368
|
-
});
|
|
3369
|
-
} // 获取当前用户tmskit的版本
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
function getUserTmskitVersion() {
|
|
3373
|
-
const data = shelljs$2.exec('tmskit -v', {
|
|
3374
|
-
async: false,
|
|
3375
|
-
silent: true
|
|
3376
|
-
});
|
|
3377
|
-
|
|
3378
|
-
if (data.code === 0) {
|
|
3379
|
-
// tmskit 0.0.21 => 0.0.21
|
|
3380
|
-
return data.slice(7);
|
|
3381
|
-
}
|
|
3382
|
-
|
|
3383
|
-
return '0.0.0';
|
|
3384
|
-
} // 询问用户是否安装最新版本
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
function isInstallLatestVersion() {
|
|
3388
|
-
return inquirer.prompt([{
|
|
3389
|
-
type: 'confirm',
|
|
3390
|
-
name: 'isInstall',
|
|
3391
|
-
message: '是否安装最新版本',
|
|
3392
|
-
choices: [{
|
|
3393
|
-
name: '否',
|
|
3394
|
-
value: false
|
|
3395
|
-
}, {
|
|
3396
|
-
name: '是',
|
|
3397
|
-
value: true
|
|
3398
|
-
}]
|
|
3399
|
-
}]);
|
|
3400
|
-
} // 获取tmskit的版本是否推荐过
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
function getVersionIsRecommend(version) {
|
|
3404
|
-
const filePath = VERSION_CACHE_FILE;
|
|
3405
|
-
|
|
3406
|
-
if (!fs$4.existsSync(filePath)) {
|
|
3407
|
-
return false;
|
|
3408
|
-
}
|
|
3409
|
-
|
|
3410
|
-
const content = require(filePath);
|
|
3411
|
-
|
|
3412
|
-
return content === null || content === void 0 ? void 0 : content[version];
|
|
3413
|
-
} // 设置tmskit版本推荐过
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
function setVersionRecommend(version, isRecommend) {
|
|
3417
|
-
const filePath = VERSION_CACHE_FILE;
|
|
3418
|
-
|
|
3419
|
-
if (!fs$4.existsSync(filePath)) {
|
|
3420
|
-
const dir = path$2.dirname(filePath);
|
|
3421
|
-
ensureDirExist$2(dir);
|
|
3422
|
-
fs$4.writeFileSync(filePath, '{}');
|
|
3423
|
-
}
|
|
3424
|
-
|
|
3425
|
-
const content = require(filePath);
|
|
3426
|
-
|
|
3427
|
-
content[version] = isRecommend;
|
|
3428
|
-
fs$4.writeFileSync(filePath, JSON.stringify(content, null, 2));
|
|
3429
|
-
} // 推荐理由
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
function displayRecommends(arr = []) {
|
|
3433
|
-
infoNoTime$1(chalk$2.green('构建工具有新的版本~~:'));
|
|
3434
|
-
arr.forEach(item => {
|
|
3435
|
-
infoNoTime$1(chalk$2.green(item));
|
|
3436
|
-
});
|
|
3437
|
-
} // 推荐tmskit的安装版本
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
async function recommendVersion$1() {
|
|
3441
|
-
try {
|
|
3442
|
-
// 获取当前用户安装的版本
|
|
3443
|
-
const tmskitVersion = getUserTmskitVersion(); // 获取官方推荐版本
|
|
3444
|
-
|
|
3445
|
-
const recommendRes = await getRecommendVersion();
|
|
3446
|
-
const recommendVersion = recommendRes.version; // 当前用户安装版本小于官方推荐版本 && 该版本没有推荐过
|
|
3447
|
-
|
|
3448
|
-
if (versionCompare(tmskitVersion, recommendVersion) === -1 && !getVersionIsRecommend(recommendVersion)) {
|
|
3449
|
-
displayRecommends(recommendRes.version_detail); // 设置该版本推荐过
|
|
3450
|
-
|
|
3451
|
-
setVersionRecommend(recommendVersion, true); // 询问用户是否安装最新版本
|
|
3452
|
-
|
|
3453
|
-
const installRes = await isInstallLatestVersion(recommendRes);
|
|
3454
|
-
|
|
3455
|
-
if (installRes.isInstall) {
|
|
3456
|
-
// mac
|
|
3457
|
-
if (process.platform === 'darwin') {
|
|
3458
|
-
infoNoTime$1(`将执行以下命令: ${chalk$2.green(`sudo npm install -g ${packageJson$1.name}@${recommendVersion}`)}`);
|
|
3459
|
-
shelljs$2.exec(`sudo npm install -g ${packageJson$1.name}@${recommendVersion}`, {
|
|
3460
|
-
async: false,
|
|
3461
|
-
silent: false
|
|
3462
|
-
});
|
|
3463
|
-
process.exit(-1);
|
|
3464
|
-
} else {
|
|
3465
|
-
// window
|
|
3466
|
-
infoNoTime$1(`请使用超级管理员执行以下命令: ${chalk$2.green(`npm install -g ${packageJson$1.name}@${recommendVersion}`)}`);
|
|
3467
|
-
process.exit(-1);
|
|
3468
|
-
}
|
|
3469
|
-
}
|
|
3470
|
-
}
|
|
3471
|
-
} catch {}
|
|
3472
|
-
}
|
|
3473
|
-
|
|
3474
|
-
var recommendVersion_1 = {
|
|
3475
|
-
recommendVersion: recommendVersion$1
|
|
3476
|
-
};
|
|
3477
|
-
|
|
3478
|
-
const shelljs$1 = require$$2__default;
|
|
3253
|
+
const shelljs$1 = require$$0__default$3;
|
|
3479
3254
|
const compileDev = dev$3;
|
|
3480
3255
|
const {
|
|
3481
3256
|
resolve: resolve$5,
|
|
@@ -3496,10 +3271,8 @@ const {
|
|
|
3496
3271
|
MODULE_CODE_DIR,
|
|
3497
3272
|
NODE_MODULES_DIR
|
|
3498
3273
|
} = constant;
|
|
3499
|
-
const report$5 = report_1;
|
|
3500
|
-
|
|
3501
|
-
recommendVersion
|
|
3502
|
-
} = recommendVersion_1; // 用户编译分包时,需要将dist中其他分包(主包不能删除)的内容删除,否则其他分包的内容混入到主包(导致主包的体积超2M)
|
|
3274
|
+
const report$5 = report_1; // const { recommendVersion } = require('../../../core/recommendVersion');
|
|
3275
|
+
// 用户编译分包时,需要将dist中其他分包(主包不能删除)的内容删除,否则其他分包的内容混入到主包(导致主包的体积超2M)
|
|
3503
3276
|
|
|
3504
3277
|
function delOtherPackages(tmsConfig, targetSubPackages) {
|
|
3505
3278
|
// 获取所有模块,合并模块依赖的模块
|
|
@@ -3530,10 +3303,10 @@ async function dev$2(tmsConfig, targetModules) {
|
|
|
3530
3303
|
shelljs$1.rm('-rf', MODULE_CODE_DIR);
|
|
3531
3304
|
shelljs$1.rm('-rf', NODE_MODULES_DIR);
|
|
3532
3305
|
} // 推荐tmskit的版本
|
|
3306
|
+
// await recommendVersion();
|
|
3307
|
+
// 初始化操作
|
|
3533
3308
|
|
|
3534
3309
|
|
|
3535
|
-
await recommendVersion(); // 初始化操作
|
|
3536
|
-
|
|
3537
3310
|
const {
|
|
3538
3311
|
subPackages,
|
|
3539
3312
|
modules: newModules
|
|
@@ -3563,7 +3336,7 @@ var build$2 = async (tmsConfig, newModules, isDev) => {
|
|
|
3563
3336
|
dev$1(tmsConfig, newModules, isDev);
|
|
3564
3337
|
};
|
|
3565
3338
|
|
|
3566
|
-
const shelljs = require$$
|
|
3339
|
+
const shelljs = require$$0__default$3;
|
|
3567
3340
|
const {
|
|
3568
3341
|
resolve: resolve$4,
|
|
3569
3342
|
filterField: filterField$2
|
|
@@ -3607,7 +3380,7 @@ var build_1 = build$1;
|
|
|
3607
3380
|
|
|
3608
3381
|
const moment = require$$1__default;
|
|
3609
3382
|
const path$1 = require$$1__default$1;
|
|
3610
|
-
const fs$3 = require$$0__default$
|
|
3383
|
+
const fs$3 = require$$0__default$2;
|
|
3611
3384
|
const {
|
|
3612
3385
|
getGitUser,
|
|
3613
3386
|
getAbsolutePath: getAbsolutePath$1
|
|
@@ -3629,10 +3402,10 @@ function getAllSize$2(data = {}) {
|
|
|
3629
3402
|
return allSize;
|
|
3630
3403
|
}
|
|
3631
3404
|
|
|
3632
|
-
const
|
|
3405
|
+
const getDesc$2 = (desc = '') => {
|
|
3633
3406
|
const user = getGitUser();
|
|
3634
3407
|
const date = moment().format('YYYY-MM-DD HH:mm:ss');
|
|
3635
|
-
return
|
|
3408
|
+
return `构建描述:${desc}; 构建人: ${user}; 构建时间:${date}`;
|
|
3636
3409
|
};
|
|
3637
3410
|
|
|
3638
3411
|
const outputInfo$2 = (infoOutput, data) => {
|
|
@@ -3650,13 +3423,13 @@ const getDetaultVersion = () => {
|
|
|
3650
3423
|
|
|
3651
3424
|
var utils = {
|
|
3652
3425
|
getAllSize: getAllSize$2,
|
|
3653
|
-
|
|
3426
|
+
getDesc: getDesc$2,
|
|
3654
3427
|
outputInfo: outputInfo$2,
|
|
3655
3428
|
getDetaultVersion
|
|
3656
3429
|
};
|
|
3657
3430
|
|
|
3658
3431
|
const mpCi$1 = mpCi$2;
|
|
3659
|
-
const fs$2 = require$$0__default$
|
|
3432
|
+
const fs$2 = require$$0__default$2;
|
|
3660
3433
|
const {
|
|
3661
3434
|
resolve: resolve$3,
|
|
3662
3435
|
createTask: createTask$1,
|
|
@@ -3675,7 +3448,7 @@ const {
|
|
|
3675
3448
|
const {
|
|
3676
3449
|
getAllSize: getAllSize$1,
|
|
3677
3450
|
outputInfo: outputInfo$1,
|
|
3678
|
-
|
|
3451
|
+
getDesc: getDesc$1
|
|
3679
3452
|
} = utils;
|
|
3680
3453
|
const report$3 = report_1;
|
|
3681
3454
|
|
|
@@ -3688,7 +3461,7 @@ const handleParams$1 = (tmsConfig, cmdOptions) => {
|
|
|
3688
3461
|
projectPath: resolve$3(tmsConfig.outputDir),
|
|
3689
3462
|
privateKey: params.privateKey || tmsConfig.privateKey,
|
|
3690
3463
|
robot: params.robot || 30,
|
|
3691
|
-
desc: params.desc ||
|
|
3464
|
+
desc: params.desc || getDesc$1(params.desc),
|
|
3692
3465
|
qrcodeOutputDest: getAbsolutePath(params.qrcodeOutputDest || '')
|
|
3693
3466
|
};
|
|
3694
3467
|
};
|
|
@@ -3762,7 +3535,7 @@ const {
|
|
|
3762
3535
|
const {
|
|
3763
3536
|
getAllSize,
|
|
3764
3537
|
outputInfo,
|
|
3765
|
-
|
|
3538
|
+
getDesc
|
|
3766
3539
|
} = utils;
|
|
3767
3540
|
const report$2 = report_1;
|
|
3768
3541
|
|
|
@@ -3772,7 +3545,7 @@ const handleParams = (tmsConfig, cmdOptions) => {
|
|
|
3772
3545
|
};
|
|
3773
3546
|
|
|
3774
3547
|
if (!params.version) {
|
|
3775
|
-
throw new Error('请指定传入版本号 eg: tmskit run upload
|
|
3548
|
+
throw new Error('请指定传入版本号 eg: tmskit run upload --version 2022.28.5');
|
|
3776
3549
|
}
|
|
3777
3550
|
|
|
3778
3551
|
return { ...params,
|
|
@@ -3780,7 +3553,7 @@ const handleParams = (tmsConfig, cmdOptions) => {
|
|
|
3780
3553
|
projectPath: resolve$2(tmsConfig.outputDir),
|
|
3781
3554
|
privateKey: params.privateKey || tmsConfig.privateKey,
|
|
3782
3555
|
robot: params.robot || 30,
|
|
3783
|
-
desc: params.desc ||
|
|
3556
|
+
desc: params.desc || getDesc(params.desc)
|
|
3784
3557
|
};
|
|
3785
3558
|
};
|
|
3786
3559
|
/**
|
|
@@ -3808,7 +3581,7 @@ async function upload$1(tmsConfig, cmdOptions) {
|
|
|
3808
3581
|
}
|
|
3809
3582
|
|
|
3810
3583
|
;
|
|
3811
|
-
const uploadRes = await createTask(mpCi.uploadMp, '
|
|
3584
|
+
const uploadRes = await createTask(mpCi.uploadMp, '正在上传小程序代码', '上传小程序代码完成')({ ...params
|
|
3812
3585
|
});
|
|
3813
3586
|
const allSize = getAllSize(uploadRes);
|
|
3814
3587
|
|
|
@@ -3828,7 +3601,7 @@ async function upload$1(tmsConfig, cmdOptions) {
|
|
|
3828
3601
|
|
|
3829
3602
|
var upload_1 = upload$1;
|
|
3830
3603
|
|
|
3831
|
-
const fs$1 = require$$0__default$
|
|
3604
|
+
const fs$1 = require$$0__default$2;
|
|
3832
3605
|
const {
|
|
3833
3606
|
resolve: resolve$1
|
|
3834
3607
|
} = widgets;
|
|
@@ -3999,7 +3772,7 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
3999
3772
|
case 'init':
|
|
4000
3773
|
init(tmsConfig, newModules);
|
|
4001
3774
|
report$1('run:init', {
|
|
4002
|
-
appName: tmsConfig
|
|
3775
|
+
appName: tmsConfig.appName
|
|
4003
3776
|
});
|
|
4004
3777
|
return;
|
|
4005
3778
|
|
|
@@ -4007,14 +3780,14 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
4007
3780
|
global.setData('isDev', true);
|
|
4008
3781
|
dev(tmsConfig, newModules);
|
|
4009
3782
|
report$1('run:dev', {
|
|
4010
|
-
appName: tmsConfig
|
|
3783
|
+
appName: tmsConfig.appName
|
|
4011
3784
|
});
|
|
4012
3785
|
return;
|
|
4013
3786
|
|
|
4014
3787
|
case 'install':
|
|
4015
3788
|
install(tmsConfig, subPackages, false);
|
|
4016
3789
|
report$1('run:install', {
|
|
4017
|
-
appName: tmsConfig
|
|
3790
|
+
appName: tmsConfig.appName
|
|
4018
3791
|
});
|
|
4019
3792
|
return;
|
|
4020
3793
|
|
|
@@ -4022,21 +3795,21 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
4022
3795
|
global.setData('isDev', false);
|
|
4023
3796
|
build(tmsConfig, newModules);
|
|
4024
3797
|
report$1('run:build', {
|
|
4025
|
-
appName: tmsConfig
|
|
3798
|
+
appName: tmsConfig.appName
|
|
4026
3799
|
});
|
|
4027
3800
|
return;
|
|
4028
3801
|
|
|
4029
3802
|
case 'preview':
|
|
4030
3803
|
preview(tmsConfig, cmdOptions);
|
|
4031
3804
|
report$1('run:preview', {
|
|
4032
|
-
appName: tmsConfig
|
|
3805
|
+
appName: tmsConfig.appName
|
|
4033
3806
|
});
|
|
4034
3807
|
return;
|
|
4035
3808
|
|
|
4036
3809
|
case 'upload':
|
|
4037
3810
|
upload(tmsConfig, cmdOptions);
|
|
4038
3811
|
report$1('run:upload', {
|
|
4039
|
-
appName: tmsConfig
|
|
3812
|
+
appName: tmsConfig.appName
|
|
4040
3813
|
});
|
|
4041
3814
|
return;
|
|
4042
3815
|
|
|
@@ -4103,16 +3876,102 @@ var entry = [{
|
|
|
4103
3876
|
}, {
|
|
4104
3877
|
command: 'upload',
|
|
4105
3878
|
description: '小程序上传',
|
|
4106
|
-
options: [['
|
|
3879
|
+
options: [['--version [version]', '上传代码版本,version 指定版本号'], ['-d, --desc [desc]', '上传代码时的备注'], ['-i, --info-output [infoOutput]', '相关信息会被输出到给定路径'], ['-r, --robot [robot]', '指定使用哪一个 ci 机器人,可选值:1 ~ 30']],
|
|
4107
3880
|
action: cmdOptions => {
|
|
4108
3881
|
run_1('upload', cmdOptions);
|
|
4109
3882
|
}
|
|
4110
3883
|
}]
|
|
4111
3884
|
}];
|
|
4112
3885
|
|
|
3886
|
+
var require$$12 = {
|
|
3887
|
+
name: "@tmsfe/tmskit",
|
|
3888
|
+
version: "0.0.26",
|
|
3889
|
+
description: "tmskit",
|
|
3890
|
+
main: "dist/index.cjs",
|
|
3891
|
+
bin: {
|
|
3892
|
+
tmskit: "main.js"
|
|
3893
|
+
},
|
|
3894
|
+
files: [
|
|
3895
|
+
"build",
|
|
3896
|
+
"src",
|
|
3897
|
+
"dist",
|
|
3898
|
+
"main.js",
|
|
3899
|
+
"package.json"
|
|
3900
|
+
],
|
|
3901
|
+
scripts: {
|
|
3902
|
+
dev: "rollup -wc --environment TARGET:tmskit",
|
|
3903
|
+
build: "rollup -c --environment TARGET:tmskit",
|
|
3904
|
+
"pub:patch": "sh build/publish.sh patch",
|
|
3905
|
+
"pub:minor": "sh build/publish.sh minor",
|
|
3906
|
+
"pub:major": "sh build/publish.sh major"
|
|
3907
|
+
},
|
|
3908
|
+
author: "tms·web",
|
|
3909
|
+
license: "ISC",
|
|
3910
|
+
buildOptions: {
|
|
3911
|
+
formats: [
|
|
3912
|
+
"cjs"
|
|
3913
|
+
]
|
|
3914
|
+
},
|
|
3915
|
+
devDependencies: {
|
|
3916
|
+
"@rollup/plugin-babel": "^5.0.2",
|
|
3917
|
+
"@rollup/plugin-commonjs": "^19.0.0",
|
|
3918
|
+
"@rollup/plugin-json": "^4.0.3",
|
|
3919
|
+
rollup: "^2.6.1"
|
|
3920
|
+
},
|
|
3921
|
+
whiteDependencies: {
|
|
3922
|
+
},
|
|
3923
|
+
dependencies: {
|
|
3924
|
+
"ansi-colors": "1.1.0",
|
|
3925
|
+
anymatch: "^1.3.0",
|
|
3926
|
+
async: "^3.2.2",
|
|
3927
|
+
chalk: "^4.1.0",
|
|
3928
|
+
chokidar: "^3.5.3",
|
|
3929
|
+
commander: "^8.3.0",
|
|
3930
|
+
ejs: "^3.1.5",
|
|
3931
|
+
"fancy-log": "1.3.2",
|
|
3932
|
+
"fs-extra": "^10.0.1",
|
|
3933
|
+
"glob-ignore": "^1.0.2",
|
|
3934
|
+
"glob-parent": "^3.0.1",
|
|
3935
|
+
gulp: "^4.0.2",
|
|
3936
|
+
"gulp-if": "^3.0.0",
|
|
3937
|
+
"gulp-watch": "^5.0.1",
|
|
3938
|
+
htmlparser2: "^7.2.0",
|
|
3939
|
+
inquirer: "^7.3.3",
|
|
3940
|
+
leven: "3.1.0",
|
|
3941
|
+
lodash: "^4.17.21",
|
|
3942
|
+
metalsmith: "^2.3.0",
|
|
3943
|
+
minimatch: "^5.1.0",
|
|
3944
|
+
"miniprogram-ci": "1.8.25",
|
|
3945
|
+
moment: "^2.29.2",
|
|
3946
|
+
"object-assign": "^4.0.1",
|
|
3947
|
+
ora: "^5.4.1",
|
|
3948
|
+
"path-is-absolute": "^1.0.1",
|
|
3949
|
+
"plugin-error": "^1.0.0",
|
|
3950
|
+
postcss: "^8.4.6",
|
|
3951
|
+
precinct: "^8.3.1",
|
|
3952
|
+
"readable-stream": "^2.2.2",
|
|
3953
|
+
"replace-ext": "^2.0.0",
|
|
3954
|
+
request: "^2.88.2",
|
|
3955
|
+
shelljs: "^0.8.5",
|
|
3956
|
+
slash: "^1.0.0",
|
|
3957
|
+
"strip-comments": "^2.0.1",
|
|
3958
|
+
through2: "^4.0.2",
|
|
3959
|
+
unzipper: "^0.10.11",
|
|
3960
|
+
vinyl: "^2.1.0",
|
|
3961
|
+
"vinyl-file": "^2.0.0",
|
|
3962
|
+
"vinyl-sourcemaps-apply": "^0.2.0"
|
|
3963
|
+
},
|
|
3964
|
+
engines: {
|
|
3965
|
+
node: "^12.17.0 || >= 14.13.1"
|
|
3966
|
+
},
|
|
3967
|
+
jest: {
|
|
3968
|
+
testEnvironment: "jest-environment-node"
|
|
3969
|
+
}
|
|
3970
|
+
};
|
|
3971
|
+
|
|
4113
3972
|
const semver = require$$1__default$7;
|
|
4114
3973
|
const packageJson = require$$12;
|
|
4115
|
-
const chalk$1 = require$$
|
|
3974
|
+
const chalk$1 = require$$0__default;
|
|
4116
3975
|
const {
|
|
4117
3976
|
info
|
|
4118
3977
|
} = log$1;
|
|
@@ -4147,10 +4006,10 @@ function check$1() {
|
|
|
4147
4006
|
var check_1 = check$1;
|
|
4148
4007
|
|
|
4149
4008
|
/* eslint-disable no-param-reassign */
|
|
4150
|
-
const chalk = require$$
|
|
4009
|
+
const chalk = require$$0__default;
|
|
4151
4010
|
const commander = require$$1__default$8;
|
|
4152
4011
|
const path = require$$1__default$1;
|
|
4153
|
-
const fs = require$$0__default$
|
|
4012
|
+
const fs = require$$0__default$2;
|
|
4154
4013
|
const {
|
|
4155
4014
|
resolve
|
|
4156
4015
|
} = widgets;
|