cloudcc-cli 0.9.3 → 0.9.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 +28 -0
- package/package.json +1 -1
- package/src/builderPlugin.js +0 -9
- package/src/publishProject.js +29 -3
- package/utils/checkVersion.js +8 -7
- package/utils/notifyIM.js +1 -1
- package/utils/pushCode.js +12 -8
package/README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
# ReleaseV0.9.7
|
|
2
|
+
#### 发布日期:2022-2-15
|
|
3
|
+
#### 发布范围:全量
|
|
4
|
+
#### 发布内容
|
|
5
|
+
* 优化
|
|
6
|
+
* 发布项目,使用服务器功能
|
|
7
|
+
|
|
8
|
+
# ReleaseV0.9.6
|
|
9
|
+
#### 发布日期:2022-2-14
|
|
10
|
+
#### 发布范围:全量
|
|
11
|
+
#### 发布内容
|
|
12
|
+
* 优化
|
|
13
|
+
* 还原builderPlugin
|
|
14
|
+
|
|
15
|
+
# ReleaseV0.9.5
|
|
16
|
+
#### 发布日期:2022-2-10
|
|
17
|
+
#### 发布范围:全量
|
|
18
|
+
#### 发布内容
|
|
19
|
+
* 优化
|
|
20
|
+
* 飞书通知增加分支标识
|
|
21
|
+
|
|
22
|
+
# ReleaseV0.9.4
|
|
23
|
+
#### 发布日期:2021-12-10
|
|
24
|
+
#### 发布范围:全量
|
|
25
|
+
#### 发布内容
|
|
26
|
+
* 优化
|
|
27
|
+
* 自动更新版本指定版本号
|
|
28
|
+
|
|
1
29
|
# ReleaseV0.9.3
|
|
2
30
|
#### 发布日期:2021-12-10
|
|
3
31
|
#### 发布范围:全量
|
package/package.json
CHANGED
package/src/builderPlugin.js
CHANGED
|
@@ -87,28 +87,19 @@ class Builder {
|
|
|
87
87
|
*/
|
|
88
88
|
getVueValue(buildFileName) {
|
|
89
89
|
let vueContent = fs.readFileSync(this.getVueContent(buildFileName), 'utf8');
|
|
90
|
-
|
|
91
90
|
let vueData = vueContent + ""
|
|
92
|
-
|
|
93
91
|
// 去除空格
|
|
94
92
|
// vueData = vueData.replace(/\ +/g, "")
|
|
95
93
|
// 去除换行
|
|
96
94
|
// vueData =vueData.replace(/[\r\n]/g, "");
|
|
97
|
-
|
|
98
95
|
vueData = vueData.split("data()")[1].split("isLock:")[0] + "isLock:false,};}";
|
|
99
|
-
|
|
100
96
|
vueData = "function data()" + vueData;
|
|
101
|
-
|
|
102
97
|
const data = eval(`(${vueData})`)()
|
|
103
|
-
|
|
104
98
|
let compName = data.componentInfo.component // 组件名字
|
|
105
|
-
|
|
106
99
|
vueData = JSON.stringify(data);
|
|
107
|
-
|
|
108
100
|
let bizType = data.componentInfo.bizType // 组件类型
|
|
109
101
|
let compDesc = data.componentInfo.compDesc // 组件描述
|
|
110
102
|
let category = data.componentInfo.category // 组件状态
|
|
111
|
-
|
|
112
103
|
return { compName, vueContent, vueData, bizType, compDesc, category }
|
|
113
104
|
};
|
|
114
105
|
/**
|
package/src/publishProject.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 { notifyFeishu } = require("../utils/
|
|
18
|
+
const { notifyFeishu } = require("../utils/notifyIM")
|
|
19
19
|
// 时间库
|
|
20
20
|
const dayjs = require("dayjs")
|
|
21
21
|
/**
|
|
@@ -23,6 +23,16 @@ const dayjs = require("dayjs")
|
|
|
23
23
|
*/
|
|
24
24
|
class Publish {
|
|
25
25
|
constructor() {
|
|
26
|
+
/**
|
|
27
|
+
* 控制台参数
|
|
28
|
+
* type:发布类型
|
|
29
|
+
* branch:使用的分支
|
|
30
|
+
*/
|
|
31
|
+
this.args = new Map();
|
|
32
|
+
this.arguments = process.argv.splice(2).map((item) => {
|
|
33
|
+
let arr = item.split("=");
|
|
34
|
+
this.args.set(arr[0].split("-")[1], arr[1]);
|
|
35
|
+
});
|
|
26
36
|
}
|
|
27
37
|
/**
|
|
28
38
|
* 初始化
|
|
@@ -30,13 +40,29 @@ class Publish {
|
|
|
30
40
|
async init() {
|
|
31
41
|
let res = await checkUpdate();
|
|
32
42
|
if (!res) {
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
let condition = {};
|
|
44
|
+
// 检查参数是否存在发布类型
|
|
45
|
+
if (this.args.get("type")) {
|
|
46
|
+
condition.type = this.args.get("type")
|
|
47
|
+
} else {
|
|
48
|
+
// 询问发布类型
|
|
49
|
+
condition = await askType();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// 如果存在分支,则切换分支
|
|
53
|
+
if (this.args.get("branch")) {
|
|
54
|
+
exec(`git checkout ${this.args.get("branch")}`);
|
|
55
|
+
console.log(chalk.green("切换分支:" + this.args.get("branch")))
|
|
56
|
+
console.log()
|
|
57
|
+
}
|
|
58
|
+
|
|
35
59
|
// 获得version
|
|
36
60
|
let version = getNewVersionName([condition.type])
|
|
37
61
|
console.log();
|
|
38
62
|
console.log(chalk.green('待发布版本:' + version));
|
|
39
63
|
console.log();
|
|
64
|
+
|
|
65
|
+
// 开始打包
|
|
40
66
|
if (await this.build()) {
|
|
41
67
|
// 将readme生成为html,并复制到dist中
|
|
42
68
|
let outPath = "dist"
|
package/utils/checkVersion.js
CHANGED
|
@@ -19,10 +19,10 @@ function checkNpmVersion() {
|
|
|
19
19
|
console.log(chalk.green("当前版本:v" + config.version));
|
|
20
20
|
console.log(chalk.green("最新版本:v" + onlineVersion));
|
|
21
21
|
console.log();
|
|
22
|
-
console.log(chalk.yellow(
|
|
23
|
-
return
|
|
22
|
+
console.log(chalk.yellow(`如无法自动更新,请使用命令更新:npm install -g cloudcc-cli@${onlineVersion} --registry https://registry.npmjs.org`));
|
|
23
|
+
return onlineVersion;
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return null;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -45,10 +45,10 @@ function askUpdate() {
|
|
|
45
45
|
/**
|
|
46
46
|
* 升级cli
|
|
47
47
|
*/
|
|
48
|
-
function update() {
|
|
48
|
+
function update(onlineVersion) {
|
|
49
49
|
console.log()
|
|
50
50
|
console.log(chalk.green("升级中,请稍后..."));
|
|
51
|
-
exec(`npm install -g cloudcc-cli --registry https://registry.npmjs.org`)
|
|
51
|
+
exec(`npm install -g cloudcc-cli@${onlineVersion} --registry https://registry.npmjs.org`)
|
|
52
52
|
console.log()
|
|
53
53
|
console.log(chalk.green("升级完成!请重新运行"));
|
|
54
54
|
}
|
|
@@ -57,10 +57,11 @@ function update() {
|
|
|
57
57
|
* 检查更新
|
|
58
58
|
*/
|
|
59
59
|
async function checkUpdate() {
|
|
60
|
-
|
|
60
|
+
let onlineVersion = checkNpmVersion();
|
|
61
|
+
if (onlineVersion) {
|
|
61
62
|
let res = await askUpdate()
|
|
62
63
|
if ("Yes" == res.update) {
|
|
63
|
-
update()
|
|
64
|
+
update(onlineVersion)
|
|
64
65
|
return true;
|
|
65
66
|
} else {
|
|
66
67
|
return false
|
package/utils/notifyIM.js
CHANGED
|
@@ -21,7 +21,7 @@ module.exports = {
|
|
|
21
21
|
},
|
|
22
22
|
"elements": [{
|
|
23
23
|
"tag": "markdown",
|
|
24
|
-
"content": "项目名称:" + projectConfig.name + "\nTag:" + type + "\n版本号:" + version + "\n发布者:" + exec("git config user.name").toString("utf8").trim()
|
|
24
|
+
"content": "项目名称:" + projectConfig.name + "\n分支:" + exec("git rev-parse --abbrev-ref HEAD").toString("utf8").trim() + "\nTag:" + type + "\n版本号:" + version + "\n发布者:" + exec("git config user.name").toString("utf8").trim()
|
|
25
25
|
}, {
|
|
26
26
|
"actions": [{
|
|
27
27
|
"tag": "button",
|
package/utils/pushCode.js
CHANGED
|
@@ -22,14 +22,18 @@ function getNewVersionName(types) {
|
|
|
22
22
|
return item.includes("-V");
|
|
23
23
|
})
|
|
24
24
|
console.log("version 1", version);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
if (version) {
|
|
26
|
+
// 取版本号
|
|
27
|
+
version = version.split("-V")[1]
|
|
28
|
+
console.log("version 2", version);
|
|
29
|
+
// 改变版本号
|
|
30
|
+
version = changeVersion.change(version, item)
|
|
31
|
+
console.log("version 3", version);
|
|
32
|
+
// 生成最后的版本号
|
|
33
|
+
item = item + "-V" + version
|
|
34
|
+
} else {
|
|
35
|
+
item = item + "-V0.0.1"
|
|
36
|
+
}
|
|
33
37
|
} else {
|
|
34
38
|
item = item + "-V0.0.1"
|
|
35
39
|
}
|