cloudcc-cli 1.8.7 → 1.8.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.
Files changed (57) hide show
  1. package/README.md +1326 -1312
  2. package/bin/cc.js +49 -49
  3. package/bin/plugin.js +5 -5
  4. package/bin/project.js +5 -5
  5. package/core/core/ServiceResult.java +35 -35
  6. package/core/core/UserInfo.java +45 -45
  7. package/package.json +34 -34
  8. package/src/classes/create.js +43 -43
  9. package/src/classes/index.js +8 -8
  10. package/src/classes/publish.js +45 -45
  11. package/src/config/get.js +20 -20
  12. package/src/config/index.js +8 -8
  13. package/src/config/use.js +14 -14
  14. package/src/object/get.js +35 -35
  15. package/src/object/index.js +7 -7
  16. package/src/plugin/create.js +70 -70
  17. package/src/plugin/create1.js +58 -58
  18. package/src/plugin/index.js +8 -8
  19. package/src/plugin/publish.js +267 -267
  20. package/src/plugin/publish1.js +297 -297
  21. package/src/plugin/readme.md +6 -6
  22. package/src/project/create.js +83 -83
  23. package/src/project/create1.js +105 -105
  24. package/src/project/index.js +7 -7
  25. package/src/recordType/get.js +13 -13
  26. package/src/recordType/index.js +7 -7
  27. package/src/script/create.js +35 -35
  28. package/src/script/index.js +8 -8
  29. package/src/script/publish.js +71 -51
  30. package/src/timer/create.js +29 -29
  31. package/src/timer/index.js +8 -8
  32. package/src/timer/publish.js +47 -47
  33. package/src/token/get.js +11 -11
  34. package/src/token/index.js +7 -7
  35. package/src/triggers/create.js +39 -39
  36. package/src/triggers/index.js +8 -8
  37. package/src/triggers/publish.js +53 -53
  38. package/template/Appvue +24 -24
  39. package/template/babelconfigjs +5 -5
  40. package/template/demojava +14 -14
  41. package/template/gitignore +13 -13
  42. package/template/index.js +57 -57
  43. package/template/indexhtml +21 -21
  44. package/template/indexvue +29 -29
  45. package/template/javaconfigjson +2 -2
  46. package/template/mainjs +13 -13
  47. package/template/package-lockjson +13952 -13952
  48. package/template/packagejson +42 -42
  49. package/template/vueconfigjs +21 -21
  50. package/tool/branch/index.js +25 -25
  51. package/tool/checkLange/checkLang.js +68 -68
  52. package/tool/checkLange/clearLang.js +85 -85
  53. package/utils/cache.js +31 -31
  54. package/utils/checkVersion.js +107 -107
  55. package/utils/config.js +18 -18
  56. package/utils/http.js +123 -123
  57. package/utils/utils.js +95 -95
