cloudcc-cli 0.4.3 → 0.4.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 CHANGED
@@ -1,3 +1,27 @@
1
+ # ReleaseV0.4.7
2
+ #### 发布日期:2021-10-19
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 修复:修复触发构建提示语
6
+
7
+ # ReleaseV0.4.6
8
+ #### 发布日期:2021-10-19
9
+ #### 发布范围:全量
10
+ #### 发布内容
11
+ * 修复:触发dev地址修复
12
+
13
+ # ReleaseV0.4.5
14
+ #### 发布日期:2021-10-18
15
+ #### 发布范围:全量
16
+ #### 发布内容
17
+ * 迭代:增加触发自动化部署的命令:ltntestproduction
18
+
19
+ # ReleaseV0.4.4
20
+ #### 发布日期:2021-10-18
21
+ #### 发布范围:全量
22
+ #### 发布内容
23
+ * 迭代:增加触发自动化部署的命令:ltndev,ltnuat,cloudcc-ui
24
+
1
25
  # ReleaseV0.4.3
2
26
  #### 发布日期:2021-10-8
3
27
  #### 发布范围:全量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "0.4.3",
3
+ "version": "0.4.7",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
@@ -20,7 +20,7 @@
20
20
  "publish-lib": "npm publish --registry https://registry.npmjs.org"
21
21
  },
22
22
  "dependencies": {
23
- "axios": "^0.21.1",
23
+ "axios": "^0.21.4",
24
24
  "boxen": "^4.0.0",
25
25
  "chalk": "^2.4.2",
26
26
  "crypto-js": "^4.1.1",
package/src/publish.js CHANGED
@@ -4,6 +4,9 @@ const chalk = require("chalk")
4
4
  const fs = require("fs")
5
5
  const changeVersion = require("../utils/changeVersion")
6
6
  const config = require("../package.json")
7
+ const { get } = require('../utils/http');
8
+ const triggerConfig = require("./triggerConfig.json")
9
+ const projectConfig = JSON.parse(fs.readFileSync('package.json', 'utf8'))
7
10
 
8
11
  class Publish {
9
12
  constructor() {
@@ -30,8 +33,7 @@ class Publish {
30
33
  if (types && types.length > 0) {
31
34
  this.writeVersion(types[0]);
32
35
  console.log();
33
- console.log("发布版本类型:", condition.types);
34
- console.log("Tags设置名称:", [...condition.types, ...types]);
36
+ console.log("Tags名称:", [...condition.types, ...types]);
35
37
  this.pushCode(condition.types, types);
36
38
  } else {
37
39
  console.log();
@@ -143,17 +145,18 @@ class Publish {
143
145
  };
144
146
  /**
145
147
  * 发布代码
146
- * @param {发布类型} types
147
- * @param {发布版本} versions
148
+ * @param {发布类型} types:Dev,uat,Release
149
+ * @param {发布版本} versions:Dev-V12.0.0
148
150
  * @returns
149
151
  */
150
- pushCode(types, versions) {
152
+ async pushCode(types, versions) {
151
153
  try {
152
154
  console.log(chalk.green('开始编译,请稍后...'));
153
155
  // 打包命令
154
156
  try {
155
157
  exec('npm run build');
156
158
  } catch (error) {
159
+ console.log("error", error.toString("utf8").trim());
157
160
  console.log(chalk.red('请提供build打包命令'));
158
161
  return;
159
162
  }
@@ -232,13 +235,27 @@ class Publish {
232
235
  exec("git push origin --tags")
233
236
  console.log(chalk.green('Tag设置成功!'));
234
237
  console.log();
235
- console.log(chalk.green('发布完成!'));
236
238
 
239
+ console.log(chalk.green('开始触发构建,请稍等...'));
240
+ types.map((type) => {
241
+ this.triggerBuild(projectConfig.name, type)
242
+ })
237
243
  } catch (error) {
238
244
  console.log(chalk.red('发布失败:' + error));
239
245
  }
240
246
  return;
241
247
  }
248
+ /**
249
+ * 触发代码构建
250
+ */
251
+ async triggerBuild(packageName, type) {
252
+ let trigger = triggerConfig[packageName + "-" + type]
253
+ if (trigger) {
254
+ await get(trigger);
255
+ console.log();
256
+ console.log(chalk.green(type + '版本,开始构建,请注意查看飞书通知。'));
257
+ }
258
+ }
242
259
  }
243
260
 
244
261
  module.exports = Publish;
@@ -0,0 +1,6 @@
1
+ {
2
+ "CloudCC-Dev": "http://cloudcc:a83289c3830900a27bb2f1a0046fb309@test.publish.cloudcc.com/view/test%20micro%20service/job/ltndev.cloudcc.com/build?token=cloudcc-ltndev",
3
+ "CloudCC-Beta": "http://cloudcc:a83289c3830900a27bb2f1a0046fb309@test.publish.cloudcc.com/view/test%20micro%20service/job/ltndev.cloudcc.com/build?token=cloudcc-ltnuat",
4
+ "CloudCC-Release": "http://cloudcc:a83289c3830900a27bb2f1a0046fb309@test.publish.cloudcc.com/view/test%20micro%20service/job/ltndev.cloudcc.com/build?token=cloudcc-release",
5
+ "cloudcc-ui-Release": "http://cloudcc:a83289c3830900a27bb2f1a0046fb309@test.publish.cloudcc.com/view/test%20micro%20service/job/ccui.cloudcc.com(CCWEB%E7%BB%84%E4%BB%B6%E5%BA%93)/build?token=cloudcc-ui"
6
+ }
package/utils/http.js CHANGED
@@ -35,7 +35,9 @@ service.interceptors.response.use(
35
35
  }
36
36
  )
37
37
  const formateData = (data, header) => {
38
- Object.assign(header, { source: "cloudcc_cli" })
38
+ if (header) {
39
+ Object.assign(header, { source: "cloudcc_cli" })
40
+ }
39
41
  return {
40
42
  head: {
41
43
  ...header