cloudcc-cli 1.4.6 → 1.4.8

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,17 @@
1
+ # ReleaseV1.4.8
2
+ #### 发布日期:2023-8-23
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 迭代
6
+ * 打包生成版本信息的json文件
7
+
8
+ # ReleaseV1.4.7
9
+ #### 发布日期:2023-8-3
10
+ #### 发布范围:全量
11
+ #### 发布内容
12
+ * 迭代
13
+ * 优化H5打包生成的version问题
14
+
1
15
  # ReleaseV1.4.6
2
16
  #### 发布日期:2023-8-3
3
17
  #### 发布范围:全量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
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
  */
@@ -196,7 +198,7 @@ class Publish {
196
198
  }
197
199
  try {
198
200
  // 7:写入版本信息
199
- this.writeVersion(version, condition.type);
201
+ writeVersion(version, condition.type, projectConfig, this.user);
200
202
  } catch (error) {
201
203
  console.log(chalk.red("版本信息写入异常:" + error))
202
204
  }
@@ -212,49 +214,6 @@ class Publish {
212
214
  console.log();
213
215
  }
214
216
  }
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
217
  }
259
218
 
260
219
  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
  /**
@@ -123,7 +123,7 @@ class Publish {
123
123
 
124
124
  try {
125
125
  // 6:写入版本信息
126
- this.writeVersion(version, outPath);
126
+ this.writeVersion(version, outPath, condition.type);
127
127
  } catch (error) {
128
128
  console.log(chalk.red("版本信息写入异常:" + error))
129
129
  }
@@ -166,22 +166,15 @@ class Publish {
166
166
  })
167
167
  }
168
168
  /**
169
- * 将版本信息写入文件
170
- * @param {版本信息} version
171
- * @param {输出路径} outPath
172
- */
173
- writeVersion(version, outPath = "dist") {
169
+ * 将版本信息写入文件
170
+ * @param {版本信息} version
171
+ * @param {输出路径} outPath
172
+ */
173
+ writeVersion(version, outPath, type) {
174
174
  try {
175
175
  // 获得分支信息
176
176
  let branch = execSync('git branch --show-current');
177
177
  branch = branch.toString("utf8").trim();
178
- // 获得提交版本信息
179
- var gitHEAD = fs.readFileSync('.git/HEAD', 'utf-8').trim()
180
- var ref = gitHEAD.split(': ')[1]
181
- var develop = gitHEAD.split('/')[2]
182
- var gitVersion = fs.readFileSync('.git/' + ref, 'utf-8').trim()
183
- var gitCommitVersion = '"' + develop + ': ' + gitVersion + '"'
184
-
185
178
  let versionInfo =
186
179
  `
187
180
  <!DOCTYPE html>
@@ -210,6 +203,11 @@ class Publish {
210
203
  </html>
211
204
  `
212
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
+
213
211
  return true
214
212
  } catch (error) {
215
213
  return false
@@ -0,0 +1,54 @@
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
+ console.log("start")
13
+ try {
14
+ // 获得分支信息
15
+ let branch = execSync('git branch --show-current');
16
+ branch = branch.toString("utf8").trim();
17
+ let versionInfo =
18
+ `
19
+ <!DOCTYPE html>
20
+ <html lang="en">
21
+
22
+ <head>
23
+ <meta charset="UTF-8">
24
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
25
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
26
+ <title>版本信息</title>
27
+ </head>
28
+
29
+ <body>
30
+ <div style="font-size: 20px">
31
+ <div>${projectConfig.name}</div>
32
+ <div style="margin-left:48px">
33
+ <div>版本:${version}</div>
34
+ <div>时间:${dayjs().format('YYYY-MM-DD HH:mm:ss')}</div>
35
+ <div>人员:${user}</div>
36
+ <div>分支:${branch}</div>
37
+ <div>标签:${type}</div>
38
+ </div>
39
+ </div>
40
+ </body>
41
+
42
+ </html>
43
+ `
44
+ fs.writeFileSync("dist/version.html", versionInfo, 'utf-8');
45
+
46
+ let versionInfoJson =
47
+ `{"projectName":"${projectConfig.name}","版本":"${version}","时间":"${dayjs().format('YYYY-MM-DD HH:mm:ss')}","人员":"${user}","分支":"${branch}","标签":"${type}"}`
48
+ fs.writeFileSync("dist/version.json", versionInfoJson, 'utf-8');
49
+ return true
50
+ } catch (error) {
51
+ return false
52
+ }
53
+ }
54
+ }