@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmsfe/tmskit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "tmskit",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@rollup/plugin-json": "^4.0.3",
|
|
34
34
|
"rollup": "^2.6.1"
|
|
35
35
|
},
|
|
36
|
+
"whiteDependencies": {},
|
|
36
37
|
"dependencies": {
|
|
37
38
|
"ansi-colors": "1.1.0",
|
|
38
39
|
"anymatch": "^1.3.0",
|
|
@@ -40,7 +41,6 @@
|
|
|
40
41
|
"chalk": "^4.1.0",
|
|
41
42
|
"chokidar": "^3.5.3",
|
|
42
43
|
"commander": "^8.3.0",
|
|
43
|
-
"copy-webpack-plugin": "^9.1.0",
|
|
44
44
|
"ejs": "^3.1.5",
|
|
45
45
|
"fancy-log": "1.3.2",
|
|
46
46
|
"fs-extra": "^10.0.1",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"miniprogram-ci": "1.8.25",
|
|
59
59
|
"moment": "^2.29.2",
|
|
60
60
|
"object-assign": "^4.0.1",
|
|
61
|
-
"ora": "^5.1
|
|
61
|
+
"ora": "^5.4.1",
|
|
62
62
|
"path-is-absolute": "^1.0.1",
|
|
63
63
|
"plugin-error": "^1.0.0",
|
|
64
64
|
"postcss": "^8.4.6",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"readable-stream": "^2.2.2",
|
|
67
67
|
"replace-ext": "^2.0.0",
|
|
68
68
|
"request": "^2.88.2",
|
|
69
|
-
"shelljs": "^0.8.
|
|
69
|
+
"shelljs": "^0.8.5",
|
|
70
70
|
"slash": "^1.0.0",
|
|
71
71
|
"strip-comments": "^2.0.1",
|
|
72
72
|
"through2": "^4.0.2",
|
|
@@ -81,4 +81,4 @@
|
|
|
81
81
|
"jest": {
|
|
82
82
|
"testEnvironment": "jest-environment-node"
|
|
83
83
|
}
|
|
84
|
-
}
|
|
84
|
+
}
|
package/src/entry.js
CHANGED
|
@@ -83,7 +83,7 @@ module.exports = [
|
|
|
83
83
|
command: 'upload',
|
|
84
84
|
description: '小程序上传',
|
|
85
85
|
options: [
|
|
86
|
-
['
|
|
86
|
+
['--version [version]', '上传代码版本,version 指定版本号'],
|
|
87
87
|
['-d, --desc [desc]', '上传代码时的备注'],
|
|
88
88
|
['-i, --info-output [infoOutput]', '相关信息会被输出到给定路径'],
|
|
89
89
|
['-r, --robot [robot]', '指定使用哪一个 ci 机器人,可选值:1 ~ 30'],
|
|
@@ -7,7 +7,7 @@ const { info } = require('../../../utils/log');
|
|
|
7
7
|
const { global } = require('../../../utils/global');
|
|
8
8
|
const { MODULE_CODE_DIR, NODE_MODULES_DIR } = require('../../../config/constant');
|
|
9
9
|
const report = require('../../../core/report');
|
|
10
|
-
const { recommendVersion } = require('../../../core/recommendVersion');
|
|
10
|
+
// const { recommendVersion } = require('../../../core/recommendVersion');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
// 用户编译分包时,需要将dist中其他分包(主包不能删除)的内容删除,否则其他分包的内容混入到主包(导致主包的体积超2M)
|
|
@@ -35,7 +35,7 @@ async function dev(tmsConfig, targetModules) {
|
|
|
35
35
|
shelljs.rm('-rf', NODE_MODULES_DIR);
|
|
36
36
|
}
|
|
37
37
|
// 推荐tmskit的版本
|
|
38
|
-
await recommendVersion();
|
|
38
|
+
// await recommendVersion();
|
|
39
39
|
|
|
40
40
|
// 初始化操作
|
|
41
41
|
const { subPackages, modules: newModules } = await init(tmsConfig, targetModules);
|
package/src/scripts/run/index.js
CHANGED
|
@@ -91,29 +91,29 @@ function otherCommands(tmsConfig, commandName, cmdOptions) {
|
|
|
91
91
|
switch (commandName) {
|
|
92
92
|
case 'init':
|
|
93
93
|
init(tmsConfig, newModules);
|
|
94
|
-
report('run:init', { appName: tmsConfig
|
|
94
|
+
report('run:init', { appName: tmsConfig.appName });
|
|
95
95
|
return;
|
|
96
96
|
case 'dev':
|
|
97
97
|
global.setData('isDev', true);
|
|
98
98
|
dev(tmsConfig, newModules);
|
|
99
|
-
report('run:dev', { appName: tmsConfig
|
|
99
|
+
report('run:dev', { appName: tmsConfig.appName });
|
|
100
100
|
return;
|
|
101
101
|
case 'install':
|
|
102
102
|
install(tmsConfig, subPackages, false);
|
|
103
|
-
report('run:install', { appName: tmsConfig
|
|
103
|
+
report('run:install', { appName: tmsConfig.appName });
|
|
104
104
|
return;
|
|
105
105
|
case 'build':
|
|
106
106
|
global.setData('isDev', false);
|
|
107
107
|
build(tmsConfig, newModules);
|
|
108
|
-
report('run:build', { appName: tmsConfig
|
|
108
|
+
report('run:build', { appName: tmsConfig.appName });
|
|
109
109
|
return;
|
|
110
110
|
case 'preview':
|
|
111
111
|
preview(tmsConfig, cmdOptions);
|
|
112
|
-
report('run:preview', { appName: tmsConfig
|
|
112
|
+
report('run:preview', { appName: tmsConfig.appName });
|
|
113
113
|
return;
|
|
114
114
|
case 'upload':
|
|
115
115
|
upload(tmsConfig, cmdOptions);
|
|
116
|
-
report('run:upload', { appName: tmsConfig
|
|
116
|
+
report('run:upload', { appName: tmsConfig.appName });
|
|
117
117
|
return;
|
|
118
118
|
default:
|
|
119
119
|
return;
|
|
@@ -4,7 +4,7 @@ const { resolve, createTask, getAbsolutePath, filterField } = require('../../../
|
|
|
4
4
|
const { handleError } = require('../../../core/handleError');
|
|
5
5
|
const { info } = require('../../../utils/log');
|
|
6
6
|
const { global } = require('../../../utils/global');
|
|
7
|
-
const { getAllSize, outputInfo,
|
|
7
|
+
const { getAllSize, outputInfo, getDesc } = require('./utils');
|
|
8
8
|
const report = require('../../../core/report');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ const handleParams = (tmsConfig, cmdOptions) => {
|
|
|
19
19
|
projectPath: resolve(tmsConfig.outputDir),
|
|
20
20
|
privateKey: params.privateKey || tmsConfig.privateKey,
|
|
21
21
|
robot: params.robot || 30,
|
|
22
|
-
desc: params.desc ||
|
|
22
|
+
desc: params.desc || getDesc(params.desc),
|
|
23
23
|
qrcodeOutputDest: getAbsolutePath(params.qrcodeOutputDest || ''),
|
|
24
24
|
};
|
|
25
25
|
};
|
|
@@ -15,10 +15,10 @@ function getAllSize(data = {}) {
|
|
|
15
15
|
return allSize;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const getDesc = (desc = '') => {
|
|
19
19
|
const user = getGitUser();
|
|
20
20
|
const date = moment().format('YYYY-MM-DD HH:mm:ss');
|
|
21
|
-
return
|
|
21
|
+
return `构建描述:${desc}; 构建人: ${user}; 构建时间:${date}`;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const outputInfo = (infoOutput, data) => {
|
|
@@ -37,7 +37,7 @@ const getDetaultVersion = () => {
|
|
|
37
37
|
|
|
38
38
|
module.exports = {
|
|
39
39
|
getAllSize,
|
|
40
|
-
|
|
40
|
+
getDesc,
|
|
41
41
|
outputInfo,
|
|
42
42
|
getDetaultVersion,
|
|
43
43
|
};
|
|
@@ -3,7 +3,7 @@ const { resolve, createTask, filterField } = require('../../../utils/widgets');
|
|
|
3
3
|
const { handleError } = require('../../../core/handleError');
|
|
4
4
|
const { info } = require('../../../utils/log');
|
|
5
5
|
const { global } = require('../../../utils/global');
|
|
6
|
-
const { getAllSize, outputInfo,
|
|
6
|
+
const { getAllSize, outputInfo, getDesc } = require('../preview/utils');
|
|
7
7
|
const report = require('../../../core/report');
|
|
8
8
|
|
|
9
9
|
const handleParams = (tmsConfig, cmdOptions) => {
|
|
@@ -13,7 +13,7 @@ const handleParams = (tmsConfig, cmdOptions) => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
if (!params.version) {
|
|
16
|
-
throw new Error('请指定传入版本号 eg: tmskit run upload
|
|
16
|
+
throw new Error('请指定传入版本号 eg: tmskit run upload --version 2022.28.5');
|
|
17
17
|
}
|
|
18
18
|
return {
|
|
19
19
|
...params,
|
|
@@ -21,7 +21,7 @@ const handleParams = (tmsConfig, cmdOptions) => {
|
|
|
21
21
|
projectPath: resolve(tmsConfig.outputDir),
|
|
22
22
|
privateKey: params.privateKey || tmsConfig.privateKey,
|
|
23
23
|
robot: params.robot || 30,
|
|
24
|
-
desc: params.desc ||
|
|
24
|
+
desc: params.desc || getDesc(params.desc),
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -43,8 +43,8 @@ async function upload(tmsConfig, cmdOptions) {
|
|
|
43
43
|
};
|
|
44
44
|
const uploadRes = await createTask(
|
|
45
45
|
mpCi.uploadMp,
|
|
46
|
-
'
|
|
47
|
-
'
|
|
46
|
+
'正在上传小程序代码',
|
|
47
|
+
'上传小程序代码完成',
|
|
48
48
|
)({
|
|
49
49
|
...params,
|
|
50
50
|
});
|
package/src/core/cache.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { CACHE_FILE, CACHE_DIR } = require('../config/constant');
|
|
4
|
-
const { ensureDirExist } = require('../utils/io');
|
|
5
|
-
|
|
6
|
-
function getCache(projectDir, type) {
|
|
7
|
-
const filePath = `${CACHE_DIR}/${CACHE_FILE}`;
|
|
8
|
-
if (!fs.existsSync(filePath)) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
const content = require(filePath);
|
|
12
|
-
return content?.[projectDir]?.[type];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function setCache(projectDir, type = 'miniprogram_npm', data) {
|
|
17
|
-
const filePath = `${CACHE_DIR}/${CACHE_FILE}`;
|
|
18
|
-
if (!fs.existsSync(filePath)) {
|
|
19
|
-
const dir = path.dirname(filePath);
|
|
20
|
-
ensureDirExist(dir);
|
|
21
|
-
fs.writeFileSync(filePath, '{}');
|
|
22
|
-
}
|
|
23
|
-
const content = require(filePath);
|
|
24
|
-
if (!content[projectDir]) {
|
|
25
|
-
content[projectDir] = {};
|
|
26
|
-
}
|
|
27
|
-
content[projectDir] = {
|
|
28
|
-
[type]: data,
|
|
29
|
-
};
|
|
30
|
-
fs.writeFileSync(filePath, JSON.stringify(content, null, 2));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
module.exports = {
|
|
34
|
-
setCache,
|
|
35
|
-
getCache,
|
|
36
|
-
};
|