cloudcc-cli 1.2.9 → 1.3.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.
Files changed (43) hide show
  1. package/README.md +896 -888
  2. package/bin/build.js +6 -6
  3. package/bin/buildccbasesdk.js +6 -6
  4. package/bin/buildccsdk.js +6 -6
  5. package/bin/buildtag.js +6 -6
  6. package/bin/create.js +6 -6
  7. package/bin/publish.js +6 -6
  8. package/bin/publishh5.js +6 -6
  9. package/package.json +39 -39
  10. package/src/buildTag.js +74 -74
  11. package/src/builderBaseSDK.js +89 -89
  12. package/src/builderPlugin.js +209 -209
  13. package/src/builderSDK.js +160 -160
  14. package/src/creatorTemProject.js +90 -90
  15. package/src/publishProject.js +239 -239
  16. package/src/publishProjectH5.js +180 -180
  17. package/template/Appvue +35 -35
  18. package/template/babelconfigjs +5 -5
  19. package/template/generateIDjs +4 -4
  20. package/template/httpjs +107 -108
  21. package/template/index.js +65 -65
  22. package/template/indexhtml +21 -21
  23. package/template/indexvue +343 -343
  24. package/template/mainjs +16 -16
  25. package/template/package-lockjson +12154 -12154
  26. package/template/packagejson +58 -58
  27. package/template/vueconfigjs +20 -20
  28. package/test/index.html +14 -14
  29. package/test/test.js +5 -5
  30. package/utils/askTool.js +95 -95
  31. package/utils/changeVersion copy.js +74 -74
  32. package/utils/changeVersion.js +26 -26
  33. package/utils/checkVersion.js +90 -90
  34. package/utils/deploy.js +8 -8
  35. package/utils/encryption.js +20 -20
  36. package/utils/github-markdown.min.css +1 -1
  37. package/utils/http.js +95 -95
  38. package/utils/md2html.js +88 -88
  39. package/utils/notifyIM.js +86 -86
  40. package/utils/pushCode.js +186 -186
  41. package/utils/test.js +1 -1
  42. package/utils/trigger.js +15 -15
  43. package/utils/updatei18n.js +126 -126
