cloudcc-cli 1.3.2 → 1.3.4

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,21 @@
1
+ # ReleaseV1.3.4
2
+ #### 发布日期:2023-2-21
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 迭代
6
+ * 增加并发打包策略
7
+ * 更新日志自动更新版本和日期
8
+ * version文件中添加更新日志内容
9
+ * 优化
10
+
11
+ # ReleaseV1.3.3
12
+ #### 发布日期:2023-2-17
13
+ #### 发布范围:全量
14
+ #### 发布内容
15
+ * 迭代
16
+ * 添加组件自动销毁功能,默认5分钟销毁。
17
+ * 优化
18
+
1
19
  # ReleaseV1.3.2
2
20
  #### 发布日期:2023-2-15
3
21
  #### 发布范围:全量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
@@ -36,4 +36,4 @@
36
36
  "vue-custom-element": "^3.3.0",
37
37
  "vue-template-compiler": "^2.6.14"
38
38
  }
39
- }
39
+ }
@@ -124,7 +124,7 @@ class Builder {
124
124
  Vue.use(VueCustomElement);
125
125
 
126
126
  import index from "./` + buildFileName + `"
127
- Vue.customElement('`+ component + `', index,{ destroyTimeout: null });
127
+ Vue.customElement('`+ component + `', index,{ destroyTimeout: ${this.options.devConsoleConfig.destroyTimeout || 5 * 60 * 1000} });
128
128
  `
129
129
 
130
130
  fs.writeFileSync(`plugin/${plginTemp}.js`, newContent);
@@ -82,18 +82,7 @@ class Publish {
82
82
  console.log()
83
83
  }
84
84
 
85
- // 3:获取新的发布版本号
86
- let version = getNewVersionName([condition.type])
87
- console.log();
88
- console.log(chalk.green('待发布版本:' + version));
89
- console.log();
90
- // 3.1:将版本信息写入env文件中,公其他业务使用
91
- try {
92
- fs.writeFileSync(".env.production", "VUE_APP_PROJECT_VERSION = " + condition.type + "-" + version, 'utf-8')
93
- } catch (error) {
94
- }
95
-
96
- // 4:如果存在多语言配置,则更新多语言
85
+ // 3:如果存在多语言配置,则更新多语言
97
86
  if (projectConfig.config && projectConfig.config["language-config"]) {
98
87
  // 获得命令行多语言参数
99
88
  let i18n = this.args.get("language")
@@ -111,14 +100,60 @@ class Publish {
111
100
  }
112
101
  }
113
102
 
114
- // 5:开始打包
115
- this.build(condition, version)
103
+
104
+ // 4:开始打包
105
+ this.build(condition)
116
106
  }
117
107
  }
118
108
  /**
119
109
  * 编译成功回调
120
110
  */
121
- buildSucess(condition, version) {
111
+ buildSucess(condition) {
112
+ // 5:获取新的发布版本号
113
+ let version = getNewVersionName([condition.type])
114
+ // 5.1:将版本信息写入env文件中,公其他业务使用
115
+ try {
116
+ fs.writeFileSync(".env.production", "VUE_APP_PROJECT_VERSION = " + condition.type + "-" + version, 'utf-8')
117
+ } catch (error) {
118
+ }
119
+
120
+ // 5.2:更新日志文档添加发布日期
121
+ // 获得分支信息
122
+ let branch = execSync('git rev-parse --abbrev-ref HEAD');
123
+ branch = branch.toString("utf8").trim();
124
+ const datas = fs.readFileSync("README.md", 'utf-8').split("\n")
125
+ let data = ""
126
+ datas.map((item, index) => {
127
+ if (0 == index) {
128
+ data = data + `#### 发布版本:${version}` + "\n"
129
+ data = data + `#### 发布时间:${dayjs().format('YYYY-MM-DD HH:mm:ss')}` + "\n"
130
+ data = data + `#### 发布人员:${this.user}` + "\n"
131
+ data = data + `#### 发布分支:${branch}` + "\n"
132
+ data = data + `#### 发布标签:${condition.type}` + "\n"
133
+ if (!item.startsWith("#### 发布版本")) {
134
+ data = data + item + "\n"
135
+ }
136
+ } else if (1 == index) {
137
+ if (!item.startsWith("#### 发布时间")) {
138
+ data = data + item + "\n"
139
+ }
140
+ } else if (2 == index) {
141
+ if (!item.startsWith("#### 发布人员")) {
142
+ data = data + item + "\n"
143
+ }
144
+ } else if (3 == index) {
145
+ if (!item.startsWith("#### 发布分支")) {
146
+ data = data + item + "\n"
147
+ }
148
+ } else if (4 == index) {
149
+ if (!item.startsWith("#### 发布标签")) {
150
+ data = data + item + "\n"
151
+ }
152
+ } else {
153
+ data = data + item + "\n"
154
+ }
155
+ })
156
+ fs.writeFileSync("README.md", data)
122
157
  // 6:将readme生成为html,并复制到dist中
123
158
  let outPath = "dist"
124
159
  // 读取配置,是否改变了输出路径
@@ -127,20 +162,12 @@ class Publish {
127
162
  }
