cloudcc-cli 0.8.8 → 0.9.2

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,32 @@
1
+ # ReleaseV0.9.2
2
+ #### 发布日期:2021-11-30
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 优化
6
+ * 删除dist文件夹然后提交
7
+
8
+
9
+ # ReleaseV0.9.1
10
+ #### 发布日期:2021-11-29
11
+ #### 发布范围:全量
12
+ #### 发布内容
13
+ * 优化
14
+ * 优化获取版本号逻辑
15
+
16
+ # ReleaseV0.9.0
17
+ #### 发布日期:2021-11-26
18
+ #### 发布范围:全量
19
+ #### 发布内容
20
+ * 迭代
21
+ * GA移除大版本升级
22
+
23
+ # ReleaseV0.8.9
24
+ #### 发布日期:2021-11-26
25
+ #### 发布范围:全量
26
+ #### 发布内容
27
+ * 修复
28
+ * 无法识别uat环境
29
+
1
30
  # ReleaseV0.8.8
2
31
  #### 发布日期:2021-11-26
3
32
  #### 发布范围:全量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "0.8.8",
3
+ "version": "0.9.2",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
package/test/test.js CHANGED
@@ -1,4 +1,6 @@
1
-
2
- const dayjs = require("dayjs")
3
-
4
- console.log(dayjs().format('YYYY-MM-DD HH:mm:ss'));
1
+ let versions = ["A-V", "bbbb-V", "B", "C", "D"]
2
+ let version;
3
+ version = versions.find((item) => {
4
+ return item.includes("-V");
5
+ })
6
+ console.log(version);
@@ -5,10 +5,10 @@
5
5
  * @returns 新的版本号
6
6
  */
7
7
  // 需要更新第二位
8
- const updateSecond = ["Release", "GA"];
8
+ const updateSecond = ["Release"];
9
9
 
10
10
  // 需要更新第三位
11
- const updateLast = ["Dev", "uat", "RC"];
11
+ const updateLast = ["Dev", "Beta", "GA", "RC"];
12
12
 
13
13
  function change(version, type) {
14
14
  if (version) {
package/utils/pushCode.js CHANGED
@@ -4,6 +4,38 @@
4
4
  const exec = require('child_process').execSync;
5
5
  const chalk = require("chalk")
6
6
  const changeVersion = require("../utils/changeVersion")
7
+ /**
8
+ * 更改版本version
9
+ * @param {types} 版本类型,如Dev、uat,GA,Release
10
+ */
11
+ function getNewVersionName(types) {
12
+ exec("git fetch --tags -f")
13
+ return types.map((item) => {
14
+ // 更新本地tag
15
+ let version = exec(`git tag --sort=-committerdate`)
16
+ version = version.toString("utf8").trim();
17
+ if (version) {
18
+ // 使用换行分隔下
19
+ let versions = version.split("\n");
20
+ // 取出第一个包含-V的版本号
21
+ version = versions.find((item) => {
22
+ return item.includes("-V");
23
+ })
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
33
+ } else {
34
+ item = item + "-V0.0.1"
35
+ }
36
+ return item;
37
+ })
38
+ }
7
39
 
8
40
  /**
9
41
  * 将代码推送至gitlab
@@ -94,43 +126,45 @@ function setTag(types, versions) {
94
126
  console.log();
95
127
  return true;
96
128
  }
97
-
98
129
  /**
99
- * 更改版本version
100
- * @param {types} 版本类型,如Dev、uat,GA,Release
130
+ * 删除dist文件夹
131
+ * @returns true 成功,false 失败
101
132
  */
102
- function getNewVersionName(types) {
103
- exec("git fetch --tags -f")
104
- return types.map((item) => {
105
- // 更新本地tag
106
- let version = exec(`git tag --sort=-committerdate`)
107
- version = version.toString("utf8").trim();
108
- if (version) {
109
- // 获取第一个版本号
110
- version = version.split("\n")[1]
111
- console.log("version 1", version);
112
- // 取版本号
113
- version = version.split("-V")[1]
114
- console.log("version 2", version);
115
- // 改变版本号
116
- version = changeVersion.change(version, item)
117
- console.log("version 3", version);
118
- // 生成最后的版本号
119
- item = item + "-V" + version
120
- } else {
121
- item = item + "-V0.0.1"
122
- }
123
- return item;
124
- })
125
- }
133
+ function deleteDist() {
134
+
135
+ try {
136
+ // 删除dist文件夹
137
+ exec("git rm -r dist")
138
+ } catch (error) {
139
+
140
+ }
141
+
142
+ try {
143
+ // 添加改变文件
144
+ exec("git add .")
145
+ } catch (error) {
146
+
147
+ }
126
148
 
149
+ try {
150
+ // 提交到本地
151
+ exec("git commit -m clear-dist")
152
+ } catch (error) {
153
+ }
154
+ try {
155
+ // 推送到服务器
156
+ exec("git push")
157
+ } catch (error) {
158
+
159
+ }
160
+ return true;
161
+ }
127
162
  /**
128
163
  * 发布代码同时设置Tags
129
164
  * @param {types} 版本集合
130
165
  */
131
166
  function pushCodeAndTags(types = []) {
132
167
  let versions = getNewVersionName(types);
133
-
134
- return push(versions[0]) && setTag(types, versions)
168
+ return push(versions[0]) && setTag(types, versions) && deleteDist(versions[0]);
135
169
  }
136
170
  module.exports = { pushCodeAndTags, push, getNewVersionName, setTag }