cloudcc-cli 1.1.4 → 1.1.7
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 +19 -5
- package/package.json +1 -1
- package/src/publishProject.js +23 -7
- package/utils/askTool.js +19 -1
- package/utils/deploy.js +9 -0
- package/utils/notifyIM.js +4 -4
package/README.md
CHANGED
|
@@ -1,36 +1,50 @@
|
|
|
1
|
+
# ReleaseV1.1.7
|
|
2
|
+
#### 发布日期:2022-7-12
|
|
3
|
+
#### 发布范围:全量
|
|
4
|
+
#### 发布内容
|
|
5
|
+
* 修复
|
|
6
|
+
* 低版本的nodejs无法识别?.
|
|
7
|
+
|
|
8
|
+
# ReleaseV1.1.5
|
|
9
|
+
#### 发布日期:2022-7-7
|
|
10
|
+
#### 发布范围:全量
|
|
11
|
+
#### 发布内容
|
|
12
|
+
* 迭代
|
|
13
|
+
* 添加云打包功能
|
|
14
|
+
|
|
1
15
|
# ReleaseV1.1.4
|
|
2
16
|
#### 发布日期:2022-7-6
|
|
3
17
|
#### 发布范围:全量
|
|
4
18
|
#### 发布内容
|
|
5
|
-
*
|
|
19
|
+
* 迭代
|
|
6
20
|
* 添加多语言是否下载识别标识
|
|
7
21
|
|
|
8
22
|
# ReleaseV1.1.3
|
|
9
23
|
#### 发布日期:2022-6-23
|
|
10
24
|
#### 发布范围:全量
|
|
11
25
|
#### 发布内容
|
|
12
|
-
*
|
|
26
|
+
* 迭代
|
|
13
27
|
* 将版本信心写入env文件,供其他业务使用
|
|
14
28
|
|
|
15
29
|
# ReleaseV1.1.2
|
|
16
30
|
#### 发布日期:2022-6-21
|
|
17
31
|
#### 发布范围:全量
|
|
18
32
|
#### 发布内容
|
|
19
|
-
*
|
|
33
|
+
* 迭代
|
|
20
34
|
* lightning-web的master分支开放生成readme文件
|
|
21
35
|
|
|
22
36
|
# ReleaseV1.1.1
|
|
23
37
|
#### 发布日期:2022-6-17
|
|
24
38
|
#### 发布范围:全量
|
|
25
39
|
#### 发布内容
|
|
26
|
-
*
|
|
40
|
+
* 迭代
|
|
27
41
|
* 检查更新添加try、catch功能
|
|
28
42
|
|
|
29
43
|
# ReleaseV1.1.0
|
|
30
44
|
#### 发布日期:2022-6-9
|
|
31
45
|
#### 发布范围:全量
|
|
32
46
|
#### 发布内容
|
|
33
|
-
*
|
|
47
|
+
* 迭代
|
|
34
48
|
* 添加钉钉消息通知
|
|
35
49
|
|
|
36
50
|
# ReleaseV1.0.9
|
package/package.json
CHANGED
package/src/publishProject.js
CHANGED
|
@@ -9,7 +9,7 @@ const { change } = require("../utils/md2html")
|
|
|
9
9
|
// 检查版本更新
|
|
10
10
|
const { checkUpdate } = require("../utils/checkVersion")
|
|
11
11
|
// 控制台交互
|
|
12
|
-
const { askType, askTypeOther } = require("../utils/askTool")
|
|
12
|
+
const { askType, askTypeOther, askBuildType } = require("../utils/askTool")
|
|
13
13
|
// 提交代码,设置Tag
|
|
14
14
|
const { getNewVersionName, pushCodeAndTags } = require("../utils/pushCode")
|
|
15
15
|
// 触发构建器
|
|
@@ -20,6 +20,8 @@ const { notifyFeishu, notifyDingDing } = require("../utils/notifyIM")
|
|
|
20
20
|
const dayjs = require("dayjs")
|
|
21
21
|
// 多语言更新脚本
|
|
22
22
|
const { updatei18n, askI18n } = require("../utils/updatei18n")
|
|
23
|
+
// 部署脚本
|
|
24
|
+
const { deploy } = require("../utils/deploy")
|
|
23
25
|
/**
|
|
24
26
|
* 项目打包发布脚本
|
|
25
27
|
*/
|
|
@@ -30,12 +32,17 @@ class Publish {
|
|
|
30
32
|
* type:发布的tag
|
|
31
33
|
* branch:使用的分支
|
|
32
34
|
* language:是否更新多语言,'1'更新,'0'不更新
|
|
35
|
+
* buildType:打包方式,online-云打包,local-本地打包
|
|
36
|
+
* user:打包用户
|
|
33
37
|
*/
|
|
34
38
|
this.args = new Map();
|
|
35
39
|
this.arguments = process.argv.splice(2).map((item) => {
|
|
36
40
|
let arr = item.split("=");
|
|
37
41
|
this.args.set(arr[0], arr[1]);
|
|
38
42
|
});
|
|
43
|
+
this.user = this.args.get("user") || exec("git config user.name").toString("utf8").trim();
|
|
44
|
+
console.log(this.args);
|
|
45
|
+
|
|
39
46
|
}
|
|
40
47
|
/**
|
|
41
48
|
* 初始化
|
|
@@ -57,6 +64,18 @@ class Publish {
|
|
|
57
64
|
}
|
|
58
65
|
}
|
|
59
66
|
|
|
67
|
+
// 1.1:询问打包方式
|
|
68
|
+
let buildType = null;
|
|
69
|
+
if (this.args.get("buildType")) {
|
|
70
|
+
buildType = this.args.get("buildType")
|
|
71
|
+
} else {
|
|
72
|
+
buildType = await askBuildType();
|
|
73
|
+
}
|
|
74
|
+
if ("online" == buildType.buildType) {
|
|
75
|
+
deploy(projectConfig.config["deploy-" + condition.type] + "," + encodeURI(this.user))
|
|
76
|
+
console.log(chalk.green("云发布已开始,请稍后查看通知"))
|
|
77
|
+
return
|
|
78
|
+
}
|
|
60
79
|
// 2:如果命令行包含了分支信息,那么git切换到命令行的分支
|
|
61
80
|
if (this.args.get("branch")) {
|
|
62
81
|
exec(`git checkout ${this.args.get("branch")}`);
|
|
@@ -101,15 +120,12 @@ class Publish {
|
|
|
101
120
|
if (projectConfig.config && projectConfig.config["doc-path"]) {
|
|
102
121
|
outPath = projectConfig.config["doc-path"];
|
|
103
122
|
}
|
|
104
|
-
// lightning的Release禁止生成Readme文档
|
|
105
|
-
// if (!(Object.is("lightning-main", projectConfig.name) && Object.is("Release", condition.type))) {
|
|
106
123
|
try {
|
|
107
124
|
// 设置readme文件位置
|
|
108
125
|
change("README", outPath);
|
|
109
126
|
} catch (error) {
|
|
110
127
|
console.log(chalk.red("README写入异常:" + error))
|
|
111
128
|
}
|
|
112
|
-
// }
|
|
113
129
|
|
|
114
130
|
try {
|
|
115
131
|
// 7:写入版本信息
|
|
@@ -123,8 +139,8 @@ class Publish {
|
|
|
123
139
|
if (projectConfig && projectConfig.config) {
|
|
124
140
|
jenkins(projectConfig.config["jenkins-" + condition.type])
|
|
125
141
|
}
|
|
126
|
-
notifyFeishu(condition.type, version, projectConfig)
|
|
127
|
-
notifyDingDing(condition.type, version, projectConfig)
|
|
142
|
+
notifyFeishu(condition.type, version, projectConfig, this.user)
|
|
143
|
+
notifyDingDing(condition.type, version, projectConfig, this.user)
|
|
128
144
|
console.log();
|
|
129
145
|
console.log(chalk.green('发布完成'));
|
|
130
146
|
console.log();
|
|
@@ -197,7 +213,7 @@ class Publish {
|
|
|
197
213
|
<div>版本号:${version}</div>
|
|
198
214
|
<div>提交Hash:${gitCommitVersion}</div>
|
|
199
215
|
<div>发布时间:${dayjs().format('YYYY-MM-DD HH:mm:ss')}</div>
|
|
200
|
-
<div>发布人员:${
|
|
216
|
+
<div>发布人员:${this.user}</div>
|
|
201
217
|
</div>
|
|
202
218
|
</div>
|
|
203
219
|
</body>
|
package/utils/askTool.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = {
|
|
|
30
30
|
choices = projectConfig.config["branch-" + branch]
|
|
31
31
|
if (choices) {
|
|
32
32
|
choices.push({ name: "其他", value: "other" })
|
|
33
|
-
}else{
|
|
33
|
+
} else {
|
|
34
34
|
choices = projectConfig.config["branch-other"]
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -60,5 +60,23 @@ module.exports = {
|
|
|
60
60
|
}
|
|
61
61
|
];
|
|
62
62
|
return inquirer.prompt(prompt)
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 询问打包方式:本地打包,云打包
|
|
67
|
+
* @returns 结果
|
|
68
|
+
*/
|
|
69
|
+
askBuildType: () => {
|
|
70
|
+
const prompt = [{
|
|
71
|
+
type: 'list',
|
|
72
|
+
message: '请选择打包方式:',
|
|
73
|
+
name: 'buildType',
|
|
74
|
+
choices: [
|
|
75
|
+
{ name: "云打包", value: "online" },
|
|
76
|
+
{ name: "本地打包", value: "local" },
|
|
77
|
+
],
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
return inquirer.prompt(prompt)
|
|
63
81
|
}
|
|
64
82
|
}
|
package/utils/deploy.js
ADDED
package/utils/notifyIM.js
CHANGED
|
@@ -12,13 +12,13 @@ module.exports = {
|
|
|
12
12
|
/**
|
|
13
13
|
* 通知钉钉群
|
|
14
14
|
*/
|
|
15
|
-
notifyDingDing: (type, version, projectConfig) => {
|
|
15
|
+
notifyDingDing: (type, version, projectConfig, user) => {
|
|
16
16
|
if (projectConfig && projectConfig.config) {
|
|
17
17
|
let body = {
|
|
18
18
|
"msgtype": "actionCard",
|
|
19
19
|
"actionCard": {
|
|
20
20
|
"title": `${projectConfig.name}项目发布通知`,
|
|
21
|
-
"text": `${projectConfig.name}项目发布通知` + "\n\n 项 目 名:" + projectConfig.name + "\n\n分 支 名:" + exec("git rev-parse --abbrev-ref HEAD").toString("utf8").trim() + "\n\nTag :" + type + "\n\n版 本 号:" + version + "\n\n发 布 者:" +
|
|
21
|
+
"text": `${projectConfig.name}项目发布通知` + "\n\n 项 目 名:" + projectConfig.name + "\n\n分 支 名:" + exec("git rev-parse --abbrev-ref HEAD").toString("utf8").trim() + "\n\nTag :" + type + "\n\n版 本 号:" + version + "\n\n发 布 者:" + user,
|
|
22
22
|
"btnOrientation": "1",
|
|
23
23
|
"btns": [
|
|
24
24
|
{
|
|
@@ -41,7 +41,7 @@ module.exports = {
|
|
|
41
41
|
/**
|
|
42
42
|
* 通知飞书群
|
|
43
43
|
*/
|
|
44
|
-
notifyFeishu: (type, version, projectConfig) => {
|
|
44
|
+
notifyFeishu: (type, version, projectConfig, user) => {
|
|
45
45
|
if (projectConfig && projectConfig.config) {
|
|
46
46
|
let body = {
|
|
47
47
|
"msg_type": "interactive",
|
|
@@ -52,7 +52,7 @@ module.exports = {
|
|
|
52
52
|
},
|
|
53
53
|
"elements": [{
|
|
54
54
|
"tag": "markdown",
|
|
55
|
-
"content": "项目名称:" + projectConfig.name + "\n分支:" + exec("git rev-parse --abbrev-ref HEAD").toString("utf8").trim() + "\nTag:" + type + "\n版本号:" + version + "\n发布者:" +
|
|
55
|
+
"content": "项目名称:" + projectConfig.name + "\n分支:" + exec("git rev-parse --abbrev-ref HEAD").toString("utf8").trim() + "\nTag:" + type + "\n版本号:" + version + "\n发布者:" + user
|
|
56
56
|
}, {
|
|
57
57
|
"actions": [{
|
|
58
58
|
"tag": "button",
|