128
163
  try {
129
164
  // 设置readme文件位置
130
- change("README", outPath);
165
+ change("README", outPath,"version");
131
166
  } catch (error) {
132
167
  console.log(chalk.red("README写入异常:" + error))
133
168
  }
134
-
135
- try {
136
- // 7:写入版本信息
137
- this.writeVersion(version,condition.type);
138
- } catch (error) {
139
- console.log(chalk.red("版本信息写入异常:" + error))
140
- }
141
-
142
169
  // 8:发布代码并设置tags,触发发布,飞书提醒
143
- if (pushCodeAndTags([condition.type], this.args.get("update"))) {
170
+ if (pushCodeAndTags(version, [condition.type], this.args.get("update"))) {
144
171
  if (projectConfig && projectConfig.config) {
145
172
  jenkins(projectConfig.config["jenkins-" + condition.type])
146
173
  }
@@ -171,13 +198,13 @@ class Publish {
171
198
  } else {
172
199
  console.log(chalk.green('编译成功!'));
173
200
  console.log();
174
- that.buildSucess(condition, version);
201
+ that.buildSucess(condition);
175
202
  }
176
203
  })
177
204
  } else {
178
205
  console.log(chalk.green('编译成功!'));
179
206
  console.log();
180
- that.buildSucess(condition, version);
207
+ that.buildSucess(condition);
181
208
  }
182
209
  })
183
210
 
@@ -186,18 +213,11 @@ class Publish {
186
213
  * 将版本信息写入文件
187
214
  * @param {版本信息} version
188
215
  */
189
- writeVersion(version,type) {
216
+ writeVersion(version, type) {
190
217
  try {
191
218
  // 获得分支信息
192
219
  let branch = execSync('git rev-parse --abbrev-ref HEAD');
193
220
  branch = branch.toString("utf8").trim();
194
- // 获得提交版本信息
195
- var gitHEAD = fs.readFileSync('.git/HEAD', 'utf-8').trim()
196
- var ref = gitHEAD.split(': ')[1]
197
- var develop = gitHEAD.split('/')[2]
198
- var gitVersion = fs.readFileSync('.git/' + ref, 'utf-8').trim()
199
- var gitCommitVersion = '"' + develop + ': ' + gitVersion + '"'
200
-
201
221
  let versionInfo =
202
222
  `
203
223
  <!DOCTYPE html>
@@ -214,12 +234,11 @@ class Publish {
214
234
  <div style="font-size: 20px">
215
235
  <div>${projectConfig.name}</div>
216
236
  <div style="margin-left:48px">
237
+ <div>版本:${version}</div>
238
+ <div>时间:${dayjs().format('YYYY-MM-DD HH:mm:ss')}</div>
239
+ <div>人员:${this.user}</div>
217
240
  <div>分支:${branch}</div>
218
241
  <div>标签:${type}</div>
219
- <div>版本号:${version}</div>
220
- <div>提交Hash:${gitCommitVersion}</div>
221
- <div>发布时间:${dayjs().format('YYYY-MM-DD HH:mm:ss')}</div>
222
- <div>发布人员:${this.user}</div>
223
242
  </div>
224
243
  </div>
225
244
  </body>
package/utils/md2html.js CHANGED
@@ -24,7 +24,7 @@ function watchFile(target) {
24
24
  * @param {target} 编译文件名称
25
25
  * @param {outPath} 保存路径
26
26
  */
27
- function change(target = "README", outPath = "dist") {
27
+ function change(target = "README", outPath = "dist", outFile = "README") {
28
28
  //读取文件
29
29
  const data = fs.readFileSync(target + ".md", 'utf-8')
30
30
  const html = marked(data); //将md内容转为html内容
@@ -33,7 +33,7 @@ function change(target = "README", outPath = "dist") {
33
33
 
34
34
  let css = fs.readFileSync(path.join(__dirname) + '/github-markdown.min.css', 'utf8')
35
35
  template = template.replace('{{{style}}}', css); //替换css内容占位标记
36
- createFile(template, target, outPath);
36
+ createFile(template, outPath, outFile);
37
37
 
38
38
  }
39
39
  /**
@@ -77,9 +77,9 @@ function createTemplate() {
77
77
  * 创建html文件
78
78
  * @param {string} content 写入html的文件内容
79
79
  */
80
- function createFile(content, fileName, outPath = "public") {
80
+ function createFile(content, outPath = "dist", outFile) {
81
81
  const suffix = 'html'; //文件格式
82
- const fullName = fileName + '.' + suffix; //文件全名
82
+ const fullName = outFile + '.' + suffix; //文件全名
83
83
  const file = path.join(outPath, fullName); //文件地址
84
84
  fs.writeFileSync(file, content, 'utf-8')
85
85
  }
package/utils/pushCode.js CHANGED
@@ -180,8 +180,7 @@ function deleteDist() {
180
180
  * @param {types} 版本集合
181
181
  * @param {update} 是否强制更新
182
182
  */
183
- function pushCodeAndTags(types = [], update = "0") {
184
- let versions = getNewVersionName(types);
183
+ function pushCodeAndTags(versions, types = [], update = "0") {
185
184
  return push(versions[0], update) && setTag(types, versions) && deleteDist(versions[0]);
186
185
  }
187
186
  module.exports = { pushCodeAndTags, push, getNewVersionName, setTag }