cloudcc-cli 1.4.8 → 1.5.0

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,24 @@
1
+ # ReleaseV1.5.0
2
+ #### 发布日期:
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 迭代
6
+ * 修改模板项目中的package注解信息删除
7
+ * baseUrl改为默认配置
8
+ * 精简模板中的vue文件内容
9
+ * 打包组件的时候,设置默认style以及其他配置
10
+ * 修改模板排除库列表
11
+ * 添加版本提示和文档链接
12
+ * 优化模板
13
+
14
+ # ReleaseV1.4.9
15
+ #### 发布日期:2023-8-23
16
+ #### 发布范围:全量
17
+ #### 发布内容
18
+ * 迭代
19
+ * 打包生成版本信息的json文件,内容格式优化
20
+
21
+
1
22
  # ReleaseV1.4.8
2
23
  #### 发布日期:2023-8-23
3
24
  #### 发布范围:全量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "1.4.8",
3
+ "version": "1.5.0",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
@@ -6,6 +6,9 @@ const chalk = require("chalk")
6
6
  const inquirer = require("inquirer")
7
7
  // 检查cli版本更新功能
8
8
  const { checkUpdate } = require("../utils/checkVersion")
9
+ const BaseUrl = "https://developer.apis.cloudcc.cn"
10
+ const axios = require("axios")
11
+
9
12
  /**
10
13
  * 自定义组件,组件打包命令,将组件打包发布到服务器。
11
14
  */