@@ -1,107 +1,107 @@
1
- const config = require("../package.json")
2
- const inquirer = require("inquirer")
3
- const exec = require('child_process').execSync;
4
- const chalk = require("chalk")
5
- const { readCache, writeCache } = require("./cache")
6
-
7
- function checkNpmVersion() {
8
- let currentVersion = Number(config.version.replace(/\./g, ""));
9
- let onlineVersionNum
10
- let onlineVersion = '0.0.1'
11
-
12
- // 获取在线版本
13
- onlineVersion = exec(`npm view cloudcc-cli version --registry http://registry.npmmirror.com`)
14
- onlineVersion = onlineVersion.toString("utf8").trim();
15
-
16
- // 获取发布时间信息
17
- const timeInfo = exec(`npm view cloudcc-cli time --json --registry http://registry.npmmirror.com`)
18
- const timeData = JSON.parse(timeInfo.toString().trim());
19
- const formattedTime = new Date(timeData[onlineVersion]).toLocaleString('zh-CN', {
20
- year: 'numeric',
21
- month: '2-digit',
22
- day: '2-digit'
23
- });
24
-
25
- onlineVersionNum = Number(onlineVersion.replace(/\./g, ""));
26
-
27
- console.log('\n');
28
- console.log(chalk.bold.cyan(' CloudCC CLI Version\n'));
29
- console.log(' ' + chalk.gray('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
30
- console.log(' ' + chalk.green('★') + ' Current Version : ' + chalk.bold.green('v' + config.version));
31
- console.log(' ' + chalk.blue('★') + ' Latest Version : ' + chalk.bold.blue('v' + onlineVersion));
32
- console.log(' ' + chalk.yellow('★') + ' Published At : ' + chalk.gray(formattedTime));
33
- console.log(' ' + chalk.gray('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
34
-
35
- if (onlineVersionNum - currentVersion > 0) {
36
- return onlineVersion;
37
- }
38
- return null;
39
- }
40
-
41
-
42
- function askUpdate() {
43
- console.log();
44
- const prompt = [{
45
- type: 'list',
46
- message: 'Do you want to perform automatic upgrade?',
47
- name: 'update',
48
- choices: [
49
- "Yes", 'No'
50
- ],
51
- }];
52
- return inquirer.prompt(prompt)
53
- }
54
-
55
-
56
- function update(onlineVersion) {
57
- console.log()
58
- console.log(chalk.green("Upgrading, estimated to be completed in 3 minutes, please wait..."));
59
- console.log()
60
- let os = process.platform
61
- console.log(chalk.yellow(`If it fails to update automatically, please use the command to update:${'darwin' == os ? 'sudo' : ''} npm install -g cloudcc-cli@${onlineVersion} --registry http://registry.npmmirror.com`));
62
- exec(`${'darwin' == os ? 'sudo' : ''} npm install -g cloudcc-cli@${onlineVersion} --registry http://registry.npmmirror.com`)
63
- console.log()
64
- console.log(chalk.green("Upgrade completed! Please re-run"));
65
- }
66
-
67
-
68
- async function checkUpdate(path = process.cwd()) {
69
- // 检查缓存
70
- const cache = readCache(path);
71
- const cacheKey = 'version_check';
72
- const now = Date.now();
73
- const oneHour = 60 * 60 * 1000;
74
-
75
- // 如果缓存有效,跳过版本检查
76
- if (cache[cacheKey] &&
77
- cache[cacheKey].timestamp &&
78
- (now - cache[cacheKey].timestamp) < oneHour) {
79
- return false;
80
- }
81
-
82
- let onlineVersion;
83
- try {
84
- onlineVersion = checkNpmVersion();
85
- // 更新缓存
86
- cache[cacheKey] = {
87
- timestamp: now
88
- };
89
- writeCache(path, cache);
90
- } catch (error) {
91
- console.log("error", error)
92
- onlineVersion = false;
93
- }
94
-
95
- if (onlineVersion) {
96
- let res = await askUpdate()
97
- if ("Yes" == res.update) {
98
- update(onlineVersion)
99
- return true;
100
- } else {
101
- return false
102
- }
103
- }
104
- return false
105
- }
106
-
107
- module.exports = { checkUpdate }
1
+ const config = require("../package.json")
2
+ const inquirer = require("inquirer")
3
+ const exec = require('child_process').execSync;
4
+ const chalk = require("chalk")
5
+ const { readCache, writeCache } = require("./cache")
6
+
7
+ function checkNpmVersion() {
8
+ let currentVersion = Number(config.version.replace(/\./g, ""));
9
+ let onlineVersionNum
10
+ let onlineVersion = '0.0.1'
11
+
12
+ // 获取在线版本
13
+ onlineVersion = exec(`npm view cloudcc-cli version --registry http://registry.npmmirror.com`)
14
+ onlineVersion = onlineVersion.toString("utf8").trim();
15
+
16
+ // 获取发布时间信息
17
+ const timeInfo = exec(`npm view cloudcc-cli time --json --registry http://registry.npmmirror.com`)
18
+ const timeData = JSON.parse(timeInfo.toString().trim());
19
+ const formattedTime = new Date(timeData[onlineVersion]).toLocaleString('zh-CN', {
20
+ year: 'numeric',
21
+ month: '2-digit',
22
+ day: '2-digit'
23
+ });
24
+
25
+ onlineVersionNum = Number(onlineVersion.replace(/\./g, ""));
26
+
27
+ console.log('\n');
28
+ console.log(chalk.bold.cyan(' CloudCC CLI Version\n'));
29
+ console.log(' ' + chalk.gray('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
30
+ console.log(' ' + chalk.green('★') + ' Current Version : ' + chalk.bold.green('v' + config.version));
31
+ console.log(' ' + chalk.blue('★') + ' Latest Version : ' + chalk.bold.blue('v' + onlineVersion));
32
+ console.log(' ' + chalk.yellow('★') + ' Published At : ' + chalk.gray(formattedTime));
33
+ console.log(' ' + chalk.gray('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
34
+
35
+ if (onlineVersionNum - currentVersion > 0) {
36
+ return onlineVersion;
37
+ }
38
+ return null;
39
+ }
40
+
41
+
42
+ function askUpdate() {
43
+ console.log();
44
+ const prompt = [{
45
+ type: 'list',
46
+ message: 'Do you want to perform automatic upgrade?',
47
+ name: 'update',
48
+ choices: [
49
+ "Yes", 'No'
50
+ ],
51
+ }];
52
+ return inquirer.prompt(prompt)
53
+ }
54
+
55
+
56
+ function update(onlineVersion) {
57
+ console.log()
58
+ console.log(chalk.green("Upgrading, estimated to be completed in 3 minutes, please wait..."));
59
+ console.log()
60
+ let os = process.platform
61
+ console.log(chalk.yellow(`If it fails to update automatically, please use the command to update:${'darwin' == os ? 'sudo' : ''} npm install -g cloudcc-cli@${onlineVersion} --registry http://registry.npmmirror.com`));
62
+ exec(`${'darwin' == os ? 'sudo' : ''} npm install -g cloudcc-cli@${onlineVersion} --registry http://registry.npmmirror.com`)
63
+ console.log()
64
+ console.log(chalk.green("Upgrade completed! Please re-run"));
65
+ }
66
+
67
+
68
+ async function checkUpdate(path = process.cwd()) {
69
+ // 检查缓存
70
+ const cache = readCache(path);
71
+ const cacheKey = 'version_check';
72
+ const now = Date.now();
73
+ const oneHour = 60 * 60 * 1000;
74
+
75
+ // 如果缓存有效,跳过版本检查
76
+ if (cache[cacheKey] &&
77
+ cache[cacheKey].timestamp &&
78
+ (now - cache[cacheKey].timestamp) < oneHour) {
79
+ return false;
80
+ }
81
+
82
+ let onlineVersion;
83
+ try {
84
+ onlineVersion = checkNpmVersion();
85
+ // 更新缓存
86
+ cache[cacheKey] = {
87
+ timestamp: now
88
+ };
89
+ writeCache(path, cache);
90
+ } catch (error) {
91
+ console.log("error", error)
92
+ onlineVersion = false;
93
+ }
94
+
95
+ if (onlineVersion) {
96
+ let res = await askUpdate()
97
+ if ("Yes" == res.update) {
98
+ update(onlineVersion)
99
+ return true;
100
+ } else {
101
+ return false
102
+ }
103
+ }
104
+ return false
105
+ }
106
+
107
+ module.exports = { checkUpdate }
package/utils/config.js CHANGED
@@ -1,18 +1,18 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
-
4
- function getPackageJson_old(projectPath = process.cwd()) {
5
- const packageJson = JSON.parse(fs.readFileSync(path.join(projectPath, "package.json")), 'utf8');
6
- return packageJson.devConsoleConfig;
7
- }
8
-
9
- function getPackageJson(projectPath = process.cwd()) {
10
- let config = getPackageJson_old(projectPath);
11
- if (!config) {
12
- config = require(path.join(projectPath, "cloudcc-cli.config.js"))
13
- config = config[config.use]
14
- }
15
- return config
16
- }
17
-
18
- module.exports = { getPackageJson }
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ function getPackageJson_old(projectPath = process.cwd()) {
5
+ const packageJson = JSON.parse(fs.readFileSync(path.join(projectPath, "package.json")), 'utf8');
6
+ return packageJson.devConsoleConfig;
7
+ }
8
+
9
+ function getPackageJson(projectPath = process.cwd()) {
10
+ let config = getPackageJson_old(projectPath);
11
+ if (!config) {
12
+ config = require(path.join(projectPath, "cloudcc-cli.config.js"))
13
+ config = config[config.use]
14
+ }
15
+ return config
16
+ }
17
+
18
+ module.exports = { getPackageJson }
package/utils/http.js CHANGED
@@ -1,123 +1,123 @@
1
- const https = require("https")
2
- const http = require("http")
3
- const axios = require("axios")
4
- const { getPackageJson } = require("./config")
5
-
6
- const httpsAgent = new https.Agent({
7
- rejectUnauthorized: false,
8
- })
9
- const httpAgent = new http.Agent({
10
- rejectUnauthorized: false,
11
- })
12
- axios.defaults.httpsAgent = httpsAgent
13
- axios.defaults.httpAgent = httpAgent
14
-
15
- const service = axios.create({
16
- timeout: 60000,
17
- headers: {
18
- 'Content-Type': 'application/json; charset=utf-8',
19
- },
20
- })
21
-
22
-
23
- service.interceptors.request.use(
24
- config => {
25
- if (global.accessToken) {
26
- config.headers.accessToken = global.accessToken
27
- }
28
- return config
29
- },
30
- error => {
31
-
32
- Promise.reject(error)
33
- }
34
- )
35
-
36
-
37
- service.interceptors.response.use(
38
- response => {
39
- const code = response.data.code || 200
40
- if (code !== 200) {
41
- return Promise.reject(null == response.data.msg ? "Unknown exception" : response.data.msg)
42
- } else {
43
- return response.data;
44
- }
45
- },
46
- error => {
47
- return Promise.reject(error)
48
- }
49
- )
50
- const formateData = (data, header) => {
51
- if (header) {
52
- Object.assign(header, { source: getPackageJson().source || "cloudcc_cli" })
53
- }
54
- return {
55
- head: {
56
- ...header
57
- },
58
- body: {
59
- ...data
60
- }
61
- }
62
- }
63
- module.exports = {
64
- get: (url, data = {}, responseType = '') => {
65
- return service({
66
- url: url,
67
- method: 'get',
68
- params: formateData(data),
69
- responseType: responseType
70
- })
71
- },
72
- getParams: (url, data = {}) => {
73
- return service({
74
- url: url,
75
- method: 'get',
76
- params: data,
77
- })
78
- },
79
- post: (url, data = {}, header = { appVersion: "1.0.0" }, responseType = '') => {
80
- return service({
81
- url: url,
82
- method: 'post',
83
- data: formateData(data, header),
84
- responseType: responseType
85
- })
86
- },
87
- postParams: (url, data = {}) => {
88
- return service({
89
- url: url,
90
- method: 'post',
91
- params: data,
92
- })
93
- },
94
- postNormal: (url, data = {}) => {
95
- return service({
96
- url: url,
97
- method: 'post',
98
- data: data
99
- })
100
- },
101
- patch: (url, data = {}) => {
102
- return service({
103
- url: url,
104
- method: 'patch',
105
- data: formateData(data)
106
- })
107
- },
108
- delete: (url, data = {}) => {
109
- return service({
110
- url: url,
111
- method: 'delete',
112
- data: formateData(data)
113
- })
114
- },
115
- put: (url, data = {}) => {
116
- return service({
117
- url: url,
118
- method: 'put',
119
- data: formateData(data)
120
- })
121
- }
122
-
123
- }
1
+ const https = require("https")
2
+ const http = require("http")
3
+ const axios = require("axios")
4
+ const { getPackageJson } = require("./config")
5
+
6
+ const httpsAgent = new https.Agent({
7
+ rejectUnauthorized: false,
8
+ })
9
+ const httpAgent = new http.Agent({
10
+ rejectUnauthorized: false,
11
+ })
12
+ axios.defaults.httpsAgent = httpsAgent
13
+ axios.defaults.httpAgent = httpAgent
14
+
15
+ const service = axios.create({
16
+ timeout: 60000,
17
+ headers: {
18
+ 'Content-Type': 'application/json; charset=utf-8',
19
+ },
20
+ })
21
+
22
+
23
+ service.interceptors.request.use(
24
+ config => {
25
+ if (global.accessToken) {
26
+ config.headers.accessToken = global.accessToken
27
+ }
28
+ return config
29
+ },
30
+ error => {
31
+
32
+ Promise.reject(error)
33
+ }
34
+ )
35
+
36
+
37
+ service.interceptors.response.use(
38
+ response => {
39
+ const code = response.data.code || 200
40
+ if (code !== 200) {
41
+ return Promise.reject(null == response.data.msg ? "Unknown exception" : response.data.msg)
42
+ } else {
43
+ return response.data;
44
+ }
45
+ },
46
+ error => {
47
+ return Promise.reject(error)
48
+ }
49
+ )
50
+ const formateData = (data, header) => {
51
+ if (header) {
52
+ Object.assign(header, { source: getPackageJson().source || "cloudcc_cli" })
53
+ }
54
+ return {
55
+ head: {
56
+ ...header
57
+ },
58
+ body: {
59
+ ...data
60
+ }
61
+ }
62
+ }
63
+ module.exports = {
64
+ get: (url, data = {}, responseType = '') => {
65
+ return service({
66
+ url: url,
67
+ method: 'get',
68
+ params: formateData(data),
69
+ responseType: responseType
70
+ })
71
+ },
72
+ getParams: (url, data = {}) => {
73
+ return service({
74
+ url: url,
75
+ method: 'get',
76
+ params: data,
77
+ })
78
+ },
79
+ post: (url, data = {}, header = { appVersion: "1.0.0" }, responseType = '') => {
80
+ return service({
81
+ url: url,
82
+ method: 'post',
83
+ data: formateData(data, header),
84
+ responseType: responseType
85
+ })
86
+ },
87
+ postParams: (url, data = {}) => {
88
+ return service({
89
+ url: url,
90
+ method: 'post',
91
+ params: data,
92
+ })
93
+ },
94
+ postNormal: (url, data = {}) => {
95
+ return service({
96
+ url: url,
97
+ method: 'post',
98
+ data: data
99
+ })
100
+ },
101
+ patch: (url, data = {}) => {
102
+ return service({
103
+ url: url,
104
+ method: 'patch',
105
+ data: formateData(data)
106
+ })
107
+ },
108
+ delete: (url, data = {}) => {
109
+ return service({
110
+ url: url,
111
+ method: 'delete',
112
+ data: formateData(data)
113
+ })
114
+ },
115
+ put: (url, data = {}) => {
116
+ return service({
117
+ url: url,
118
+ method: 'put',
119
+ data: formateData(data)
120
+ })
121
+ }
122
+
123
+ }