cloudcc-cli 0.4.6 → 0.5.0

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,5 +1,30 @@
1
+ # ReleaseV0.5.0
2
+ #### 发布日期:2021-10-20
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 优化:替换打包命令提示
6
+
7
+ # ReleaseV0.4.9
8
+ #### 发布日期:2021-10-20
9
+ #### 发布范围:全量
10
+ #### 发布内容
11
+ * 迭代:增加测试群机器人通知
12
+ * 迭代:增加lightning-app自动部署
13
+
14
+ # ReleaseV0.4.8
15
+ #### 发布日期:2021-10-19
16
+ #### 发布范围:全量
17
+ #### 发布内容
18
+ * 修复:构建添加飞书机器人提醒
19
+
20
+ # ReleaseV0.4.7
21
+ #### 发布日期:2021-10-19
22
+ #### 发布范围:全量
23
+ #### 发布内容
24
+ * 修复:修复触发构建提示语
25
+
1
26
  # ReleaseV0.4.6
2
- #### 发布日期:2021-10-18
27
+ #### 发布日期:2021-10-19
3
28
  #### 发布范围:全量
4
29
  #### 发布内容
5
30
  * 修复:触发dev地址修复
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "0.4.6",
3
+ "version": "0.5.0",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
package/src/publish.js CHANGED
@@ -4,7 +4,7 @@ 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');
7
+ const { get, postParams } = require('../utils/http');
8
8
  const triggerConfig = require("./triggerConfig.json")
9
9
  const projectConfig = JSON.parse(fs.readFileSync('package.json', 'utf8'))
10
10
 
@@ -71,11 +71,13 @@ class Publish {
71
71
  { name: "uat环境-Beta", value: "Beta" },
72
72
  { name: "测试环境-Dev", value: "Dev" },
73
73
  ],
74
- }, {
75
- type: "input",
76
- name: "otherTags",
77
- message: "请输入其他Tag名称,使用空格分隔:",
78
- }];
74
+ }
75
+ // , {
76
+ // type: "input",
77
+ // name: "otherTags",
78
+ // message: "请输入其他Tag名称,使用空格分隔:",
79
+ // }
80
+ ];
79
81
  return inquirer.prompt(prompt)
80
82
  };
81
83
  /**
@@ -156,9 +158,11 @@ class Publish {
156
158
  try {
157
159
  exec('npm run build');
158
160
  } catch (error) {
159
- console.log("error", error.toString("utf8").trim());
160
- console.log(chalk.red('请提供build打包命令'));
161
- return;
161
+ // console.log("error", error.toString("utf8").trim());
162
+ console.log();
163
+ console.log(chalk.green('未找到bulid命令,已使用备用命令打包:npx vue-cli-service build'));
164
+ console.log();
165
+ exec('npx vue-cli-service build');
162
166
  }
163
167
 
164
168
  console.log(chalk.green('编译成功!'));
@@ -238,7 +242,7 @@ class Publish {
238
242
 
239
243
  console.log(chalk.green('开始触发构建,请稍等...'));
240
244
  types.map((type) => {
241
- this.triggerBuild(projectConfig.name, type)
245
+ this.triggerBuild(projectConfig.name, type, versions[0])
242
246
  })
243
247
  } catch (error) {
244
248
  console.log(chalk.red('发布失败:' + error));
@@ -248,14 +252,56 @@ class Publish {
248
252
  /**
249
253
  * 触发代码构建
250
254
  */
