cloudcc-cli 1.6.5 → 1.6.6

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.
Files changed (46) hide show
  1. package/README.md +8 -0
  2. package/bin/cc.js +15 -15
  3. package/core/core/CCObject.java +48 -0
  4. package/core/core/CCService.java +806 -0
  5. package/core/core/CCTrigger.java +23 -0
  6. package/core/core/CCTriggerHandler.java +15 -0
  7. package/core/core/DevLogger.java +39 -0
  8. package/core/core/OperatationEnum.java +5 -0
  9. package/core/core/PeakInterf.java +6 -0
  10. package/core/core/PeakSvc.java +8 -0
  11. package/core/core/ServiceResult.java +35 -0
  12. package/core/core/TriggerInvoker.java +83 -0
  13. package/core/core/TriggerMethod.java +9 -0
  14. package/core/core/TriggerTimeEnum.java +5 -0
  15. package/core/core/UserInfo.java +45 -0
  16. package/core.zip +0 -0
  17. package/package.json +1 -1
  18. package/src/classes/create.js +5 -8
  19. package/src/classes/publish.js +8 -12
  20. package/src/config/get.js +1 -3
  21. package/src/config/use.js +1 -3
  22. package/src/object/get.js +4 -6
  23. package/src/plugin/create.js +10 -20
  24. package/src/plugin/create1.js +8 -16
  25. package/src/plugin/publish.js +44 -77
  26. package/src/plugin/publish1.js +42 -72
  27. package/src/project/create.js +12 -14
  28. package/src/project/create1.js +15 -17
  29. package/src/recordType/get.js +3 -6
  30. package/src/script/create.js +3 -6
  31. package/src/script/publish.js +10 -17
  32. package/src/timer/create.js +3 -6
  33. package/src/timer/publish.js +8 -12
  34. package/src/token/get.js +1 -3
  35. package/src/triggers/create.js +8 -16
  36. package/src/triggers/index.js +1 -1
  37. package/src/triggers/publish.js +10 -13
  38. package/template/index.js +10 -10
  39. package/template/indexvue +3 -3
  40. package/tool/branch/index.js +25 -0
  41. package/tool/checkLange/checkLang.js +68 -0
  42. package/tool/checkLange/clearLang.js +85 -0
  43. package/tool/checkLange/result.txt +0 -0
  44. package/utils/checkVersion.js +19 -30
  45. package/utils/http.js +5 -5
  46. package/utils/utils.js +19 -21
@@ -4,18 +4,16 @@ const fs = require('fs');
4
4
  const path = require("path")
5
5
  const chalk = require("chalk")
6
6
  const inquirer = require("inquirer")
7
- // 检查cli版本更新功能
7
+
8
8
  const { checkUpdate } = require("../../utils/checkVersion")
9
9
  const BaseUrl = "https://developer.apis.cloudcc.cn"
10
10
  const { getPackageJson } = require("../../utils/utils")
11
11
 
