cloudcc-cli 1.4.7 → 1.4.8
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/README.md +7 -0
- package/package.json +1 -1
- package/src/publishProject.js +3 -44
- package/src/publishProjectH5.js +6 -1
- package/utils/writeVersion.js +54 -0
package/README.md
CHANGED
package/package.json
CHANGED
package/src/publishProject.js
CHANGED
|
@@ -22,6 +22,8 @@ const dayjs = require("dayjs")
|
|
|
22
22
|
const { updatei18n, askI18n } = require("../utils/updatei18n")
|
|
23
23
|
// 部署脚本
|
|
24
24
|
const { deploy } = require("../utils/deploy")
|
|
25
|
+
// 创建版本信息
|
|
26
|
+
const { writeVersion } = require("../utils/writeVersion")
|
|
25
27
|
/**
|
|
26
28
|
* 项目打包发布脚本
|
|
27
29
|
*/
|
|
@@ -196,7 +198,7 @@ class Publish {
|
|
|
196
198
|
}
|
|
197
199
|
try {
|
|
198
200
|
// 7:写入版本信息
|
|
199
|
-
|
|
201
|
+
writeVersion(version, condition.type, projectConfig, this.user);
|
|
200
202
|
} catch (error) {
|
|
201
203
|
console.log(chalk.red("版本信息写入异常:" + error))
|
|
202
204
|
}
|
|
@@ -212,49 +214,6 @@ class Publish {
|
|
|
212
214
|
console.log();
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* 将版本信息写入文件
|
|
218
|
-
* @param {版本信息} version
|
|
219
|
-
*/
|
|
220
|
-
writeVersion(version, type) {
|
|
221
|
-
try {
|
|
222
|
-
// 获得分支信息
|
|
223
|
-
let branch = execSync('git branch --show-current');
|
|
224
|
-
branch = branch.toString("utf8").trim();
|
|
225
|
-
let versionInfo =
|
|
226
|
-
`
|
|
227
|
-
<!DOCTYPE html>
|
|
228
|
-
<html lang="en">
|
|
229
|
-
|
|
230
|
-
<head>
|
|
231
|
-
<meta charset="UTF-8">
|
|
232
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
233
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
234
|
-
<title>版本信息</title>
|
|
235
|
-
</head>
|
|
236
|
-
|
|
237
|
-
<body>
|
|
238
|
-
<div style="font-size: 20px">
|
|
239
|
-
<div>${projectConfig.name}</div>
|
|
240
|
-
<div style="margin-left:48px">
|
|
241
|
-
<div>版本:${version}</div>
|
|
242
|
-
<div>时间:${dayjs().format('YYYY-MM-DD HH:mm:ss')}</div>
|
|
243
|
-
<div>人员:${this.user}</div>
|
|
244
|
-
<div>分支:${branch}</div>
|
|
245
|
-
<div>标签:${type}</div>
|
|
246
|
-
</div>
|
|
247
|
-
</div>
|
|
248
|
-
</body>
|
|
249
|
-
|
|
250
|
-
</html>
|
|
251
|
-
`
|
|
252
|
-
fs.writeFileSync("dist/version.html", versionInfo, 'utf-8');
|
|
253
|
-
return true
|
|
254
|
-
} catch (error) {
|
|
255
|
-
return false
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
217
|
}
|
|
259
218
|
|
|
260
219
|
module.exports = Publish;
|
package/src/publishProjectH5.js
CHANGED
|
@@ -15,7 +15,7 @@ const { getNewVersionName, pushCodeAndTags } = require("../utils/pushCode")
|
|
|
15
15
|
// 触发构建器
|
|
16
16
|
const { jenkins } = require("../utils/trigger")
|
|
17
17
|
// 通知飞书
|
|
18
|
-
const {
|
|
18
|
+
const {notifyDingDing } = require("../utils/notifyIM")
|
|
19
19
|
// 时间库
|
|
20
20
|
const dayjs = require("dayjs")
|
|
21
21
|
/**
|
|
@@ -203,6 +203,11 @@ class Publish {
|
|
|
203
203
|
</html>
|
|
204
204
|
`
|
|
205
205
|
fs.writeFileSync(outPath + "/version.html", versionInfo, 'utf-8');
|
|
206
|
+
|
|
207
|
+
let versionInfoJson =
|
|
208
|
+
`{"projectName":"${projectConfig.name}","版本":"${version}","时间":"${dayjs().format('YYYY-MM-DD HH:mm:ss')}","人员":"${user}","分支":"${branch}","标签":"${type}"}`
|
|
209
|
+
fs.writeFileSync(outPath + "/version.json", versionInfoJson, 'utf-8');
|
|
210
|
+
|
|
206
211
|
return true
|
|
207
212
|
} catch (error) {
|
|
208
213
|
return false
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// 时间库
|
|
2
|
+
const dayjs = require("dayjs")
|
|
3
|
+
// 文件编辑对象
|
|
4
|
+
const fs = require("fs")
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
/**
|
|
7
|
+
* 将版本信息写入文件
|
|
8
|
+
* @param {版本信息} version
|
|
9
|
+
*/
|
|
10
|
+
module.exports = {
|
|
11
|
+
writeVersion(version, type, projectConfig, user) {
|
|
12
|
+
console.log("start")
|
|
13
|
+
try {
|
|
14
|
+
// 获得分支信息
|
|
15
|
+
let branch = execSync('git branch --show-current');
|
|
16
|
+
branch = branch.toString("utf8").trim();
|
|
17
|
+
let versionInfo =
|
|
18
|
+
`
|
|
19
|
+
<!DOCTYPE html>
|
|
20
|
+
<html lang="en">
|
|
21
|
+
|
|
22
|
+
<head>
|
|
23
|
+
<meta charset="UTF-8">
|
|
24
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
25
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
26
|
+
<title>版本信息</title>
|
|
27
|
+
</head>
|
|
28
|
+
|
|
29
|
+
<body>
|
|
30
|
+
<div style="font-size: 20px">
|
|
31
|
+
<div>${projectConfig.name}</div>
|
|
32
|
+
<div style="margin-left:48px">
|
|
33
|
+
<div>版本:${version}</div>
|
|
34
|
+
<div>时间:${dayjs().format('YYYY-MM-DD HH:mm:ss')}</div>
|
|
35
|
+
<div>人员:${user}</div>
|
|
36
|
+
<div>分支:${branch}</div>
|
|
37
|
+
<div>标签:${type}</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</body>
|
|
41
|
+
|
|
42
|
+
</html>
|
|
43
|
+
`
|
|
44
|
+
fs.writeFileSync("dist/version.html", versionInfo, 'utf-8');
|
|
45
|
+
|
|
46
|
+
let versionInfoJson =
|
|
47
|
+
`{"projectName":"${projectConfig.name}","版本":"${version}","时间":"${dayjs().format('YYYY-MM-DD HH:mm:ss')}","人员":"${user}","分支":"${branch}","标签":"${type}"}`
|
|
48
|
+
fs.writeFileSync("dist/version.json", versionInfoJson, 'utf-8');
|
|
49
|
+
return true
|
|
50
|
+
} catch (error) {
|
|
51
|
+
return false
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|