cloudcc-cli 0.9.3 → 0.9.4

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 CHANGED
@@ -1,3 +1,17 @@
1
+ # ReleaseV0.9.5
2
+ #### 发布日期:2022-2-10
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 优化
6
+ * 飞书通知增加分支标识
7
+
8
+ # ReleaseV0.9.4
9
+ #### 发布日期:2021-12-10
10
+ #### 发布范围:全量
11
+ #### 发布内容
12
+ * 优化
13
+ * 自动更新版本指定版本号
14
+
1
15
  # ReleaseV0.9.3
2
16
  #### 发布日期:2021-12-10
3
17
  #### 发布范围:全量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
@@ -88,26 +88,21 @@ class Builder {
88
88
  getVueValue(buildFileName) {
89
89
  let vueContent = fs.readFileSync(this.getVueContent(buildFileName), 'utf8');
90
90
 
91
- let vueData = vueContent + ""
91
+ // 获取componentInfo
92
+ let reg = /componentInfo([\s\S]*?)\}/;
93
+ let componentInfo = vueContent.match(reg)[1].split("{")[1];
94
+ componentInfo = eval(`(${"function getInfo() { return {" + componentInfo + " } }"})`)()
95
+ // 组件名字
96
+ let compName = componentInfo.component
97
+ // 组件类型
98
+ let bizType = componentInfo.bizType
99
+ // 组件描述
100
+ let compDesc = componentInfo.compDesc
101
+ // 组件状态
102
+ let category = componentInfo.category
92
103
 
93
- // 去除空格
94
- // vueData = vueData.replace(/\ +/g, "")
95
- // 去除换行
96
- // vueData =vueData.replace(/[\r\n]/g, "");
97
-
98
- vueData = vueData.split("data()")[1].split("isLock:")[0] + "isLock:false,};}";
99
-
100
- vueData = "function data()" + vueData;
101
-
102
- const data = eval(`(${vueData})`)()
103
-
104
- let compName = data.componentInfo.component // 组件名字
105
-
106
- vueData = JSON.stringify(data);
107
-
108
- let bizType = data.componentInfo.bizType // 组件类型
109
- let compDesc = data.componentInfo.compDesc // 组件描述
110
- let category = data.componentInfo.category // 组件状态
104
+ // 获取vueDate内容
105
+ let vueData = vueContent.split("data()")[1].split("return")[1].split("isLock:")[0] + "isLock:false,}";
111
106
 
112
107
  return { compName, vueContent, vueData, bizType, compDesc, category }
113
108
  };
@@ -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("如无法自动更新,请使用命令更新:npm install -g cloudcc-cli --registry https://registry.npmjs.org"));
23
- return true;
22
+ console.log(chalk.yellow(`如无法自动更新,请使用命令更新:npm install -g cloudcc-cli@${onlineVersion} --registry https://registry.npmjs.org`));
23
+ return onlineVersion;
24
24
  }
25
- return false;
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
- if (checkNpmVersion()) {
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
- version = version.split("-V")[1]
27
- console.log("version 2", version);
28
- // 改变版本号
29
- version = changeVersion.change(version, item)
30
- console.log("version 3", version);
31
- // 生成最后的版本号
32
- item = item + "-V" + version
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
  }