cloudcc-cli 1.4.7 → 1.4.9

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,18 @@
1
+ # ReleaseV1.4.9
2
+ #### 发布日期:2023-8-23
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 迭代
6
+ * 打包生成版本信息的json文件,内容格式优化
7
+
8
+
9
+ # ReleaseV1.4.8
10
+ #### 发布日期:2023-8-23
11
+ #### 发布范围:全量
12
+ #### 发布内容
13
+ * 迭代
14
+ * 打包生成版本信息的json文件
15
+
1
16
  # ReleaseV1.4.7
2
17
  #### 发布日期:2023-8-3
3
18
  #### 发布范围:全量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
@@ -22,6 +22,8 @@ const dayjs = require("dayjs")
22
22
  const { updatei18n, askI18n } = require("../utils/updatei18n")
23
23
  // 部署脚本
24
24
  const { deploy } = require("../utils/deploy")
25
+ // 创建版本信息
26
+ const { writeVersion } = require("../utils/writeVersion")
25
27
  /**
26
28
  * 项目打包发布脚本
27
29
  */
@@ -101,6 +103,9 @@ class Publish {
101
103
  }
102
104
  // 4:开始打包
103
105
  this.build(condition)
106
+
107
+ // 7:写入版本信息
108
+ // writeVersion("sdf", condition.type, projectConfig, this.user);
104
109
  }
105
110
  }
106
111
 
@@ -196,7 +201,7 @@ class Publish {
196
201
  }
197
202
  try {
198
203
  // 7:写入版本信息
199
- this.writeVersion(version, condition.type);
204
+ writeVersion(version, condition.type, projectConfig, this.user);
200
205
  } catch (error) {
201
206
  console.log(chalk.red("版本信息写入异常:" + error))
202
207
  }
@@ -212,49 +217,6 @@ class Publish {
212
217
  console.log();
213
218
  }
214
219
  }
215
-
216
- /**
217
- * 将版本信息写入文件
218
- * @param {版本信息} version
219
- */
220
- writeVersion(version, type) {
221
- try {
222
- // 获得分支信息
223
- let branch = execSync('git branch --show-current');
224
- branch = branch.toString("utf8").trim();
225
- let versionInfo =
226
- `
227
- <!DOCTYPE html>
228
- <html lang="en">
229
-
230
- <head>
231
- <meta charset="UTF-8">
232
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
233
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
234
- <title>版本信息</title>
235
- </head>
236
-
237
- <body>
238
- <div style="font-size: 20px">
239
- <div>${projectConfig.name}</div>
240
- <div style="margin-left:48px">
241
- <div>版本:${version}</div>
242
- <div>时间:${dayjs().format('YYYY-MM-DD HH:mm:ss')}</div>
243
- <div>人员:${this.user}</div>
244
- <div>分支:${branch}</div>
245
- <div>标签:${type}</div>
246
- </div>
247
- </div>
248
- </body>
249
-
250
- </html>
251
- `
252
- fs.writeFileSync("dist/version.html", versionInfo, 'utf-8');
253
- return true
254
- } catch (error) {
255
- return false
256
- }
257
- };
258
220
  }
259
221
 
260
222
  module.exports = Publish;
@@ -15,7 +15,7 @@ const { getNewVersionName, pushCodeAndTags } = require("../utils/pushCode")
15
15
  // 触发构建器
16
16
  const { jenkins } = require("../utils/trigger")
17
17
  // 通知飞书
18
- const { notifyFeishu, notifyDingDing } = require("../utils/notifyIM")
18
+ const {notifyDingDing } = require("../utils/notifyIM")
19
19
  // 时间库
20
20
  const dayjs = require("dayjs")
21
21
  /**
@@ -203,6 +203,11 @@ class Publish {
203
203
  </html>
204
204
  `
205
205
  fs.writeFileSync(outPath + "/version.html", versionInfo, 'utf-8');
206
+
207
+ let versionInfoJson =
208
+ `{"projectName":"${projectConfig.name}","版本":"${version}","时间":"${dayjs().format('YYYY-MM-DD HH:mm:ss')}","人员":"${user}","分支":"${branch}","标签":"${type}"}`
209
+ fs.writeFileSync(outPath + "/version.json", versionInfoJson, 'utf-8');
210
+
206
211
  return true
207
212
  } catch (error) {
208
213
  return false
@@ -0,0 +1,55 @@
1
+ // 时间库
2
+ const dayjs = require("dayjs")
3
+ // 文件编辑对象
4
+ const fs = require("fs")
5
+ const { execSync } = require('child_process');
6
+ /**
7
+ * 将版本信息写入文件
8
+ * @param {版本信息} version
9
+ */
10
+ module.exports = {
11
+ writeVersion(version, type, projectConfig, user) {
12
+ try {
13
+ // 获得分支信息
14
+ let branch = execSync('git branch --show-current');
15
+ branch = branch.toString("utf8").trim();
16
+ let versionInfo =
17
+ `
18
+ <!DOCTYPE html>
19
+ <html lang="en">
20
+
21
+ <head>
22
+ <meta charset="UTF-8">
23
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
24
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
25
+ <title>版本信息</title>
26
+ </head>
27
+
28
+ <body>
29
+ <div style="font-size: 20px">
30
+ <div>${projectConfig.name}</div>
31
+ <div style="margin-left:48px">
32
+ <div>版本:${version}</div>
33
+ <div>时间:${dayjs().format('YYYY-MM-DD HH:mm:ss')}</div>
34
+ <div>人员:${user}</div>
35
+ <div>分支:${branch}</div>
36
+ <div>标签:${type}</div>
37
+ </div>
38
+ </div>
39
+ </body>
40
+
41
+ </html>
42
+ `
43
+ fs.writeFileSync("dist/version.html", versionInfo, 'utf-8');
44
+
45
+ let versionInfoJson =
46
+ `{"serviceName":"${projectConfig.name}","status":"OK","codeVersion":"${projectConfig.codeVersion + version}","serviceType":"${projectConfig.serviceType}"}`
47
+ fs.mkdirSync("dist/ccmonitor", { recursive: true });
48
+ fs.writeFileSync("dist/ccmonitor/sck", versionInfoJson, 'utf-8');
49
+ return true
50
+ } catch (error) {
51
+ console.log(error)
52
+ return false
53
+ }
54
+ }
55
+ }