cloudcc-cli 1.6.8 → 1.6.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,10 @@
1
+ # ReleaseV1.6.9
2
+ #### 发布日期:2024-11-12
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 优化
6
+ * 分割兼容空格逻辑。
7
+
1
8
  # ReleaseV1.6.8
2
9
  #### 发布日期:2024-9-18
3
10
  #### 发布范围:全量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "1.6.8",
3
+ "version": "1.6.9",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "scripts": {
18
18
  "cc-pull": "git fetch --tags -f && git pull",
19
- "publish-lib": "npm publish --registry https://registry.npmjs.org && curl https://npmmirror.com/sync/cloudcc-cli"
19
+ "publish-lib": "npm --proxy http://127.0.0.1:33210/ publish --registry https://registry.npmjs.org && curl https://npmmirror.com/sync/cloudcc-cli"
20
20
  },
21
21
  "dependencies": {
22
22
  "axios": "^0.21.4",
@@ -13,7 +13,7 @@ const { getPackageJson } = require("../../utils/utils")
13
13
  class Builder {
14
14
  constructor() {
15
15
  this.options = {
16
-
16
+
17
17
  devConsoleConfig: {
18
18
  },
19
19
  }
@@ -24,18 +24,18 @@ class Builder {
24
24
  if (!res) {
25
25
  this.options.devConsoleConfig = getPackageJson();
26
26
  let config = this.options.devConsoleConfig
27
-
28
- if ("private" != this.options.devConsoleConfig.version) {
27
+
28
+ if ("private" != this.options.devConsoleConfig.version) {
29
29
  config = { "accessToken": await this.getToken(config) };
30
30
  }
31
-
31
+
32
32
  let answers;
33
33
  if (this.plugin) {
34
34
  answers = { buildFileName: this.plugin }
35
35
  } else {
36
36
  answers = await this.ask();
37
37
  }
38
-
38
+
39
39
  if ("*.vue" == answers.buildFileName) {
40
40
  let dirs = fs.readdirSync("plugin")
41
41
  for (let i = 0; i < dirs.length; i++) {
@@ -51,7 +51,7 @@ class Builder {
51
51
  }
52
52
  }
53
53
  }
54
-
54
+
55
55
  ask() {
56
56
  const prompt = [];
57
57
  prompt.push({
@@ -61,7 +61,7 @@ class Builder {
61
61
  })
62
62
  return inquirer.prompt(prompt)
63
63
  }
64
-
64
+
65
65
  async getToken(devConsoleConfig) {
66
66
  let res = await post(this.options.devConsoleConfig.baseUrl || BaseUrl + "/sysconfig/auth/pc/1.0/post/tokenInfo", devConsoleConfig);
67
67
  if (res.returnCode == 200) {
@@ -72,35 +72,32 @@ class Builder {
72
72
  }
73
73
  }
74
74
 
75
-
75
+
76
76
  getVueValue(buildFileName) {
77
77
  let vueContent = fs.readFileSync(this.getVueContent(buildFileName), 'utf8');
78
78
  let vueData = vueContent + ""
79
-
79
+
80
80
  if (!vueContent.includes("scoped")) {
81
-
81
+
82
82
  console.log()
83
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。"));
84
84
  console.log()
85
85
  }
86
-
87
-
88
-
89
-
90
- vueData = vueData.split("data()")[1].split("isLock:")[0] + "isLock:false,};}";
86
+
87
+ vueData = vueData.split(/data\s*\(\s*\)/)[1].split(/isLock\s*:/)[0] + "isLock:false,};}";
91
88
  vueData = "function data()" + vueData;
92
89
  const data = eval(`(${vueData})`)()
93
-
90
+
94
91
  if (!data.propObj) {
95
92
  data.propObj = {};
96
93
  data.propOption = {};
97
94
  }
98
-
95
+
99
96
  if (!data.events) {
100
97
  data.events = {};
101
98
  data.eventsOption = {};
102
99
  }
103
-
100
+
104
101
  if (!data.style) {
105
102
  data.style = {
106
103
  unit: "px",
@@ -157,20 +154,20 @@ class Builder {
157
154
  },
158
155
  };
159
156
  }
160
- let component = data.componentInfo.component
161
- let compName = data.componentInfo.compName
157
+ let component = data.componentInfo.component
158
+ let compName = data.componentInfo.compName
162
159
  vueData = JSON.stringify(data);
163
- let bizType = data.componentInfo.bizType
164
- let compDesc = data.componentInfo.compDesc
165
- let category = data.componentInfo.category
166
- let loadModel = data.componentInfo.loadModel
160
+ let bizType = data.componentInfo.bizType
161
+ let compDesc = data.componentInfo.compDesc
162
+ let category = data.componentInfo.category
163
+ let loadModel = data.componentInfo.loadModel
167
164
  return { compName, component, vueContent, vueData, bizType, compDesc, category, loadModel }
168
165
  };
169
-
166
+
170
167
  initPluginFile(buildFileName, component, plginTemp) {
171
168
  this.initPluginFile1(buildFileName, component, plginTemp)
172
169
  }
173
-
170
+
174
171
  initPluginFile1(buildFileName, component, plginTemp) {
175
172
  let newContent =
176
173
  `
@@ -185,7 +182,7 @@ class Builder {
185
182
  fs.writeFileSync(`plugin/${plginTemp}.js`, newContent);
186
183
  }
187
184
 
188
-
185
+
189
186
  initPluginFile2(buildFileName, component, plginTemp) {
190
187
  let newContent =
191
188
  `
@@ -204,7 +201,7 @@ class Builder {
204
201
  fs.writeFileSync(`plugin/${plginTemp}.js`, newContent);
205
202
  }
206
203
 
207
-
204
+
208
205
  build(obj, config, plginTemp) {
209
206
  console.log(chalk.green('Compiling, Please Wait...'));
210
207
  exec('npx vue-cli-service build --target lib --name ' + obj.component + ` --dest build plugin/${plginTemp}.js`, async (error, stdout, stderr) => {
@@ -220,7 +217,7 @@ class Builder {
220
217
  }
221
218
  })
222
219
  }
223
-
220
+
224
221
  async upload(obj, header) {
225
222
  console.log(chalk.green('Posting, please wait...'));
226
223
  let jsContent = "";
@@ -240,9 +237,9 @@ class Builder {
240
237
  "compDesc": obj.compDesc,
241
238
  "category": obj.category,
242
239
  "loadModel": obj.loadModel || "lazy",
243
- "belongOrgFlag": this.options.devConsoleConfig.belongOrgFlag || "custom"
240
+ "belongOrgFlag": this.options.devConsoleConfig.belongOrgFlag || "custom"
244
241
  }
245
-
242
+
246
243
  let devSvcDispatch = this.options.devConsoleConfig.devSvcDispatch || '/devconsole'
247
244
  let res = await post(`${this.options.devConsoleConfig.baseUrl || BaseUrl}${devSvcDispatch}/custom/pc/1.0/post/insertCustomComp`,
248
245
  body, header);
@@ -256,7 +253,7 @@ class Builder {
256
253
  return res;
257
254
  }
258
255
 
259
-
256
+
260
257
  getVueContent(buildFileName) {
261
258
  const jsPath = "plugin";
262
259
  return path.join(jsPath, buildFileName);
@@ -72,7 +72,7 @@ class Builder {
72
72
 
73
73
 
74
74
 
75
- vueData = vueData.split("data()")[1].split("isLock:")[0] + "isLock:false,};}";
75
+ vueData = vueData.split(/data\s*\(\s*\)/)[1].split(/isLock\s*:/)[0] + "isLock:false,};}";
76
76
  vueData = "function data()" + vueData;
77
77
  const data = eval(`(${vueData})`)()
78
78