package/template/httpjs CHANGED
@@ -1,108 +1,107 @@
1
- import axios from 'axios'
2
- import packageJson from '../package.json'
3
- const service = axios.create({
4
- timeout: 60000, // request timeout
5
- headers: {
6
- 'Content-Type': 'application/json; charset=utf-8',
7
- },
8
- })
9
-
10
- // request interceptor
11
- service.interceptors.request.use(
12
- config => {
13
- config.headers.accessToken = window.$CCDK.CCToken.getToken()
14
- return config
15
- },
16
- error => {
17
- // Do something with request error
18
- Promise.reject(error)
19
- }
20
- )
21
-
22
- // response interceptor
23
- service.interceptors.response.use(
24
- response => {
25
- const code = response.data.code || 200
26
- if (code !== 200) {
27
- return Promise.reject(null == response.data.msg ? "未知异常" : response.data.msg)
28
- } else {
29
- return response.data
30
- }
31
- },
32
- error => {
33
- return Promise.reject(error)
34
- }
35
- )
36
- const formateData = data => {
37
- return {
38
- head: {
39
- appType: packageJson.name,
40
- appVersion: packageJson.version,
41
- accessToken: window.$CCDK.CCToken.getToken()
42
- },
43
- body: {
44
- ...data
45
- }
46
- }
47
- }
48
- export default {
49
- get: (url, data = {}, responseType = '') => {
50
- return service({
51
- url: url,
52
- method: 'get',
53
- params: data,
54
- responseType: responseType
55
- })
56
- },
57
- getLight: (url, data = {}, responseType = '') => {
58
- return service({
59
- url: url,
60
- method: 'get',
61
- params: data,
62
- responseType: responseType
63
- })
64
- },
65
- postLight: (url, data = {}) => {
66
- return service({
67
- url: url,
68
- method: 'post',
69
- data: { ...data },
70
- })
71
- },
72
- post: (url, data = {}, responseType = '') => {
73
- return service({
74
- url: url,
75
- method: 'post',
76
- data: formateData(data),
77
- responseType: responseType
78
- })
79
- },
80
- postParams: (url, data = {}) => {
81
- return service({
82
- url: url,
83
- method: 'post',
84
- params: data
85
- })
86
- },
87
- patch: (url, data = {}) => {
88
- return service({
89
- url: url,
90
- method: 'patch',
91
- data: formateData(data)
92
- })
93
- },
94
- delete: (url, data = {}) => {
95
- return service({
96
- url: url,
97
- method: 'delete',
98
- data: formateData(data)
99
- })
100
- },
101
- put: (url, data = {}) => {
102
- return service({
103
- url: url,
104
- method: 'put',
105
- data: formateData(data)
106
- })
107
- }
108
- }
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/template/index.js CHANGED
@@ -1,66 +1,66 @@
1
- const fs = require("fs");
2
- const chalk = require("chalk")
3
- const path = require("path")
4
- module.exports = function (creator, options, callback) {
5
- const { name, description } = options;
6
-
7
- const cwd = process.cwd();
8
-
9
-
10
- const projectPath = path.join(cwd, name);
11
- const pluginPath = path.join(projectPath, "plugin");
12
- const src = path.join(projectPath, "src");
13
- const utils = path.join(projectPath, "utils");
14
- const public = path.join(projectPath, "public");
15
-
16
- //新建项目目录
17
- //同步创建目录,以免文件目录不对齐
18
- fs.mkdirSync(projectPath)
19
- fs.mkdirSync(pluginPath)
20
- fs.mkdirSync(src)
21
- fs.mkdirSync(public)
22
-
23
- creator.copyTpl('packagejson', path.join(projectPath, "package.json"), {
24
- name, description
25
- })
26
-
27
- creator.copyTpl('package-lockjson', path.join(projectPath, "package-lock.json"), {
28
- name, description
29
- })
30
-
31
- creator.copyTpl('vueconfigjs', path.join(projectPath, "vue.config.js"))
32
-
33
- creator.copyTpl('babelconfigjs', path.join(projectPath, "babel.config.js"))
34
-
35
- creator.copyTpl('mainjs', path.join(src, "main.js"))
36
-
37
- creator.copyTpl('Appvue', path.join(src, "App.vue"))
38
-
39
- creator.copyTpl('httpjs', path.join(utils, "http.js"))
40
-
41
- creator.copyTpl('generateIDjs', path.join(utils, "generateID.js"))
42
-
43
- creator.copyTpl('indexvue', path.join(pluginPath, "index.vue"))
44
-
45
- creator.copyTpl('indexhtml', path.join(public, "index.html"))
46
-
47
-
48
- creator.fs.commit(() => {
49
- console.log();
50
- console.log(`${chalk.grey(`创建项目: ${name}`)} ${chalk.green('✔ ')}`);
51
- console.log(`${chalk.grey(`创建目录: ${name}/plugin`)} ${chalk.green('✔ ')}`);
52
- console.log(`${chalk.grey(`创建文件: ${name}/plugin/index.vue`)} ${chalk.green('✔ ')}`);
53
-
54
- console.log(`${chalk.grey(`创建目录: ${name}/public`)} ${chalk.green('✔ ')}`);
55
- console.log(`${chalk.grey(`创建文件: ${name}/plugin/index.html`)} ${chalk.green('✔ ')}`);
56
-
57
- console.log(`${chalk.grey(`创建目录: ${name}/src`)} ${chalk.green('✔ ')}`);
58
- console.log(`${chalk.grey(`创建文件: ${name}/src/App.vue`)} ${chalk.green('✔ ')}`);
59
- console.log(`${chalk.grey(`创建文件: ${name}/src/main.js`)} ${chalk.green('✔ ')}`);
60
-
61
- console.log(`${chalk.grey(`创建文件: ${name}/babel.config.js`)} ${chalk.green('✔ ')}`);
62
- console.log(`${chalk.grey(`创建文件: ${name}/package.json`)} ${chalk.green('✔ ')}`);
63
- console.log(`${chalk.grey(`创建文件: ${name}/vue.config.js`)} ${chalk.green('✔ ')}`);
64
- callback();
65
- });
1
+ const fs = require("fs");
2
+ const chalk = require("chalk")
3
+ const path = require("path")
4
+ module.exports = function (creator, options, callback) {
5
+ const { name, description } = options;
6
+
7
+ const cwd = process.cwd();
8
+
9
+
10
+ const projectPath = path.join(cwd, name);
11
+ const pluginPath = path.join(projectPath, "plugin");
12
+ const src = path.join(projectPath, "src");
13
+ const utils = path.join(projectPath, "utils");
14
+ const public = path.join(projectPath, "public");
15
+
16
+ //新建项目目录
17
+ //同步创建目录,以免文件目录不对齐
18
+ fs.mkdirSync(projectPath)
19
+ fs.mkdirSync(pluginPath)
20
+ fs.mkdirSync(src)
21
+ fs.mkdirSync(public)
22
+
23
+ creator.copyTpl('packagejson', path.join(projectPath, "package.json"), {
24
+ name, description
25
+ })
26
+
27
+ creator.copyTpl('package-lockjson', path.join(projectPath, "package-lock.json"), {
28
+ name, description
29
+ })
30
+
31
+ creator.copyTpl('vueconfigjs', path.join(projectPath, "vue.config.js"))
32
+
33
+ creator.copyTpl('babelconfigjs', path.join(projectPath, "babel.config.js"))
34
+
35
+ creator.copyTpl('mainjs', path.join(src, "main.js"))
36
+
37
+ creator.copyTpl('Appvue', path.join(src, "App.vue"))
38
+
39
+ creator.copyTpl('httpjs', path.join(utils, "http.js"))
40
+
41
+ creator.copyTpl('generateIDjs', path.join(utils, "generateID.js"))
42
+
43
+ creator.copyTpl('indexvue', path.join(pluginPath, "index.vue"))
44
+
45
+ creator.copyTpl('indexhtml', path.join(public, "index.html"))
46
+
47
+
48
+ creator.fs.commit(() => {
49
+ console.log();
50
+ console.log(`${chalk.grey(`创建项目: ${name}`)} ${chalk.green('✔ ')}`);
51
+ console.log(`${chalk.grey(`创建目录: ${name}/plugin`)} ${chalk.green('✔ ')}`);
52
+ console.log(`${chalk.grey(`创建文件: ${name}/plugin/index.vue`)} ${chalk.green('✔ ')}`);
53
+
54
+ console.log(`${chalk.grey(`创建目录: ${name}/public`)} ${chalk.green('✔ ')}`);
55
+ console.log(`${chalk.grey(`创建文件: ${name}/plugin/index.html`)} ${chalk.green('✔ ')}`);
56
+
57
+ console.log(`${chalk.grey(`创建目录: ${name}/src`)} ${chalk.green('✔ ')}`);
58
+ console.log(`${chalk.grey(`创建文件: ${name}/src/App.vue`)} ${chalk.green('✔ ')}`);
59
+ console.log(`${chalk.grey(`创建文件: ${name}/src/main.js`)} ${chalk.green('✔ ')}`);
60
+
61
+ console.log(`${chalk.grey(`创建文件: ${name}/babel.config.js`)} ${chalk.green('✔ ')}`);
62
+ console.log(`${chalk.grey(`创建文件: ${name}/package.json`)} ${chalk.green('✔ ')}`);
63
+ console.log(`${chalk.grey(`创建文件: ${name}/vue.config.js`)} ${chalk.green('✔ ')}`);
64
+ callback();
65
+ });
66
66
  }
@@ -1,22 +1,22 @@
1
- <!DOCTYPE html>
2
- <html lang="">
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>
9
- Cloudcc Plugin Dev
10
- </title>
11
- </head>
12
-
13
- <body>
14
- <noscript>
15
- <strong>We're sorry but Cloudcc Plugin Dev doesn't work properly without JavaScript enabled.
16
- Please enable it to continue.</strong>
17
- </noscript>
18
- <div id="app"></div>
19
- <!-- built files will be auto injected -->
20
- </body>
21
-
1
+ <!DOCTYPE html>
2
+ <html lang="">
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>
9
+ Cloudcc Plugin Dev
10
+ </title>
11
+ </head>
12
+
13
+ <body>
14
+ <noscript>
15
+ <strong>We're sorry but Cloudcc Plugin Dev doesn't work properly without JavaScript enabled.
16
+ Please enable it to continue.</strong>
17
+ </noscript>
18
+ <div id="app"></div>
19
+ <!-- built files will be auto injected -->
20
+ </body>
21
+
22
22
  </html>