251
- async triggerBuild(packageName, type) {
255
+ async triggerBuild(packageName, type, version) {
252
256
  let trigger = triggerConfig[packageName + "-" + type]
253
257
  if (trigger) {
254
258
  await get(trigger);
255
259
  console.log();
256
- console.log(chalk.green(type + '版本,成功触发构建!'));
257
- console.log();
258
- console.log(chalk.green(type + '版本,发布完成'));
260
+ console.log(chalk.green(type + '版本开始构建,请注意查看飞书通知。'));
261
+ this.notifyFeishu(packageName, type, version)
262
+ }
263
+ }
264
+
265
+ /**
266
+ * 通知飞书群
267
+ */
268
+ async notifyFeishu(packageName, type, version) {
269
+ let triggers = triggerConfig["feishu-" + packageName + "-" + type]
270
+ if (triggers && triggers.length > 0) {
271
+ let body = {
272
+ "msg_type": "interactive",
273
+ "card": {
274
+ "config": {
275
+ "wide_screen_mode": true,
276
+ "enable_forward": true
277
+ },
278
+ "elements": [{
279
+ "tag": "markdown",
280
+ "content": "项目名称:" + packageName + "\nTag:" + type + "\n版本号:" + version
281
+ }, {
282
+ "actions": [{
283
+ "tag": "button",
284
+ "text": {
285
+ "content": "更新日志",
286
+ "tag": "lark_md"
287
+ },
288
+ "url": triggerConfig["doc-" + packageName + "-" + type],
289
+ "type": "default",
290
+ "value": {}
291
+ }],
292
+ "tag": "action"
293
+ }],
294
+ "header": {
295
+ "title": {
296
+ "content": "(测试测试)版本发布通知",
297
+ "tag": "plain_text"
298
+ }
299
+ }
300
+ }
301
+ }
302
+ await triggers.map((trigger) => {
303
+ postParams(trigger, body);
304
+ })
259
305
  }
260
306
  }
261
307
  }
@@ -263,4 +309,3 @@ class Publish {
263
309
  module.exports = Publish;
264
310
 
265
311
 
266
-
@@ -2,5 +2,21 @@
2
2
  "CloudCC-Dev": "http://cloudcc:a83289c3830900a27bb2f1a0046fb309@test.publish.cloudcc.com/view/test%20micro%20service/job/ltndev.cloudcc.com/build?token=cloudcc-ltndev",
3
3
  "CloudCC-Beta": "http://cloudcc:a83289c3830900a27bb2f1a0046fb309@test.publish.cloudcc.com/view/test%20micro%20service/job/ltndev.cloudcc.com/build?token=cloudcc-ltnuat",
4
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"
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
+ "lightning-app-Dev": "http://cloudcc:a83289c3830900a27bb2f1a0046fb309@test.publish.cloudcc.com/view/test%20micro%20service/job/ltnappdev.cloudcc.com/build?token=cloudcc-ltnappdev",
7
+
8
+ "feishu-CloudCC-Dev": [
9
+ "https://open.feishu.cn/open-apis/bot/v2/hook/c77c7f00-78a3-4603-824a-2fa4af70c3c3",
10
+ "https://open.feishu.cn/open-apis/bot/v2/hook/68bfe7c8-97d6-4d56-bea5-60a45d5ac472"
11
+ ],
12
+
13
+ "feishu-cloudcc-ui-Release": [
14
+ "https://open.feishu.cn/open-apis/bot/v2/hook/c77c7f00-78a3-4603-824a-2fa4af70c3c3",
15
+ "https://open.feishu.cn/open-apis/bot/v2/hook/68bfe7c8-97d6-4d56-bea5-60a45d5ac472"
16
+ ],
17
+
18
+ "doc-CloudCC-Dev": "http://gitlab.cloudcc.com/cloudcc-web-app/lightning-web/blob/cloudcc13/README.md",
19
+ "doc-CloudCC-Beta": "http://gitlab.cloudcc.com/cloudcc-web-app/lightning-web/blob/cloudcc13/README.md",
20
+ "doc-CloudCC-Release": "http://gitlab.cloudcc.com/cloudcc-web-app/lightning-web/blob/lightning-web-r99/README.md",
21
+ "doc-cloudcc-ui-Release": "http://gitlab.cloudcc.com/platform-web-app/cloudcc-ui/blob/master/README.md"
6
22
  }
package/test/test.js ADDED
@@ -0,0 +1,5 @@
1
+ const publish = require("../src/publish")
2
+
3
+ let pub = new publish()
4
+
5
+ pub.notifyFeishu("CloudCC", "Dev", "Dev-V12.0.0")