12
- /**
13
- * 自定义组件,组件打包命令,将组件打包发布到服务器。
14
- */
12
+
15
13
  class Builder {
16
14
  constructor() {
17
15
  this.options = {
18
- // 开发配置信息
16
+
19
17
  devConsoleConfig: {
20
18
  },
21
19
  }
@@ -26,18 +24,18 @@ class Builder {
26
24
  if (!res) {
27
25
  this.options.devConsoleConfig = getPackageJson();
28
26
  let config = this.options.devConsoleConfig
29
- // 如果不是私有化部署,那么需要获取token
30
- if ("private" != this.options.devConsoleConfig.version) { // private私有化
27
+
28
+ if ("private" != this.options.devConsoleConfig.version) {
31
29
  config = { "accessToken": await this.getToken(config) };
32
30
  }
33
- // 获得用户输入
31
+
34
32
  let answers;
35
33
  if (this.plugin) {
36
34
  answers = { buildFileName: this.plugin }
37
35
  } else {
38
36
  answers = await this.ask();
39
37
  }
40
- // 如果输入的是*.vue,那么表示编译全部文件
38
+
41
39
  if ("*.vue" == answers.buildFileName) {
42
40
  let dirs = fs.readdirSync("plugin")
43
41
  for (let i = 0; i < dirs.length; i++) {
@@ -53,65 +51,56 @@ class Builder {
53
51
  }
54
52
  }
55
53
  }
56
- /**
57
- * 命令行交互
58
- * @returns 结果
59
- */
54
+
60
55
  ask() {
61
56
  const prompt = [];
62
57
  prompt.push({
63
58
  type: "input",
64
59
  name: "buildFileName",
65
- message: "请输入需要编译的文件名,如index.vue",
60
+ message: "Please enter the file name to be compiled, such as index.vue",
66
61
  })
67
62
  return inquirer.prompt(prompt)
68
63
  }
69
- /**
70
- * 请求用户token
71
- * @param {用户信息} devConsoleConfig
72
- * @returns token
73
- */
64
+
74
65
  async getToken(devConsoleConfig) {
75
66
  let res = await post(this.options.devConsoleConfig.baseUrl || BaseUrl + "/sysconfig/auth/pc/1.0/post/tokenInfo", devConsoleConfig);
76
67
  if (res.returnCode == 200) {
77
68
  return res.data.accessToken;
78
69
  } else {
79
- console.error(chalk.red(`登录失败`, JSON.stringify(res)));
70
+ console.error(chalk.red(`Login failed`, JSON.stringify(res)));
80
71
  return null;
81
72
  }
82
73
  }
83
74
 
84
- /**
85
- * 获得Vue内容
86
- */
75
+
87
76
  getVueValue(buildFileName) {
88
77
  let vueContent = fs.readFileSync(this.getVueContent(buildFileName), 'utf8');
89
78
  let vueData = vueContent + ""
90
- // 添加scoped限制样式污染
79
+
91
80
  if (!vueContent.includes("scoped")) {
92
- // vueData = vueData.replace("<style", "<style scoped ")
81
+
93
82
  console.log()
94
- console.log(chalk.yellow("警告:style中缺少scoped属性,可能会造成样式全局污染,建议修复。"));
83
+ console.log(chalk.yellow("Warning: The scoped attribute is missing in style, which may cause global style pollution. It is recommended to fix it。"));
95
84
  console.log()
96
85
  }
97
- // 去除空格
98
- // vueData = vueData.replace(/\ +/g, "")
99
- // 去除换行
100
- // vueData =vueData.replace(/[\r\n]/g, "");
86
+
87
+
88
+
89
+
101
90
  vueData = vueData.split("data()")[1].split("isLock:")[0] + "isLock:false,};}";
102
91
  vueData = "function data()" + vueData;
103
92
  const data = eval(`(${vueData})`)()
104
- // 如果propObj不存在,那么初始一个空对象
93
+
105
94
  if (!data.propObj) {
106
95
  data.propObj = {};
107
96
  data.propOption = {};
108
97
  }
109
- // 如果events不存在,那么初始一个空对象
98
+
110
99
  if (!data.events) {
111
100
  data.events = {};
112
101
  data.eventsOption = {};
113
102
  }
114
- // 如果style不存在,那么初始一个空对象
103
+
115
104
  if (!data.style) {
116
105
  data.style = {
117
106
  unit: "px",
@@ -126,7 +115,7 @@ class Builder {
126
115
  word: {
127
116
  lable: "label.help",
128
117
  type: "word",
129
- link: "https://zucfl0psd6.feishu.cn/wiki/wikcnlXGFHfXw5LgAWbDcJXTFyd",
118
+ link: "https://google.com",
130
119
  },
131
120
  unit: {
132
121
  lable: "label.custom.unit",
@@ -168,29 +157,20 @@ class Builder {
168
157
  },
169
158
  };
170
159
  }
171
- let component = data.componentInfo.component // 组件标识
172
- let compName = data.componentInfo.compName // 组件名字
160
+ let component = data.componentInfo.component
161
+ let compName = data.componentInfo.compName
173
162
  vueData = JSON.stringify(data);
174
- let bizType = data.componentInfo.bizType // 组件类型
175
- let compDesc = data.componentInfo.compDesc // 组件描述
176
- let category = data.componentInfo.category // 组件状态
177
- let loadModel = data.componentInfo.loadModel // 组件加载模式,按需加载(lazy),启动加载(start)。
163
+ let bizType = data.componentInfo.bizType
164
+ let compDesc = data.componentInfo.compDesc
165
+ let category = data.componentInfo.category
166
+ let loadModel = data.componentInfo.loadModel
178
167
  return { compName, component, vueContent, vueData, bizType, compDesc, category, loadModel }
179
168
  };
180
- /**
181
- *
182
- * @param {string} buildFileName 编译文件入口
183
- * @param {string} component 编译后组件的名字
184
- * @param {string} plginTemp 生成模板代码存储路径
185
- */
169
+
186
170
  initPluginFile(buildFileName, component, plginTemp) {
187
171
  this.initPluginFile1(buildFileName, component, plginTemp)
188
172
  }
189
- /**
190
- * 生成依赖文件,vue-custom-element
191
- * @param {编译的文件名称} buildFileName
192
- * @param {编译后的组件名称} component
193
- */
173
+
194
174
  initPluginFile1(buildFileName, component, plginTemp) {
195
175
  let newContent =
196
176
  `
@@ -205,11 +185,7 @@ class Builder {
205
185
  fs.writeFileSync(`plugin/${plginTemp}.js`, newContent);
206
186
  }
207
187
 
208
- /**
209
- * 生成依赖文件
210
- * @param {编译的文件名称} buildFileName
211
- * @param {编译后的组件名称} component
212
- */
188
+
213
189
  initPluginFile2(buildFileName, component, plginTemp) {
214
190
  let newContent =
215
191
  `
@@ -219,7 +195,6 @@ class Builder {
219
195
  }
220
196
  export default install;
221
197
  if (typeof window !== 'undefined' && window.Vue) {
222
- console.log("install装载",install)
223
198
  window.Vue.use(install);
224
199
  if (install.installed) {
225
200
  install.installed = false;
@@ -229,30 +204,25 @@ class Builder {
229
204
  fs.writeFileSync(`plugin/${plginTemp}.js`, newContent);
230
205
  }
231
206
 
232
- /**
233
- * 编译文件,将vue编译为js文件
234
- * @param {编译对象信息} obj
235
- */
207
+
236
208
  build(obj, config, plginTemp) {
237
- console.log(chalk.green('编译中,请稍后...'));
209
+ console.log(chalk.green('Compiling, Please Wait...'));
238
210
  exec('npx vue-cli-service build --target lib --name ' + obj.component + ` --dest build plugin/${plginTemp}.js`, async (error, stdout, stderr) => {
239
211
  if (error) {
240
- console.log('编译失败:', error);
241
- console.log(chalk.red('编译失败:' + stdout));
212
+ console.log('Compilation Failed:', error);
213
+ console.log(chalk.red('Compilation Failed:' + stdout));
242
214
  return;
243
215
  } else {
244
- console.log(chalk.green('编译成功!'));
216
+ console.log(chalk.green('Compilation Successful!'));
245
217
  console.log();
246
218
  await this.upload(obj, config)
247
219
  fs.unlinkSync(`plugin/${plginTemp}.js`);
248
220
  }
249
221
  })
250
222
  }
251
- /**
252
- * 将文件上传
253
- */
223
+
254
224
  async upload(obj, header) {
255
- console.log(chalk.green('发布中,请稍后...'));
225
+ console.log(chalk.green('Posting, please wait...'));
256
226
  let jsContent = "";
257
227
  try {
258
228
  jsContent = fs.readFileSync(path.join("build", obj.component + ".umd.min.js"), 'utf8')
@@ -270,26 +240,23 @@ class Builder {
270
240
  "compDesc": obj.compDesc,
271
241
  "category": obj.category,
272
242
  "loadModel": obj.loadModel || "lazy",
273
- "belongOrgFlag": this.options.devConsoleConfig.belongOrgFlag || "custom" //belongOrgFlag: 所属单位标识,std:官方的组件(神州云动);custom:第三方的组件
243
+ "belongOrgFlag": this.options.devConsoleConfig.belongOrgFlag || "custom"
274
244
  }
275
- // 服务名
245
+
276
246
  let devSvcDispatch = this.options.devConsoleConfig.devSvcDispatch || '/devconsole'
277
247
  let res = await post(`${this.options.devConsoleConfig.baseUrl || BaseUrl}${devSvcDispatch}/custom/pc/1.0/post/insertCustomComp`,
278
248
  body, header);
279
249
  if (res.returnCode == 200) {
280
- console.error(chalk.green(`发布成功!`));
250
+ console.error(chalk.green(`Success!`));
281
251
  console.log();
282
252
  } else {
283
- console.error(chalk.red(`发布失败: ${res.returnInfo}`));
253
+ console.error(chalk.red(`Fail: ${res.returnInfo}`));
284
254
  console.log();
285
255
  }
286
256
  return res;
287
257
  }
288
258
 
289
- /**
290
- * 过滤出min.js文件
291
- * @returns 过滤结果
292
- */
259
+
293
260
  getVueContent(buildFileName) {
294
261
  const jsPath = "plugin";
295
262
  return path.join(jsPath, buildFileName);
@@ -4,18 +4,16 @@ const fs = require('fs');
4
4
  const path = require("path")
5
5
  const chalk = require("chalk")
6
6
  const inquirer = require("inquirer")
7
- // 检查cli版本更新功能
7
+
8
8
  const { checkUpdate } = require("../../utils/checkVersion")
9
9
  const BaseUrl = "https://developer.apis.cloudcc.cn"
10
10
  const { getPackageJson } = require("../../utils/utils")
11
11
 
12
- /**
13
- * 自定义组件,组件打包命令,将组件打包发布到服务器。
14
- */
12
+
15
13
  class Builder {
16
14
  constructor() {
17
15
  this.options = {
18
- // 开发配置信息
16
+
19
17
  devConsoleConfig: {
20
18
  },
21
19
  }
@@ -26,13 +24,13 @@ class Builder {
26
24
  if (!res) {
27
25
  this.options.devConsoleConfig = getPackageJson();
28
26
  let config = this.options.devConsoleConfig
29
- // 如果不是私有化部署,那么需要获取token
30
- if ("private" != this.options.devConsoleConfig.version) { // private私有化
27
+
28
+ if ("private" != this.options.devConsoleConfig.version) {
31
29
  config = { "accessToken": await this.getToken(config) };
32
30
  }
33
- // 获得用户输入
31
+
34
32
  let answers = { buildFileName: `${name}/${name}.vue` }
35
- // 如果输入的是*.vue,那么表示编译全部文件
33
+
36
34
  if ("*.vue" == answers.buildFileName) {
37
35
  let dirs = fs.readdirSync("plugins")
38
36
  for (let i = 0; i < dirs.length; i++) {
@@ -48,52 +46,46 @@ class Builder {
48
46
  }
49
47
  }
50
48
  }
51
- /**
52
- * 请求用户token
53
- * @param {用户信息} devConsoleConfig
54
- * @returns token
55
- */
49
+
56
50
  async getToken(devConsoleConfig) {
57
51
  let res = await post((this.options.devConsoleConfig.baseUrl || BaseUrl) + "/sysconfig/auth/pc/1.0/post/tokenInfo", devConsoleConfig);
58
52
  if (res.returnCode == 200) {
59
53
  return res.data.accessToken;
60
54
  } else {
61
- console.error(chalk.red(`登录失败`, JSON.stringify(res)));
55
+ console.error(chalk.red(`Login failed`, JSON.stringify(res)));
62
56
  return null;
63
57
  }
64
58
  }
65
59
 
66
- /**
67
- * 获得Vue内容
68
- */
60
+
69
61
  getVueValue(buildFileName) {
70
62
  let vueContent = fs.readFileSync(this.getVueContent(buildFileName), 'utf8');
71
63
  let vueData = vueContent + ""
72
- // 添加scoped限制样式污染
64
+
73
65
  if (!vueContent.includes("scoped")) {
74
- // vueData = vueData.replace("<style", "<style scoped ")
66
+
75
67
  console.log()
76
- console.log(chalk.yellow("警告:style中缺少scoped属性,可能会造成样式全局污染,建议修复。"));
68
+ console.log(chalk.yellow("Warning: The scoped attribute is missing in style, which may cause global style pollution. It is recommended to fix it。"));
77
69
  console.log()
78
70
  }
79
- // 去除空格
80
- // vueData = vueData.replace(/\ +/g, "")
81
- // 去除换行
82
- // vueData =vueData.replace(/[\r\n]/g, "");
71
+
72
+
73
+
74
+
83
75
  vueData = vueData.split("data()")[1].split("isLock:")[0] + "isLock:false,};}";
84
76
  vueData = "function data()" + vueData;
85
77
  const data = eval(`(${vueData})`)()
86
- // 如果propObj不存在,那么初始一个空对象
78
+
87
79
  if (!data.propObj) {
88
80
  data.propObj = {};
89
81
  data.propOption = {};
90
82
  }
91
- // 如果events不存在,那么初始一个空对象
83
+
92
84
  if (!data.events) {
93
85
  data.events = {};
94
86
  data.eventsOption = {};
95
87
  }
96
- // 如果style不存在,那么初始一个空对象
88
+
97
89
  if (!data.style) {
98
90
  data.style = {
99
91
  unit: "px",
@@ -108,7 +100,7 @@ class Builder {
108
100
  word: {
109
101
  lable: "label.help",
110
102
  type: "word",
111
- link: "https://zucfl0psd6.feishu.cn/wiki/wikcnlXGFHfXw5LgAWbDcJXTFyd",
103
+ link: "https://www.google.com",
112
104
  },
113
105
  unit: {
114
106
  lable: "label.custom.unit",
@@ -150,29 +142,20 @@ class Builder {
150
142
  },
151
143
  };
152
144
  }
153
- let component = data.componentInfo.component // 组件标识
154
- let compName = data.componentInfo.compName // 组件名字
145
+ let component = data.componentInfo.component
146
+ let compName = data.componentInfo.compName
155
147
  vueData = JSON.stringify(data);
156
- let bizType = data.componentInfo.bizType // 组件类型
157
- let compDesc = data.componentInfo.compDesc // 组件描述
158
- let category = data.componentInfo.category // 组件状态
159
- let loadModel = data.componentInfo.loadModel // 组件加载模式,按需加载(lazy),启动加载(start)。
148
+ let bizType = data.componentInfo.bizType
149
+ let compDesc = data.componentInfo.compDesc
150
+ let category = data.componentInfo.category
151
+ let loadModel = data.componentInfo.loadModel
160
152
  return { compName, component, vueContent, vueData, bizType, compDesc, category, loadModel }
161
153
  };
162
- /**
163
- *
164
- * @param {string} buildFileName 编译文件入口
165
- * @param {string} component 编译后组件的名字
166
- * @param {string} plginTemp 生成模板代码存储路径
167
- */
154
+
168
155
  initPluginFile(buildFileName, component, plginTemp) {
169
156
  this.initPluginFile1(buildFileName, component, plginTemp)
170
157
  }
171
- /**
172
- * 生成依赖文件,vue-custom-element
173
- * @param {编译的文件名称} buildFileName
174
- * @param {编译后的组件名称} component
175
- */
158
+
176
159
  initPluginFile1(buildFileName, component, plginTemp) {
177
160
  let newContent =
178
161
  `
@@ -187,11 +170,7 @@ class Builder {
187
170
  fs.writeFileSync(`plugins/${plginTemp}.js`, newContent);
188
171
  }
189
172
 
190
- /**
191
- * 生成依赖文件
192
- * @param {编译的文件名称} buildFileName
193
- * @param {编译后的组件名称} component
194
- */
173
+
195
174
  initPluginFile2(buildFileName, component, plginTemp) {
196
175
  let newContent =
197
176
  `
@@ -201,7 +180,6 @@ class Builder {
201
180
  }
202
181
  export default install;
203
182
  if (typeof window !== 'undefined' && window.Vue) {
204
- console.log("install装载",install)
205
183
  window.Vue.use(install);
206
184
  if (install.installed) {
207
185
  install.installed = false;
@@ -211,30 +189,25 @@ class Builder {
211
189
  fs.writeFileSync(`plugins/${plginTemp}.js`, newContent);
212
190
  }
213
191
 
214
- /**
215
- * 编译文件,将vue编译为js文件
216
- * @param {编译对象信息} obj
217
- */
192
+
218
193
  build(obj, config, plginTemp) {
219
- console.log(chalk.green('编译中,请稍后...'));
194
+ console.log(chalk.green('Compiling, Please Wait...'));
220
195
  exec('npx vue-cli-service build --target lib --name ' + obj.component + ` --dest build plugins/${plginTemp}.js`, async (error, stdout, stderr) => {
221
196
  if (error) {
222
- console.log('编译失败:', error);
223
- console.log(chalk.red('编译失败:' + stdout));
197
+ console.log('Compilation Failed:', error);
198
+ console.log(chalk.red('Compilation Failed:' + stdout));
224
199
  return;
225
200
  } else {
226
- console.log(chalk.green('编译成功!'));
201
+ console.log(chalk.green('Compilation Successful!'));
227
202
  console.log();
228
203
  await this.upload(obj, config)
229
204
  fs.unlinkSync(`plugins/${plginTemp}.js`);
230
205
  }
231
206
  })
232
207
  }
233
- /**
234
- * 将文件上传
235
- */
208
+
236
209
  async upload(obj, header) {
237
- console.log(chalk.green('发布中,请稍后...'));
210
+ console.log(chalk.green('Posting, please wait...'));
238
211
  let jsContent = "";
239
212
  try {
240
213
  jsContent = fs.readFileSync(path.join("build", obj.component + ".umd.min.js"), 'utf8')
@@ -252,26 +225,23 @@ class Builder {
252
225
  "compDesc": obj.compDesc,
253
226
  "category": obj.category,
254
227
  "loadModel": obj.loadModel || "lazy",
255
- "belongOrgFlag": this.options.devConsoleConfig.belongOrgFlag || "custom" //belongOrgFlag: 所属单位标识,std:官方的组件(神州云动);custom:第三方的组件
228
+ "belongOrgFlag": this.options.devConsoleConfig.belongOrgFlag || "custom"
256
229
  }
257
- // 服务名
230
+
258
231
  let devSvcDispatch = this.options.devConsoleConfig.devSvcDispatch || '/devconsole'
259
232
  let res = await post(`${this.options.devConsoleConfig.baseUrl || BaseUrl}${devSvcDispatch}/custom/pc/1.0/post/insertCustomComp`,
260
233
  body, header);
261
234
  if (res.returnCode == 200) {
262
- console.error(chalk.green(`发布成功!`));
235
+ console.error(chalk.green(`Success!`));
263
236
  console.log();
264
237
  } else {
265
- console.error(chalk.red(`发布失败: ${res.returnInfo}`));
238
+ console.error(chalk.red(`Fail: ${res.returnInfo}`));
266
239
  console.log();
267
240
  }
268
241
  return res;
269
242
  }
270
243
 
271
- /**
272
- * 过滤出min.js文件
273
- * @returns 过滤结果
274
- */
244
+
275
245
  getVueContent(buildFileName) {
276
246
  const jsPath = "plugins";
277
247
  return path.join(jsPath, buildFileName);
@@ -5,9 +5,7 @@ const memFsEditor = require("mem-fs-editor")
5
5
  const fs = require("fs")
6
6
  const path = require("path")
7
7
  const { checkUpdate } = require("../../utils/checkVersion")
8
- /**
9
- * 创建自定组件开发模板项目
10
- */
8
+
11
9
  class Creator {
12
10
  constructor() {
13
11
  this.fs = memFsEditor.create(memFs.create());
@@ -15,17 +13,17 @@ class Creator {
15
13
  name: "",
16
14
  description: ""
17
15
  }
18
- // 当前目录
16
+
19
17
  this.rootPath = path.resolve(__dirname, "../../");
20
- // 模板目录
18
+
21
19
  this.tplDirPath = path.join(this.rootPath, "template");
22
20
  }
23
- // 初始化
21
+
24
22
  async init(name) {
25
23
  let res = await checkUpdate();
26
24
  if (!res) {
27
25
  console.log()
28
- console.log(chalk.green('欢迎使用CloudCC-CLI'));
26
+ console.log(chalk.green('Welcome CloudCC-CLI'));
29
27
  console.log()
30
28
  if (!name) {
31
29
  this.ask().then(answers => {
@@ -39,21 +37,21 @@ class Creator {
39
37
  }
40
38
  }
41
39
  }
42
- // 命令行交互
40
+
43
41
  ask() {
44
42
  const prompt = [];
45
43
 
46
44
  prompt.push({
47
45
  type: "input",
48
46
  name: "name",
49
- message: "请输入项目名称",
47
+ message: "Please enter the project name",
50
48
  validate(input) {
51
49
  if (!input) {
52
- return "请输入项目名称"
50
+ return "Please enter the project name"
53
51
  }
54
52
 
55
53
  if (fs.existsSync(input)) {
56
- return "项目名已存在"
54
+ return "Project name already exists"
57
55
  }
58
56
 
59
57
  return true;
@@ -61,14 +59,14 @@ class Creator {
61
59
  });
62
60
  return inquirer.prompt(prompt)
63
61
  }
64
- // 拷贝和写数据
62
+
65
63
  write() {
66
64
  console.log();
67
- console.log(chalk.green("开始构建,请稍后"));
65
+ console.log(chalk.green("Starting construction, please wait"));
68
66
  const tplBuilder = require("../../template/index");
69
67
  tplBuilder(this, this.options, () => {
70
68
  console.log();
71
- console.log(chalk.green('构建完成,运行前请安装依赖'))
69
+ console.log(chalk.green('Build completed, please install dependencies before running'))
72
70
  console.log();
73
71
  })
74
72
  }
@@ -7,9 +7,7 @@ const path = require("path")
7
7
  const { checkUpdate } = require("../../utils/checkVersion")
8
8
  const tplBuilder = require("../../template/index");
9
9
  const execSync = require('child_process').execSync;
10
- /**
11
- * 创建自定组件开发模板项目
12
- */
10
+
13
11
  class Creator {
14
12
  constructor() {
15
13
  this.fs = memFsEditor.create(memFs.create());
@@ -17,17 +15,17 @@ class Creator {
17
15
  name: "",
18
16
  description: ""
19
17
  }
20
- // 当前目录
18
+
21
19
  this.rootPath = path.resolve(__dirname, "../../");
22
- // 模板目录
20
+
23
21
  this.tplDirPath = path.join(this.rootPath, "template");
24
22
  }
25
- // 初始化
23
+
26
24
  async init(name) {
27
25
  let res = await checkUpdate();
28
26
  if (!res) {
29
27
  console.log()
30
- console.log(chalk.green('欢迎使用CloudCC-CLI'));
28
+ console.log(chalk.green('Welcome CloudCC-CLI'));
31
29
  console.log()
32
30
  if (!name) {
33
31
  this.ask().then(answers => {
@@ -41,21 +39,21 @@ class Creator {
41
39
  }
42
40
  }
43
41
  }
44
- // 命令行交互
42
+
45
43
  ask() {
46
44
  const prompt = [];
47
45
 
48
46
  prompt.push({
49
47
  type: "input",
50
48
  name: "name",
51
- message: "请输入项目名称",
49
+ message: "Please enter the project name",
52
50
  validate(input) {
53
51
  if (!input) {
54
- return "请输入项目名称"
52
+ return "Please enter the project name"
55
53
  }
56
54
 
57
55
  if (fs.existsSync(input)) {
58
- return "项目名已存在"
56
+ return "Project name already exists"
59
57
  }
60
58
 
61
59
  return true;
@@ -63,14 +61,14 @@ class Creator {
63
61
  });
64
62
  return inquirer.prompt(prompt)
65
63
  }
66
- // 拷贝和写数据
64
+
67
65
  write() {
68
66
  console.log();
69
- console.log(chalk.green("开始构建,请稍后"));
67
+ console.log(chalk.green("Starting construction, please wait"));
70
68
  tplBuilder(this, this.options, () => {
71
69
  console.log();
72
70
  this.initGit(path.join(process.cwd(), this.options.name))
73
- console.log(chalk.green('构建完成,运行前请安装依赖'))
71
+ console.log(chalk.green('Build completed, please install dependencies before running'))
74
72
  console.log();
75
73
  })
76
74
  }
@@ -94,13 +92,13 @@ class Creator {
94
92
  execSync(`git -C ${path} init`)
95
93
  execSync(`git -C ${path} add .`)
96
94
  execSync(`git -C ${path} commit -m 'init'`)
97
- console.log(`${chalk.grey(`Git仓库初始化完成`)} ${chalk.green('✔ ')}`);
95
+ console.log(`${chalk.grey(`Git repository initialization completed`)} ${chalk.green('✔ ')}`);
98
96
  console.log();
99
- console.log(`${chalk.yellow(`请设置仓库地址:git remote add origin [远程仓库地址]`)}`);
97
+ console.log(`${chalk.yellow(`Please set the warehouse address: git remote add origin [remote repository address]`)}`);
100
98
  console.log();
101
99
  } catch (error) {
102
100
  console.log();
103
- console.log(chalk.red('git仓库初始化异常'))
101
+ console.log(chalk.red('git repository initialization exception'))
104
102
  console.log();
105
103
  }
106
104
  }