@@ -23,6 +26,7 @@ class Builder {
23
26
  if (!res) {
24
27
  this.options.devConsoleConfig = this.getPackageJson();
25
28
  let config = this.options.devConsoleConfig
29
+ // await this.getSecretKey(config.username)
26
30
  // 如果不是私有化部署,那么需要获取token
27
31
  if ("private" != this.options.devConsoleConfig.version) { // private私有化
28
32
  config = { "accessToken": await this.getToken(config) };
@@ -71,13 +75,28 @@ class Builder {
71
75
  const packageJson = JSON.parse(fs.readFileSync("package.json", 'utf8'));
72
76
  return packageJson.devConsoleConfig; // cloudcc-plugin 中的 devConsoleConfig
73
77
  }
78
+
79
+ /**
80
+ * 通过用户名获取密钥
81
+ * @param {string} username 用户名
82
+ */
83
+ async getSecretKey(username) {
84
+ let res = await axios.post(this.options.devConsoleConfig.baseUrl || BaseUrl + "/sysconfig/auth/secretkey/get", { username }, {
85
+ timeout: 60000,
86
+ headers: {
87
+ 'Content-Type': 'application/x-www-form-urlencoded',
88
+ },
89
+ })
90
+
91
+ console.log("res", JSON.stringify(res))
92
+ }
74
93
  /**
75
94
  * 请求用户token
76
95
  * @param {用户信息} devConsoleConfig
77
96
  * @returns token
78
97
  */
79
98
  async getToken(devConsoleConfig) {
80
- let res = await post(this.options.devConsoleConfig.baseUrl + "/sysconfig/auth/pc/1.0/post/tokenInfo", devConsoleConfig);
99
+ let res = await post(this.options.devConsoleConfig.baseUrl || BaseUrl + "/sysconfig/auth/pc/1.0/post/tokenInfo", devConsoleConfig);
81
100
  if (res.returnCode == 200) {
82
101
  return res.data.accessToken;
83
102
  } else {
@@ -103,6 +122,73 @@ class Builder {
103
122
  vueData = vueData.split("data()")[1].split("isLock:")[0] + "isLock:false,};}";
104
123
  vueData = "function data()" + vueData;
105
124
  const data = eval(`(${vueData})`)()
125
+ // 如果propObj不存在,那么初始一个空对象
126
+ if (!data.propObj) {
127
+ data.propObj = {};
128
+ data.propOption = {};
129
+ }
130
+ // 如果events不存在,那么初始一个空对象
131
+ if (!data.events) {
132
+ data.events = {};
133
+ data.eventsOption = {};
134
+ }
135
+ // 如果style不存在,那么初始一个空对象
136
+ if (!data.style) {
137
+ data.style = {
138
+ unit: "px",
139
+ width: 72,
140
+ height: 38,
141
+ top: 0,
142
+ left: 0,
143
+ rotate: 0,
144
+ opacity: 1,
145
+ };
146
+ data.styleOption = {
147
+ word: {
148
+ lable: "label.help",
149
+ type: "word",
150
+ link: "https://zucfl0psd6.feishu.cn/wiki/wikcnlXGFHfXw5LgAWbDcJXTFyd",
151
+ },
152
+ unit: {
153
+ lable: "label.custom.unit",
154
+ type: "option",
155
+ options: [
156
+ {
157
+ value: "px",
158
+ label: "label.custom.pixel",
159
+ },
160
+ {
161
+ value: "%",
162
+ label: "label.percent",
163
+ },
164
+ {
165
+ value: "hw",
166
+ label: "label.custom.viewport",
167
+ },
168
+ ],
169
+ },
170
+ width: {
171
+ lable: "label.custom.width",
172
+ type: "input",
173
+ inputType: "number",
174
+ },
175
+ height: {
176
+ lable: "label.custom.height",
177
+ type: "input",
178
+ inputType: "number",
179
+ },
180
+ top: {
181
+ lable: "label.dev.y.coordinate",
182
+ type: "input",
183
+ inputType: "number",
184
+ },
185
+ left: {
186
+ lable: "label.dev.x.coordinate",
187
+ type: "input",
188
+ inputType: "number",
189
+ },
190
+ };
191
+ }
106
192
  let component = data.componentInfo.component // 组件标识
107
193
  let compName = data.componentInfo.compName // 组件名字
108
194
  vueData = JSON.stringify(data);
@@ -175,7 +261,7 @@ class Builder {
175
261
  }
176
262
  // 服务名
177
263
  let devSvcDispatch = this.options.devConsoleConfig.devSvcDispatch || '/devconsole'
178
- let res = await post(`${this.options.devConsoleConfig.baseUrl}${devSvcDispatch}/custom/pc/1.0/post/insertCustomComp`,
264
+ let res = await post(`${this.options.devConsoleConfig.baseUrl || BaseUrl}${devSvcDispatch}/custom/pc/1.0/post/insertCustomComp`,
179
265
  body, header);
180
266
  if (res.returnCode == 200) {
181
267
  console.error(chalk.green(`发布成功!`));
package/src/builderSDK.js CHANGED
@@ -5,6 +5,7 @@ const path = require("path")
5
5
  const chalk = require("chalk")
6
6
  const inquirer = require("inquirer")
7
7
  const { checkUpdate } = require("../utils/checkVersion")
8
+ const BaseUrl = "https://developer.apis.cloudcc.cn"
8
9
  /**
9
10
  * 打包业务sdk为js并发布到cdn
10
11
  */
@@ -70,7 +71,7 @@ class Builder {
70
71
  * @returns token
71
72
  */
72
73
  async getToken(devConsoleConfig) {
73
- let res = await post(this.options.devConsoleConfig.baseUrl + "/sysconfig/auth/pc/1.0/post/tokenInfo", devConsoleConfig);
74
+ let res = await post(this.options.devConsoleConfig.baseUrl || BaseUrl + "/sysconfig/auth/pc/1.0/post/tokenInfo", devConsoleConfig);
74
75
  if (res.returnCode == 200) {
75
76
  return res.data.accessToken;
76
77
  } else {
@@ -128,7 +129,7 @@ class Builder {
128
129
  "bucketName": "cloudcc-sdk",
129
130
  }
130
131
  )
131
- let res = await post(this.options.devConsoleConfig.baseUrl + "/devconsole/cdn/uploadFile",
132
+ let res = await post(this.options.devConsoleConfig.baseUrl || BaseUrl + "/devconsole/cdn/uploadFile",
132
133
  body);
133
134
  if (res.returnCode == 200) {
134
135
  console.error(chalk.green(`发布成功!`));
@@ -5,6 +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
+ const exec = require('child_process').execSync;
8
9
  /**
9
10
  * 创建自定组件开发模板项目
10
11
  */
@@ -68,9 +69,11 @@ class Creator {
68
69
  const tplBuilder = require("../template/index");
69
70
  tplBuilder(this, this.options, () => {
70
71
  console.log();
71
- console.log(chalk.green('构建完成'));
72
+ console.log(chalk.green('安装依赖'));
73
+ let os = process.platform
74
+ exec(`cd ${this.options.name} && ${'darwin' == os ? 'sudo' : ''} npm install --registry http://registry.npmmirror.com && code . `)
72
75
  console.log();
73
- console.log(chalk.green(`运行项目: \n 1:cd ${this.options.name} \n 2:code . \n 3:npm install`));
76
+ console.log(chalk.green('构建完成'))
74
77
  })
75
78
  }
76
79
 
@@ -103,6 +103,9 @@ class Publish {
103
103
  }
104
104
  // 4:开始打包
105
105
  this.build(condition)
106
+
107
+ // 7:写入版本信息
108
+ // writeVersion("sdf", condition.type, projectConfig, this.user);
106
109
  }
107
110
  }
108
111
 
package/template/Appvue CHANGED
@@ -1,36 +1,27 @@
1
1
  <template>
2
- <div class="app">
3
- <div @click="hello">hello CloudCC</div>
2
+ <div>
4
3
  <Plugin />
5
4
  </div>
6
5
  </template>
7
6
 
8
7
  <script>
9
- import Plugin from "../plugin/index.vue";
10
- export default {
11
- name: "App",
12
- components: {
13
- Plugin,
14
- },
15
- methods: {
16
- hello() {
17
- this.$CCDK.CCMessage.showMessage("Hello CloudCC");
18
- },
19
- },
20
- };
8
+ /**
9
+ * 项目入口文件,用于测试使用
10
+ */
11
+ import Plugin from "../plugin/index.vue";
12
+ export default {
13
+ name: "App",
14
+ components: {
15
+ Plugin,
16
+ },
17
+ };
21
18
  </script>
22
19
 
23
- <style lang="scss">
24
- html body {
25
- padding: 0;
26
- margin: 0;
27
- height: 100vh;
28
- width: 100%;
29
- }
30
-
31
- .app {
32
- margin: auto;
33
- height: 100px;
34
- width: 200px;
35
- }
20
+ <style lang="scss" scoped>
21
+ html body {
22
+ padding: 0;
23
+ margin: 0;
24
+ height: 100vh;
25
+ width: 100%;
26
+ }
36
27
  </style>
package/template/index.js CHANGED
@@ -36,10 +36,6 @@ module.exports = function (creator, options, callback) {
36
36
 
37
37
  creator.copyTpl('Appvue', path.join(src, "App.vue"))
38
38
 
39
- creator.copyTpl('httpjs', path.join(utils, "http.js"))
40
-
41
- creator.copyTpl('generateIDjs', path.join(utils, "generateID.js"))
42
-
43
39
  creator.copyTpl('indexvue', path.join(pluginPath, "index.vue"))
44
40
 
45
41
  creator.copyTpl('indexhtml', path.join(public, "index.html"))
package/template/indexvue CHANGED
@@ -1,343 +1,35 @@
1
1
  <template>
2
- <div class="cloudccButton" @mouseover="myMouseover">
3
- <el-button
4
- v-loading.fullscreen.lock="fullscreenLoading"
5
- element-loading-text="loading..."
6
- :style="`font-size:` + elePropObj.fontSize + `px;` + elePropObj.style"
7
- :type="elePropObj.type"
8
- @click="handleClick"
9
- >{{ elePropObj.defaultValue }}</el-button
10
- >
11
- </div >
12
- </template >
2
+ <div class="cc-container">
3
+ <div>Hello CloudCC</div>
4
+ <div>
5
+ <a href="https://cloudccone.feishu.cn/wiki/JZ7CwcRfriU8taknCKCcwKEmncd">
6
+ 开发者文档</a
7
+ >
8
+ </div>
9
+ </div>
10
+ </template>
13
11
 
14
12
  <script>
15
- import axios from "../utils/http";
16
13
  export default {
17
- name: "my-button",
18
- props: {
19
- elePropObj: {
20
- type: Object,
21
- default: () => ({}),
22
- },
23
- eleEventObj: {
24
- type: Object,
25
- default: () => ({
26
- myCreated: `function created(self) {
27
- // self即this,本组件的vue实例
28
- }`,
29
- myMounted: `function mounted(self) {
30
- // self即this,本组件的vue实例
31
- }`,
32
- myDestroyed: `function destroyed(self) {
33
- // self即this,本组件的vue实例
34
- }`,
35
- myMouseover: `function myMouseover(self) {
36
- // self即this,本组件的vue实例
37
- }`,
38
- }),
39
- },
40
- version: {
41
- type: String,
42
- default: "",
43
- },
44
- },
45
14
  data() {
46
15
  return {
47
- fullscreenLoading: false,
48
16
  componentInfo: {
49
- component: "my-button",
50
- // 按钮
51
- compName: "我的按钮",
52
- icon: "#icon-anniu",
53
- sort: 1,
17
+ // 组件唯一标识,全局唯一
18
+ component: "cloudcc-demo-01",
19
+ // 组件名称,在页面编辑器显示的名字
20
+ compName: "cloudcc-demo-01",
21
+ // 组件描述信息
54
22
  compDesc: "组件描述信息",
55
- /* 组件分类:
56
- * private:私有组件(自己组织可见)
57
- * beta:组件测试版本
58
- */
59
- category: "private", // public private
60
- version: "0.0.1",
61
- },
62
- style: {
63
- unit: "px",
64
- width: 72,
65
- height: 38,
66
- top: 0,
67
- left: 0,
68
- rotate: 0,
69
- opacity: 1,
70
- },
71
- styleOption: {
72
- word: {
73
- lable: "label.help",
74
- type: "word",
75
- link: "https://zucfl0psd6.feishu.cn/wiki/wikcnJNCCWZB05fOrvRkBuNQ7re",
76
- },
77
- unit: {
78
- lable: "label.custom.unit",
79
- type: "option",
80
- options: [
81
- {
82
- value: "px",
83
- label: "label.custom.pixel",
84
- },
85
- {
86
- value: "%",
87
- label: "label.percent",
88
- },
89
- {
90
- value: "hw",
91
- label: "label.custom.viewport",
92
- },
93
- ],
94
- },
95
- width: {
96
- lable: "label.custom.width",
97
- type: "input",
98
- inputType: "number",
99
- },
100
- height: {
101
- lable: "label.custom.height",
102
- type: "input",
103
- inputType: "number",
104
- },
105
- top: {
106
- lable: "label.dev.y.coordinate",
107
- type: "input",
108
- inputType: "number",
109
- },
110
- left: {
111
- lable: "label.dev.x.coordinate",
112
- type: "input",
113
- inputType: "number",
114
- },
115
- },
116
- propObj: {
117
- id: "",
118
- pageApi: "createPage",
119
- defaultValue: "Button",
120
- type: "primary",
121
- fontSize: 16,
122
- functionContent: `function test(conext,value) {
123
- let requestParams = {
124
- className: "TestUpdate", // 类名 string
125
- methodName: "queryGao", // 方法名 string
126
- params: [
127
- {
128
- "argType": "java.lang.String",
129
- "argValue": "1111",
130
- },
131
- {
132
- "argType": "java.lang.String",
133
- "argValue": "2222",
134
- }
135
- ], // 请求参数
136
- };
137
- return requestParams;
138
- }`,
139
- handleComponentId: "",
140
- axiosAddres: "http://localhost:8080/api/pc/1.0/school/add",
141
- returnBody: `function test(self,res) {
142
- console.log(res)
143
- if (res.returnCode == 200 || "1" == res.returnCode) {
144
- self.$message({
145
- message: "提交成功",
146
- type: "success",
147
- });
148
- }
149
- }`,
150
- style: "",
151
- },
152
- propOption: {
153
- style: {
154
- lable: "label.style",
155
- type: "input",
156
- },
157
- defaultValue: {
158
- lable: "label.dev.defaultvalue",
159
- type: "defaultValueInput",
160
- },
161
- type: {
162
- lable: "label.dev.button.type",
163
- type: "option",
164
- options: [
165
- {
166
- value: "primary",
167
- label: "primary",
168
- },
169
- {
170
- value: "success",
171
- label: "success",
172
- },
173
- {
174
- value: "info",
175
- label: "info",
176
- },
177
- {
178
- value: "warning",
179
- label: "warning",
180
- },
181
- {
182
- value: "danger",
183
- label: "danger",
184
- },
185
- ],
186
- },
187
- fontSize: {
188
- lable: "label.dev.font.size",
189
- type: "input",
190
- inputType: "number",
191
- },
192
- handleComponentId: {
193
- lable: "label.dev.associated.compid",
194
- type: "input",
195
- },
196
- functionContent: {
197
- lable: "label.dev.request.body",
198
- type: "code",
199
- },
200
- axiosAddres: {
201
- lable: "label.dev.interface.address",
202
- type: "code",
203
- },
204
- returnBody: {
205
- lable: "label.dev.return.body",
206
- type: "code",
207
- },
208
- },
209
- events: {
210
- myCreated: `function created(self) {
211
- // self即this,本组件的vue实例
212
- }`,
213
- myMounted: `function mounted(self) {
214
- // self即this,本组件的vue实例
215
- }`,
216
- myDestroyed: `function destroyed(self) {
217
- // self即this,本组件的vue实例
218
- }`,
219
- myMouseover: `function myMouseover(self) {
220
- // self即this,本组件的vue实例
221
- }`,
222
23
  },
223
- eventsOption: {
224
- myCreated: {
225
- lable: "label.dev.created",
226
- type: "code",
227
- },
228
- myMounted: {
229
- lable: "label.dev.mounted",
230
- type: "code",
231
- },
232
- myDestroyed: {
233
- lable: "label.dev.destroyed",
234
- type: "code",
235
- },
236
- myMouseover: {
237
- lable: "label.dev.mouseover",
238
- type: "code",
239
- },
240
- },
241
- animations: [],
242
- groupStyle: {},
243
24
  isLock: false,
244
25
  };
245
26
  },
246
- created() {
247
- this.$Components.set(this.elePropObj.id, this);
248
- if (this.$Components.get("editMode") == "edit") {
249
- // 编辑模式不触发
250
- return;
251
- }
252
- let myCreated = eval("(false || " + this.eleEventObj.myCreated + ")");
253
- myCreated(this);
254
- },
255
- mounted() {
256
- if (this.$Components.get("editMode") == "edit") {
257
- // 编辑模式不触发
258
- return;
259
- }
260
- let myMounted = eval("(false || " + this.eleEventObj.myMounted + ")");
261
- myMounted(this);
262
- },
263
- destroyed() {
264
- let myDestroyed = eval("(false || " + this.eleEventObj.myDestroyed + ")");
265
- myDestroyed(this);
266
- },
267
- methods: {
268
- myMouseover() {
269
- let mouseoverEvent = eval(
270
- "(false || " + this.eleEventObj.myMouseover + ")"
271
- );
272
- mouseoverEvent(this);
273
- },
274
- returnBodyHandle(res) {
275
- let self = this;
276
- let getReturnBody = eval("(false || " + this.elePropObj.returnBody + ")");
277
- getReturnBody(self, res);
278
- },
279
- handleClick() {
280
- if (
281
- null == this.elePropObj.handleComponentId ||
282
- "" == this.elePropObj.handleComponentId
283
- ) {
284
- return;
285
- }
286
- let components = this.elePropObj.handleComponentId
287
- .split(",")
288
- .map((item) => {
289
- return this.$Components.get(item);
290
- });
291
- let test = eval("(false || " + this.elePropObj.functionContent + ")");
292
- // 接收请求体,访问接口
293
- let body = test(
294
- this.$Components.get(this.elePropObj.pageApi),
295
- ...components
296
- );
297
- if (this.elePropObj.axiosAddres && body) {
298
- this.handleAxios(this.elePropObj.axiosAddres, body);
299
- }
300
- },
301
- /**
302
- * 网络请求
303
- */
304
- handleAxios(path, params) {
305
- this.fullscreenLoading = true;
306
- axios
307
- .postLight(path, params)
308
- .then(
309
- (res) => {
310
- this.fullscreenLoading = false;
311
- this.returnBodyHandle(res);
312
- },
313
- (err) => {
314
- this.fullscreenLoading = false;
315
- this.$message({
316
- message: err,
317
- type: "error",
318
- });
319
- }
320
- )
321
- .catch((error) => {
322
- this.fullscreenLoading = false;
323
- this.$message({
324
- message: error,
325
- type: "error",
326
- });
327
- });
328
- },
329
- },
330
27
  };
331
28
  </script>
332
- <style >
333
- .cloudccButton {
334
- height: 100%;
335
- width: 100%;
336
- padding: 0px !important;
337
- }
338
- .cloudccButton .el-button {
339
- height: 100%;
340
- width: 100%;
341
- padding: 0px !important;
29
+ <style lang="scss" scoped>
30
+ .cc-container {
31
+ text-align: center;
32
+ padding: 8px;
33
+ background: goldenrod;
342
34
  }
343
- </style>
35
+ </style>
package/template/mainjs CHANGED
@@ -2,11 +2,8 @@ import Vue from 'vue';
2
2
  import ElementUI from 'element-ui';
3
3
  Vue.use(ElementUI);
4
4
  import 'element-ui/lib/theme-chalk/index.css';
5
- import App from './App.vue';
6
5
 
7
- import * as CCDK from "cloudcc-ccdk/lib/ccdk.min.js";
8
- Vue.prototype.$CCDK = CCDK
9
- window.$CCDK = CCDK
6
+ import App from './App.vue';
10
7
 
11
8
  Vue.prototype.$Components = new Map()
12
9
  Vue.config.productionTip = false
@@ -2371,14 +2371,6 @@
2371
2371
  "integrity": "sha1-1h9G2DslGSUOJ4Ta9bCUeai0HFk=",
2372
2372
  "dev": true
2373
2373
  },
2374
- "axios": {
2375
- "version": "0.21.1",
2376
- "resolved": "https://registry.npm.taobao.org/axios/download/axios-0.21.1.tgz?cache=0&sync_timestamp=1608611400719&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Faxios%2Fdownload%2Faxios-0.21.1.tgz",
2377
- "integrity": "sha1-IlY0gZYvTWvemnbVFu8OXTwJsrg=",
2378
- "requires": {
2379
- "follow-redirects": "^1.10.0"
2380
- }
2381
- },
2382
2374
  "babel-eslint": {
2383
2375
  "version": "10.1.0",
2384
2376
  "resolved": "https://registry.nlark.com/babel-eslint/download/babel-eslint-10.1.0.tgz?cache=0&sync_timestamp=1618847475962&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fbabel-eslint%2Fdownload%2Fbabel-eslint-10.1.0.tgz",
@@ -3319,11 +3311,6 @@
3319
3311
  "shallow-clone": "^3.0.0"
3320
3312
  }
3321
3313
  },
3322
- "cloudcc-ccdk": {
3323
- "version": "0.3.6",
3324
- "resolved": "https://registry.npmmirror.com/cloudcc-ccdk/-/cloudcc-ccdk-0.3.6.tgz",
3325
- "integrity": "sha512-m6cv1TTEMmADFpFNbXPwsfN4RVTNRhg3TwNkPsEJz9cw7SLoprpzE801wGFSpEXPEMRaqBzCy/K/Ia/dINzykg=="
3326
- },
3327
3314
  "coa": {
3328
3315
  "version": "2.0.2",
3329
3316
  "resolved": "https://registry.npm.taobao.org/coa/download/coa-2.0.2.tgz",
@@ -3722,7 +3709,8 @@
3722
3709
  "core-js": {
3723
3710
  "version": "3.15.1",
3724
3711
  "resolved": "https://registry.nlark.com/core-js/download/core-js-3.15.1.tgz?cache=0&sync_timestamp=1624386828826&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcore-js%2Fdownload%2Fcore-js-3.15.1.tgz",
3725
- "integrity": "sha1-bAiriKvfVlRQRcz1/YH0f0B+fxo="
3712
+ "integrity": "sha1-bAiriKvfVlRQRcz1/YH0f0B+fxo=",
3713
+ "dev": true
3726
3714
  },
3727
3715
  "core-js-compat": {
3728
3716
  "version": "3.15.1",
@@ -3857,11 +3845,6 @@
3857
3845
  "randomfill": "^1.0.3"
3858
3846
  }
3859
3847
  },
3860
- "crypto-js": {
3861
- "version": "4.1.1",
3862
- "resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.1.1.tgz",
3863
- "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw=="
3864
- },
3865
3848
  "css-color-names": {
3866
3849
  "version": "0.0.4",
3867
3850
  "resolved": "https://registry.nlark.com/css-color-names/download/css-color-names-0.0.4.tgz",
@@ -4561,14 +4544,6 @@
4561
4544
  "safer-buffer": "^2.1.0"
4562
4545
  }
4563
4546
  },
4564
- "echarts": {
4565
- "version": "4.9.0",
4566
- "resolved": "https://registry.npmmirror.com/echarts/-/echarts-4.9.0.tgz",
4567
- "integrity": "sha512-+ugizgtJ+KmsJyyDPxaw2Br5FqzuBnyOWwcxPKO6y0gc5caYcfnEUIlNStx02necw8jmKmTafmpHhGo4XDtEIA==",
4568
- "requires": {
4569
- "zrender": "4.3.2"
4570
- }
4571
- },
4572
4547
  "ee-first": {
4573
4548
  "version": "1.1.1",
4574
4549
  "resolved": "https://registry.nlark.com/ee-first/download/ee-first-1.1.1.tgz",
@@ -5490,7 +5465,8 @@
5490
5465
  "follow-redirects": {
5491
5466
  "version": "1.14.1",
5492
5467
  "resolved": "https://registry.nlark.com/follow-redirects/download/follow-redirects-1.14.1.tgz?cache=0&sync_timestamp=1620555234886&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffollow-redirects%2Fdownload%2Ffollow-redirects-1.14.1.tgz",
5493
- "integrity": "sha1-2RFN7Qoc/dM04WTmZirQK/2R/0M="
5468
+ "integrity": "sha1-2RFN7Qoc/dM04WTmZirQK/2R/0M=",
5469
+ "dev": true
5494
5470
  },
5495
5471
  "for-in": {
5496
5472
  "version": "1.0.2",
@@ -6813,11 +6789,6 @@
6813
6789
  "integrity": "sha1-J8dlOb4U2L0Sghmi1zGwkzeQTnk=",
6814
6790
  "dev": true
6815
6791
  },
6816
- "js-cookie": {
6817
- "version": "3.0.1",
6818
- "resolved": "https://registry.npmmirror.com/js-cookie/-/js-cookie-3.0.1.tgz",
6819
- "integrity": "sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw=="
6820
- },
6821
6792
  "js-message": {
6822
6793
  "version": "1.0.7",
6823
6794
  "resolved": "https://registry.nlark.com/js-message/download/js-message-1.0.7.tgz",
@@ -11079,11 +11050,6 @@
11079
11050
  "resolved": "https://registry.nlark.com/vue/download/vue-2.6.14.tgz?cache=0&sync_timestamp=1624386596988&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fvue%2Fdownload%2Fvue-2.6.14.tgz",
11080
11051
  "integrity": "sha1-5RqlJQJQ1Wmj+606ilpofWA24jU="
11081
11052
  },
11082
- "vue-cookies": {
11083
- "version": "1.7.4",
11084
- "resolved": "https://registry.npm.taobao.org/vue-cookies/download/vue-cookies-1.7.4.tgz",
11085
- "integrity": "sha1-0kHQoEMdoHlYN2UdELTXPnyNPo0="
11086
- },
11087
11053
  "vue-custom-element": {
11088
11054
  "version": "3.3.0",
11089
11055
  "resolved": "https://registry.nlark.com/vue-custom-element/download/vue-custom-element-3.3.0.tgz",
@@ -12144,11 +12110,6 @@
12144
12110
  "dev": true
12145
12111
  }
12146
12112
  }
12147
- },
12148
- "zrender": {
12149
- "version": "4.3.2",
12150
- "resolved": "https://registry.npmmirror.com/zrender/-/zrender-4.3.2.tgz",
12151
- "integrity": "sha512-bIusJLS8c4DkIcdiK+s13HiQ/zjQQVgpNohtd8d94Y2DnJqgM1yjh/jpDb8DoL6hd7r8Awagw8e3qK/oLaWr3g=="
12152
12113
  }
12153
12114
  }
12154
12115
  }
@@ -3,39 +3,27 @@
3
3
  "version": "1.0.0",
4
4
  "description": "cloudcc-plugin-dev",
5
5
  "devConsoleConfig": {
6
- "baseUrl": "http://xxx", //组件提交地址
7
- "username": "xxx", // 用户名
8
- "secretKey": "xxx", // 通过用户名,访问接口获得
6
+ "username": "cloudcc@one.lightning",
7
+ "secretKey": "7d126f39d90c4f198b14cb7cf70e3b"
9
8
  },
10
9
  "scripts": {
11
- "cc-pull": "git fetch --tags -f && git pull",
12
- "serve": "vue-cli-service serve",
13
- "build-plugin": "cloudccBuild"
10
+ "serve": "vue-cli-service serve"
14
11
  },
15
12
  "dependencies": {
16
13
  "element-ui": "2.15.12",
17
- "crypto-js": "4.1.1",
18
- "js-cookie": "3.0.1",
19
- "axios": "^0.21.1",
20
- "cloudcc-ccdk": "0.3.6",
21
- "core-js": "^3.6.5",
22
- "echarts": "^4.9.0",
23
14
  "vue": "2.6.14",
24
- "vue-cookies": "^1.7.4",
25
15
  "vue-custom-element": "3.3.0"
26
16
  },
27
17
  "devDependencies": {
28
- "@kazupon/vue-i18n-loader": "^0.5.0",
29
18
  "@vue/cli-plugin-babel": "~4.5.0",
30
19
  "@vue/cli-plugin-eslint": "~4.5.0",
31
20
  "@vue/cli-service": "~4.5.0",
32
21
  "babel-eslint": "^10.1.0",
33
- "element-ui": "^2.15.2",
34
22
  "eslint": "^6.7.2",
35
23
  "eslint-plugin-vue": "^6.2.2",
36
24
  "sass": "1.26.8",
37
25
  "sass-loader": "8.0.2",
38
- "vue-template-compiler": "^2.6.11"
26
+ "vue-template-compiler": "2.6.14"
39
27
  },
40
28
  "eslintConfig": {
41
29
  "root": true,
@@ -1,9 +1,15 @@
1
1
  // 打包排除依赖包
2
2
  const external = process.env.NODE_ENV == 'development' ? {} : {
3
- "vue": 'Vue',
4
- "vue-router": 'VueRouter',
5
- 'element-ui': 'ELEMENT',
6
- "axios": 'axios',
3
+ "vue": 'Vue',
4
+ "vue-router": 'VueRouter',
5
+ 'vue-echarts': 'VueECharts',
6
+ 'element-ui': 'ELEMENT',
7
+ "axios": 'axios',
8
+ "d3": 'd3',
9
+ 'echarts': 'echarts',
10
+ "jschardet": 'jschardet',
11
+ "crypto-js": 'CryptoJS',
12
+ "vue-i18n": 'VueI18n',
7
13
  }
8
14
  module.exports = {
9
15
  publicPath: '/',
@@ -3,6 +3,7 @@ const config = require("../package.json")
3
3
  const inquirer = require("inquirer")
4
4
  const exec = require('child_process').execSync;
5
5
  const chalk = require("chalk")
6
+
6
7
  /**
7
8
  * 检查版本号
8
9
  */
@@ -17,21 +18,30 @@ function checkNpmVersion() {
17
18
 
18
19
  // 从阿里源获取版本号
19
20
  try {
20
- onlineVersion = exec(`curl -s http://www.npmmirror.com/package/cloudcc-cli`)
21
- onlineVersion = onlineVersion.toString("utf8").trim().split('img title="')[1].split('" src')[0];
21
+ onlineVersion = exec(`curl -s https://npmmirror.com/api/info?pkgName=cloudcc-cli`)
22
+ onlineVersion = JSON.parse(onlineVersion.toString("utf8").trim()).data['dist-tags'].latest
22
23
  } catch (e) {
23
24
  }
24
25
  onlineVersionNum = Number(onlineVersion.replace(/\./g, ""));
26
+
27
+ console.log(chalk.green(
28
+ `
29
+ ********************************************************************************
30
+ * *
31
+ * CloudCC CLI *
32
+ * *
33
+ * 当前版本:V${config.version} *
34
+ * 最新版本:V${onlineVersion} *
35
+ * 更新内容:https://npmmirror.com/package/cloudcc-cli/home *
36
+ * *
37
+ * 开发者文档:https://cloudccone.feishu.cn/wiki/JZ7CwcRfriU8taknCKCcwKEmncd *
38
+ * *
39
+ ********************************************************************************
40
+ `
41
+ ))
42
+
25
43
  // 如果结果大于0,那么提示升级
26
44
  if (onlineVersionNum - currentVersion > 0) {
27
- console.log();
28
- console.log(chalk.green("Cloudcc-cli发现新版本!"));
29
- console.log();
30
- console.log(chalk.green("当前版本:v" + config.version));
31
- console.log(chalk.green("最新版本:v" + onlineVersion));
32
- console.log();
33
- let os = process.platform
34
- console.log(chalk.yellow(`如无法自动更新,请使用命令更新:${'darwin' == os ? 'sudo' : ''} npm install -g cloudcc-cli@${onlineVersion} --registry http://registry.npmmirror.com`));
35
45
  return onlineVersion;
36
46
  }
37
47
  return null;
@@ -59,8 +69,10 @@ function askUpdate() {
59
69
  */
60
70
  function update(onlineVersion) {
61
71
  console.log()
62
- console.log(chalk.green("升级中,请稍后..."));
72
+ console.log(chalk.green("升级中,预计3分钟完成,请稍后..."));
73
+ console.log()
63
74
  let os = process.platform
75
+ console.log(chalk.yellow(`如无法自动更新,请使用命令更新:${'darwin' == os ? 'sudo' : ''} npm install -g cloudcc-cli@${onlineVersion} --registry http://registry.npmmirror.com`));
64
76
  exec(`${'darwin' == os ? 'sudo' : ''} npm install -g cloudcc-cli@${onlineVersion} --registry http://registry.npmmirror.com`)
65
77
  console.log()
66
78
  console.log(chalk.green("升级完成!请重新运行"));
@@ -74,6 +86,7 @@ async function checkUpdate() {
74
86
  try {
75
87
  onlineVersion = checkNpmVersion();
76
88
  } catch (error) {
89
+ console.log("error", error)
77
90
  onlineVersion = false;
78
91
  }
79
92
  if (onlineVersion) {
package/utils/http.js CHANGED
@@ -1,5 +1,4 @@
1
1
  const axios = require("axios")
2
- const encry = require("./encryption")
3
2
  const service = axios.create({
4
3
  timeout: 60000, // request timeout
5
4
  headers: {
@@ -10,7 +9,6 @@ const service = axios.create({
10
9
  // request interceptor
11
10
  service.interceptors.request.use(
12
11
  config => {
13
- // config.data = encry.en(JSON.stringify(config.data))
14
12
  return config
15
13
  },
16
14
  error => {
@@ -26,7 +24,6 @@ service.interceptors.response.use(
26
24
  if (code !== 200) {
27
25
  return Promise.reject(null == response.data.msg ? "未知异常" : response.data.msg)
28
26
  } else {
29
- // response.data= JSON.parse(encry.de(response.data));
30
27
  return response.data;
31
28
  }
32
29
  },
@@ -9,7 +9,6 @@ const { execSync } = require('child_process');
9
9
  */
10
10
  module.exports = {
11
11
  writeVersion(version, type, projectConfig, user) {
12
- console.log("start")
13
12
  try {
14
13
  // 获得分支信息
15
14
  let branch = execSync('git branch --show-current');
@@ -44,10 +43,12 @@ module.exports = {
44
43
  fs.writeFileSync("dist/version.html", versionInfo, 'utf-8');
45
44
 
46
45
  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');
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
49
  return true
50
50
  } catch (error) {
51
+ console.log(error)
51
52
  return false
52
53
  }
53
54
  }
@@ -1,4 +0,0 @@
1
- // 主要用于 Vue 的 diff 算法,为每个元素创建一个独一无二的 ID
2
- export default function generateID(randomLength = 16) {
3
- return Number(Math.random().toString().substr(2, randomLength)).toString(36)
4
- }
package/template/httpjs DELETED
@@ -1,107 +0,0 @@
1
- import axios from 'axios'
2
- const service = axios.create({
3
- timeout: 60000, // request timeout
4
- headers: {
5
- 'Content-Type': 'application/json; charset=utf-8',
6
- },
7
- })
8
-
9
- // request interceptor
10
- service.interceptors.request.use(
11
- config => {
12
- config.headers.accessToken = window.$CCDK.CCToken.getToken()
13
- return config
14
- },
15
- error => {
16
- // Do something with request error
17
- Promise.reject(error)
18
- }
19
- )
20
-
21
- // response interceptor
22
- service.interceptors.response.use(
23
- response => {
24
- const code = response.data.code || 200
25
- if (code !== 200) {
26
- return Promise.reject(null == response.data.msg ? "未知异常" : response.data.msg)
27
- } else {
28
- return response.data
29
- }
30
- },
31
- error => {
32
- return Promise.reject(error)
33
- }
34
- )
35
- const formateData = data => {
36
- return {
37
- head: {
38
- appType: 'cloudcc-plugin',
39
- appVersion: '1.0.0',
40
- accessToken: window.$CCDK.CCToken.getToken()
41
- },
42
- body: {
43
- ...data
44
- }
45
- }
46
- }
47
- export default {
48
- get: (url, data = {}, responseType = '') => {
49
- return service({
50
- url: url,
51
- method: 'get',
52
- params: data,
53
- responseType: responseType
54
- })
55
- },
56
- getLight: (url, data = {}, responseType = '') => {
57
- return service({
58
- url: url,
59
- method: 'get',
60
- params: data,
61
- responseType: responseType
62
- })
63
- },
64
- postLight: (url, data = {}) => {
65
- return service({
66
- url: url,
67
- method: 'post',
68
- data: { ...data },
69
- })
70
- },
71
- post: (url, data = {}, responseType = '') => {
72
- return service({
73
- url: url,
74
- method: 'post',
75
- data: formateData(data),
76
- responseType: responseType
77
- })
78
- },
79
- postParams: (url, data = {}) => {
80
- return service({
81
- url: url,
82
- method: 'post',
83
- params: data
84
- })
85
- },
86
- patch: (url, data = {}) => {
87
- return service({
88
- url: url,
89
- method: 'patch',
90
- data: formateData(data)
91
- })
92
- },
93
- delete: (url, data = {}) => {
94
- return service({
95
- url: url,
96
- method: 'delete',
97
- data: formateData(data)
98
- })
99
- },
100
- put: (url, data = {}) => {
101
- return service({
102
- url: url,
103
- method: 'put',
104
- data: formateData(data)
105
- })
106
- }
107
- }
package/test/index.html DELETED
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
- <title>开发日志</title>
9
- </head>
10
-
11
- <body>
12
-
13
- </body>
14
-
15
- </html>
package/test/test.js DELETED
@@ -1,6 +0,0 @@
1
- let versions = ["A-V", "bbbb-V", "B", "C", "D"]
2
- let version;
3
- version = versions.find((item) => {
4
- return item.includes("-V");
5
- })
6
- console.log(version);