cloudcc-cli 0.8.9 → 0.9.3

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.3
2
+ #### 发布日期:2021-12-10
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 优化
6
+ * 更新cc-sdk上传地址
7
+
8
+ # ReleaseV0.9.2
9
+ #### 发布日期:2021-11-30
10
+ #### 发布范围:全量
11
+ #### 发布内容
12
+ * 优化
13
+ * 删除dist文件夹然后提交
14
+
15
+
16
+ # ReleaseV0.9.1
17
+ #### 发布日期:2021-11-29
18
+ #### 发布范围:全量
19
+ #### 发布内容
20
+ * 优化
21
+ * 优化获取版本号逻辑
22
+
23
+ # ReleaseV0.9.0
24
+ #### 发布日期:2021-11-26
25
+ #### 发布范围:全量
26
+ #### 发布内容
27
+ * 迭代
28
+ * GA移除大版本升级
29
+
1
30
  # ReleaseV0.8.9
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.9",
3
+ "version": "0.9.3",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
package/src/builderSDK.js CHANGED
@@ -44,10 +44,10 @@ class Builder {
44
44
  message: '请选择发布版本:',
45
45
  name: 'types',
46
46
  choices: [
47
- { name: "测试环境-Dev", value: "dev" },
48
- { name: "uat环境-Beta", value: "beta" },
49
- { name: "公司环境-GA", value: "ga" },
50
47
  { name: "客户环境-Release", value: "release" },
48
+ { name: "公司环境-GA", value: "ga" },
49
+ { name: "uat环境-Beta", value: "beta" },
50
+ { name: "测试环境-Dev", value: "dev" },
51
51
  ],
52
52
  }, {
53
53
  type: "input",
@@ -125,7 +125,7 @@ class Builder {
125
125
  {
126
126
  "fileName": obj.type + "/" + obj.sdkName + ".umd.min.js",
127
127
  "fileContent": jsContent,
128
- "bucketName": "cc-sdk",
128
+ "bucketName": "cloudcc-sdk",
129
129
  }
130
130
  )
131
131
  let res = await post(this.options.devConsoleConfig.baseUrl + "/devconsole/cdn/uploadFile",
@@ -137,11 +137,10 @@ class Builder {
137
137
  console.error(chalk.red(`发布失败: ${res.returnInfo}`));
138
138
  console.log();
139
139
  }
140
+
140
141
  return res;
141
142
  }
142
143
 
143
-
144
-
145
144
  /**
146
145
  * 过滤出min.js文件
147
146
  * @returns 过滤结果
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", "Beta", "RC"];
11
+ const updateLast = ["Dev", "Beta", "GA", "RC"];
12
12
 
13
13
  function change(version, type) {
14
14
  if (version) {
@@ -18,6 +18,8 @@ function checkNpmVersion() {
18
18
  console.log();
19
19
  console.log(chalk.green("当前版本:v" + config.version));
20
20
  console.log(chalk.green("最新版本:v" + onlineVersion));
21
+ console.log();
22
+ console.log(chalk.yellow("如无法自动更新,请使用命令更新:npm install -g cloudcc-cli --registry https://registry.npmjs.org"));
21
23
  return true;
22
24
  }
23
25
  return false;
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 }