cloudcc-cli 0.9.1 → 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,11 @@
1
+ # ReleaseV0.9.2
2
+ #### 发布日期:2021-11-30
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 优化
6
+ * 删除dist文件夹然后提交
7
+
8
+
1
9
  # ReleaseV0.9.1
2
10
  #### 发布日期:2021-11-29
3
11
  #### 发布范围:全量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
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,47 +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
- let versions = version.split("\n");
111
- // 取出第一个包含-V的版本号
112
- version = versions.find((item) => {
113
- return item.includes("-V");
114
- })
115
- console.log("version 1", version);
116
- // 取版本号
117
- version = version.split("-V")[1]
118
- console.log("version 2", version);
119
- // 改变版本号
120
- version = changeVersion.change(version, item)
121
- console.log("version 3", version);
122
- // 生成最后的版本号
123
- item = item + "-V" + version
124
- } else {
125
- item = item + "-V0.0.1"
126
- }
127
- return item;
128
- })
129
- }
133
+ function deleteDist() {
134
+
135
+ try {
136
+ // 删除dist文件夹
137
+ exec("git rm -r dist")
138
+ } catch (error) {
130
139
 
140
+ }
141
+
142
+ try {
143
+ // 添加改变文件
144
+ exec("git add .")
145
+ } catch (error) {
146
+
147
+ }
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
+ }
131
162
  /**
132
163
  * 发布代码同时设置Tags
133
164
  * @param {types} 版本集合
134
165
  */
135
166
  function pushCodeAndTags(types = []) {
136
167
  let versions = getNewVersionName(types);
137
-
138
- return push(versions[0]) && setTag(types, versions)
168
+ return push(versions[0]) && setTag(types, versions) && deleteDist(versions[0]);
139
169
  }
140
170
  module.exports = { pushCodeAndTags, push, getNewVersionName, setTag }