cloudcc-cli 1.6.4 → 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 (67) hide show
  1. package/README.md +1176 -1161
  2. package/bin/cc.js +49 -49
  3. package/bin/plugin.js +6 -6
  4. package/bin/project.js +6 -6
  5. package/core/core/CCObject.java +48 -0
  6. package/core/core/CCService.java +806 -0
  7. package/core/core/CCTrigger.java +23 -0
  8. package/core/core/CCTriggerHandler.java +15 -0
  9. package/core/core/DevLogger.java +39 -0
  10. package/core/core/OperatationEnum.java +5 -0
  11. package/core/core/PeakInterf.java +6 -0
  12. package/core/core/PeakSvc.java +8 -0
  13. package/core/core/ServiceResult.java +35 -0
  14. package/core/core/TriggerInvoker.java +83 -0
  15. package/core/core/TriggerMethod.java +9 -0
  16. package/core/core/TriggerTimeEnum.java +5 -0
  17. package/core/core/UserInfo.java +45 -0
  18. package/core.zip +0 -0
  19. package/package.json +34 -34
  20. package/src/classes/create.js +40 -43
  21. package/src/classes/index.js +8 -8
  22. package/src/classes/publish.js +43 -47
  23. package/src/config/get.js +20 -22
  24. package/src/config/index.js +8 -8
  25. package/src/config/use.js +14 -16
  26. package/src/object/get.js +14 -16
  27. package/src/object/index.js +7 -7
  28. package/src/plugin/create.js +70 -80
  29. package/src/plugin/create1.js +58 -66
  30. package/src/plugin/index.js +8 -8
  31. package/src/plugin/publish.js +265 -298
  32. package/src/plugin/publish1.js +256 -286
  33. package/src/project/create.js +87 -89
  34. package/src/project/create1.js +109 -111
  35. package/src/project/index.js +7 -7
  36. package/src/recordType/get.js +13 -16
  37. package/src/recordType/index.js +7 -7
  38. package/src/script/create.js +29 -32
  39. package/src/script/index.js +8 -8
  40. package/src/script/publish.js +62 -69
  41. package/src/timer/create.js +26 -29
  42. package/src/timer/index.js +8 -8
  43. package/src/timer/publish.js +43 -47
  44. package/src/token/get.js +11 -13
  45. package/src/token/index.js +7 -7
  46. package/src/triggers/create.js +27 -35
  47. package/src/triggers/index.js +8 -8
  48. package/src/triggers/publish.js +48 -51
  49. package/template/Appvue +29 -29
  50. package/template/babelconfigjs +5 -5
  51. package/template/demojava +14 -14
  52. package/template/gitignore +11 -11
  53. package/template/index.js +57 -57
  54. package/template/indexhtml +21 -21
  55. package/template/indexvue +34 -34
  56. package/template/javaconfigjson +2 -2
  57. package/template/mainjs +13 -13
  58. package/template/package-lockjson +12115 -12115
  59. package/template/packagejson +42 -42
  60. package/template/vueconfigjs +26 -26
  61. package/tool/branch/index.js +25 -0
  62. package/tool/checkLange/checkLang.js +68 -0
  63. package/tool/checkLange/clearLang.js +85 -0
  64. package/tool/checkLange/result.txt +0 -0
  65. package/utils/checkVersion.js +94 -105
  66. package/utils/http.js +122 -122
  67. package/utils/utils.js +57 -59
@@ -1,90 +1,88 @@
1
- const chalk = require("chalk")
2
- const inquirer = require("inquirer")
3
- const memFs = require("mem-fs")
4
- const memFsEditor = require("mem-fs-editor")
5
- const fs = require("fs")
6
- const path = require("path")
7
- const { checkUpdate } = require("../../utils/checkVersion")
8
- /**
9
- * 创建自定组件开发模板项目
10
- */
11
- class Creator {
12
- constructor() {
13
- this.fs = memFsEditor.create(memFs.create());
14
- this.options = {
15
- name: "",
16
- description: ""
17
- }
18
- // 当前目录
19
- this.rootPath = path.resolve(__dirname, "../../");
20
- // 模板目录
21
- this.tplDirPath = path.join(this.rootPath, "template");
22
- }
23
- // 初始化
24
- async init(name) {
25
- let res = await checkUpdate();
26
- if (!res) {
27
- console.log()
28
- console.log(chalk.green('欢迎使用CloudCC-CLI'));
29
- console.log()
30
- if (!name) {
31
- this.ask().then(answers => {
32
- this.options = Object.assign({}, this.options, answers);
33
- console.log(this.options);
34
- this.write();
35
- })
36
- } else {
37
- this.options = { name }
38
- this.write();
39
- }
40
- }
41
- }
42
- // 命令行交互
43
- ask() {
44
- const prompt = [];
45
-
46
- prompt.push({
47
- type: "input",
48
- name: "name",
49
- message: "请输入项目名称",
50
- validate(input) {
51
- if (!input) {
52
- return "请输入项目名称"
53
- }
54
-
55
- if (fs.existsSync(input)) {
56
- return "项目名已存在"
57
- }
58
-
59
- return true;
60
- }
61
- });
62
- return inquirer.prompt(prompt)
63
- }
64
- // 拷贝和写数据
65
- write() {
66
- console.log();
67
- console.log(chalk.green("开始构建,请稍后"));
68
- const tplBuilder = require("../../template/index");
69
- tplBuilder(this, this.options, () => {
70
- console.log();
71
- console.log(chalk.green('构建完成,运行前请安装依赖'))
72
- console.log();
73
- })
74
- }
75
-
76
- getTplPath(file) {
77
- return path.join(this.tplDirPath, file);
78
- }
79
-
80
- copyTpl(file, to, data = {}) {
81
- const tplPath = this.getTplPath(file);
82
- this.fs.copyTpl(tplPath, to, data);
83
- }
84
-
85
- copy(file, to) {
86
- const tplPath = this.getTplPath(file);
87
- this.fs.copy(tplPath, to)
88
- }
89
- }
1
+ const chalk = require("chalk")
2
+ const inquirer = require("inquirer")
3
+ const memFs = require("mem-fs")
4
+ const memFsEditor = require("mem-fs-editor")
5
+ const fs = require("fs")
6
+ const path = require("path")
7
+ const { checkUpdate } = require("../../utils/checkVersion")
8
+
9
+ class Creator {
10
+ constructor() {
11
+ this.fs = memFsEditor.create(memFs.create());
12
+ this.options = {
13
+ name: "",
14
+ description: ""
15
+ }
16
+
17
+ this.rootPath = path.resolve(__dirname, "../../");
18
+
19
+ this.tplDirPath = path.join(this.rootPath, "template");
20
+ }
21
+
22
+ async init(name) {
23
+ let res = await checkUpdate();
24
+ if (!res) {
25
+ console.log()
26
+ console.log(chalk.green('Welcome CloudCC-CLI'));
27
+ console.log()
28
+ if (!name) {
29
+ this.ask().then(answers => {
30
+ this.options = Object.assign({}, this.options, answers);
31
+ console.log(this.options);
32
+ this.write();
33
+ })
34
+ } else {
35
+ this.options = { name }
36
+ this.write();
37
+ }
38
+ }
39
+ }
40
+
41
+ ask() {
42
+ const prompt = [];
43
+
44
+ prompt.push({
45
+ type: "input",
46
+ name: "name",
47
+ message: "Please enter the project name",
48
+ validate(input) {
49
+ if (!input) {
50
+ return "Please enter the project name"
51
+ }
52
+
53
+ if (fs.existsSync(input)) {
54
+ return "Project name already exists"
55
+ }
56
+
57
+ return true;
58
+ }
59
+ });
60
+ return inquirer.prompt(prompt)
61
+ }
62
+
63
+ write() {
64
+ console.log();
65
+ console.log(chalk.green("Starting construction, please wait"));
66
+ const tplBuilder = require("../../template/index");
67
+ tplBuilder(this, this.options, () => {
68
+ console.log();
69
+ console.log(chalk.green('Build completed, please install dependencies before running'))
70
+ console.log();
71
+ })
72
+ }
73
+
74
+ getTplPath(file) {
75
+ return path.join(this.tplDirPath, file);
76
+ }
77
+
78
+ copyTpl(file, to, data = {}) {
79
+ const tplPath = this.getTplPath(file);
80
+ this.fs.copyTpl(tplPath, to, data);
81
+ }
82
+
83
+ copy(file, to) {
84
+ const tplPath = this.getTplPath(file);
85
+ this.fs.copy(tplPath, to)
86
+ }
87
+ }
90
88
  module.exports = Creator;
@@ -1,112 +1,110 @@
1
- const chalk = require("chalk")
2
- const inquirer = require("inquirer")
3
- const memFs = require("mem-fs")
4
- const memFsEditor = require("mem-fs-editor")
5
- const fs = require("fs")
6
- const path = require("path")
7
- const { checkUpdate } = require("../../utils/checkVersion")
8
- const tplBuilder = require("../../template/index");
9
- const execSync = require('child_process').execSync;
10
- /**
11
- * 创建自定组件开发模板项目
12
- */
13
- class Creator {
14
- constructor() {
15
- this.fs = memFsEditor.create(memFs.create());
16
- this.options = {
17
- name: "",
18
- description: ""
19
- }
20
- // 当前目录
21
- this.rootPath = path.resolve(__dirname, "../../");
22
- // 模板目录
23
- this.tplDirPath = path.join(this.rootPath, "template");
24
- }
25
- // 初始化
26
- async init(name) {
27
- let res = await checkUpdate();
28
- if (!res) {
29
- console.log()
30
- console.log(chalk.green('欢迎使用CloudCC-CLI'));
31
- console.log()
32
- if (!name) {
33
- this.ask().then(answers => {
34
- this.options = Object.assign({}, this.options, answers);
35
- console.log(this.options);
36
- this.write();
37
- })
38
- } else {
39
- this.options = { name }
40
- this.write();
41
- }
42
- }
43
- }
44
- // 命令行交互
45
- ask() {
46
- const prompt = [];
47
-
48
- prompt.push({
49
- type: "input",
50
- name: "name",
51
- message: "请输入项目名称",
52
- validate(input) {
53
- if (!input) {
54
- return "请输入项目名称"
55
- }
56
-
57
- if (fs.existsSync(input)) {
58
- return "项目名已存在"
59
- }
60
-
61
- return true;
62
- }
63
- });
64
- return inquirer.prompt(prompt)
65
- }
66
- // 拷贝和写数据
67
- write() {
68
- console.log();
69
- console.log(chalk.green("开始构建,请稍后"));
70
- tplBuilder(this, this.options, () => {
71
- console.log();
72
- this.initGit(path.join(process.cwd(), this.options.name))
73
- console.log(chalk.green('构建完成,运行前请安装依赖'))
74
- console.log();
75
- })
76
- }
77
-
78
- getTplPath(file) {
79
- return path.join(this.tplDirPath, file);
80
- }
81
-
82
- copyTpl(file, to, data = {}) {
83
- const tplPath = this.getTplPath(file);
84
- this.fs.copyTpl(tplPath, to, data);
85
- }
86
-
87
- copy(file, to) {
88
- const tplPath = this.getTplPath(file);
89
- this.fs.copy(tplPath, to)
90
- }
91
-
92
- initGit(path) {
93
- try {
94
- execSync(`git -C ${path} init`)
95
- execSync(`git -C ${path} add .`)
96
- execSync(`git -C ${path} commit -m 'init'`)
97
- console.log(`${chalk.grey(`Git仓库初始化完成`)} ${chalk.green('✔ ')}`);
98
- console.log();
99
- console.log(`${chalk.yellow(`请设置仓库地址:git remote add origin [远程仓库地址]`)}`);
100
- console.log();
101
- } catch (error) {
102
- console.log();
103
- console.log(chalk.red('git仓库初始化异常'))
104
- console.log();
105
- }
106
- }
107
- }
108
- function create(argvs) {
109
- let c = new Creator();
110
- c.init(argvs[2])
111
- }
1
+ const chalk = require("chalk")
2
+ const inquirer = require("inquirer")
3
+ const memFs = require("mem-fs")
4
+ const memFsEditor = require("mem-fs-editor")
5
+ const fs = require("fs")
6
+ const path = require("path")
7
+ const { checkUpdate } = require("../../utils/checkVersion")
8
+ const tplBuilder = require("../../template/index");
9
+ const execSync = require('child_process').execSync;
10
+
11
+ class Creator {
12
+ constructor() {
13
+ this.fs = memFsEditor.create(memFs.create());
14
+ this.options = {
15
+ name: "",
16
+ description: ""
17
+ }
18
+
19
+ this.rootPath = path.resolve(__dirname, "../../");
20
+
21
+ this.tplDirPath = path.join(this.rootPath, "template");
22
+ }
23
+
24
+ async init(name) {
25
+ let res = await checkUpdate();
26
+ if (!res) {
27
+ console.log()
28
+ console.log(chalk.green('Welcome CloudCC-CLI'));
29
+ console.log()
30
+ if (!name) {
31
+ this.ask().then(answers => {
32
+ this.options = Object.assign({}, this.options, answers);
33
+ console.log(this.options);
34
+ this.write();
35
+ })
36
+ } else {
37
+ this.options = { name }
38
+ this.write();
39
+ }
40
+ }
41
+ }
42
+
43
+ ask() {
44
+ const prompt = [];
45
+
46
+ prompt.push({
47
+ type: "input",
48
+ name: "name",
49
+ message: "Please enter the project name",
50
+ validate(input) {
51
+ if (!input) {
52
+ return "Please enter the project name"
53
+ }
54
+
55
+ if (fs.existsSync(input)) {
56
+ return "Project name already exists"
57
+ }
58
+
59
+ return true;
60
+ }
61
+ });
62
+ return inquirer.prompt(prompt)
63
+ }
64
+
65
+ write() {
66
+ console.log();
67
+ console.log(chalk.green("Starting construction, please wait"));
68
+ tplBuilder(this, this.options, () => {
69
+ console.log();
70
+ this.initGit(path.join(process.cwd(), this.options.name))
71
+ console.log(chalk.green('Build completed, please install dependencies before running'))
72
+ console.log();
73
+ })
74
+ }
75
+
76
+ getTplPath(file) {
77
+ return path.join(this.tplDirPath, file);
78
+ }
79
+
80
+ copyTpl(file, to, data = {}) {
81
+ const tplPath = this.getTplPath(file);
82
+ this.fs.copyTpl(tplPath, to, data);
83
+ }
84
+
85
+ copy(file, to) {
86
+ const tplPath = this.getTplPath(file);
87
+ this.fs.copy(tplPath, to)
88
+ }
89
+
90
+ initGit(path) {
91
+ try {
92
+ execSync(`git -C ${path} init`)
93
+ execSync(`git -C ${path} add .`)
94
+ execSync(`git -C ${path} commit -m 'init'`)
95
+ console.log(`${chalk.grey(`Git repository initialization completed`)} ${chalk.green('✔ ')}`);
96
+ console.log();
97
+ console.log(`${chalk.yellow(`Please set the warehouse address: git remote add origin [remote repository address]`)}`);
98
+ console.log();
99
+ } catch (error) {
100
+ console.log();
101
+ console.log(chalk.red('git repository initialization exception'))
102
+ console.log();
103
+ }
104
+ }
105
+ }
106
+ function create(argvs) {
107
+ let c = new Creator();
108
+ c.init(argvs[2])
109
+ }
112
110
  module.exports = create;
@@ -1,7 +1,7 @@
1
- const cc = {}
2
- cc.create = require("./create1")
3
- function Plugin(action, argvs) {
4
- cc[action](argvs)
5
- }
6
-
7
- module.exports = Plugin;
1
+ const cc = {}
2
+ cc.create = require("./create1")
3
+ function Plugin(action, argvs) {
4
+ cc[action](argvs)
5
+ }
6
+
7
+ module.exports = Plugin;
@@ -1,16 +1,13 @@
1
- const { getBusToken } = require("../../utils/utils")
2
- const { postNormal } = require("../../utils/http")
3
- /**
4
- * 获取对象的记录类型
5
- */
6
- async function get(path, prefix) {
7
- // 获取token成功后,发布内容
8
- if (await getBusToken(path)) {
9
- let url = new URL(global.baseUrl).origin
10
- let res = await postNormal(url + "/apisvc/api/batch/getRecordType", { prefix: prefix })
11
- console.log(JSON.stringify(res.data.recordTypeList))
12
- return res.data
13
- }
14
- }
15
-
16
- module.exports = get;
1
+ const { getBusToken } = require("../../utils/utils")
2
+ const { postNormal } = require("../../utils/http")
3
+
4
+ async function get(path, prefix) {
5
+
6
+ if (await getBusToken(path)) {
7
+ let res = await postNormal(global.apiSvc + "/api/batch/getRecordType", { prefix: prefix })
8
+ console.log(JSON.stringify(res.data.recordTypeList))
9
+ return res.data
10
+ }
11
+ }
12
+
13
+ module.exports = get;
@@ -1,7 +1,7 @@
1
- const cc = {}
2
- cc.get = require("./get")
3
- function main(action, argvs) {
4
- cc[action](argvs[2],argvs[3])
5
- }
6
-
7
- module.exports = main;
1
+ const cc = {}
2
+ cc.get = require("./get")
3
+ function main(action, argvs) {
4
+ cc[action](argvs[2],argvs[3])
5
+ }
6
+
7
+ module.exports = main;
@@ -1,33 +1,30 @@
1
- const { checkUpdate } = require("../../utils/checkVersion")
2
- const fs = require("fs");
3
- const path = require("path")
4
- const chalk = require("chalk")
5
- /**
6
- * 创建文件
7
- * @param {string} name 文件名称
8
- */
9
- async function create(argvs) {
10
- let res = await checkUpdate();
11
- if (!res) {
12
- let body = JSON.parse(decodeURI(argvs[2]))
13
- const filePath = path.join(process.cwd(), "script/" + body.scriptName);
14
- try {
15
- fs.mkdirSync(filePath, { recursive: true })
16
- const fileTmp =
17
- `function main($CCDK, obj){
18
- console.log("Hello CloudCC")
19
- }`
20
- fs.writeFileSync(path.join(filePath, body.scriptName + ".js"), fileTmp)
21
- fs.writeFileSync(path.join(filePath, "config.json"), JSON.stringify(body))
22
- console.log()
23
- console.log(chalk.green("创建成功:" + body.scriptName))
24
- console.log()
25
- } catch (e) {
26
- console.log()
27
- console.log(chalk.red("创建失败:" + e))
28
- console.log()
29
- }
30
- }
31
- }
32
-
1
+ const { checkUpdate } = require("../../utils/checkVersion")
2
+ const fs = require("fs");
3
+ const path = require("path")
4
+ const chalk = require("chalk")
5
+
6
+ async function create(argvs) {
7
+ let res = await checkUpdate();
8
+ if (!res) {
9
+ let body = JSON.parse(decodeURI(argvs[2]))
10
+ const filePath = path.join(process.cwd(), "script/" + body.scriptName);
11
+ try {
12
+ fs.mkdirSync(filePath, { recursive: true })
13
+ const fileTmp =
14
+ `function main($CCDK, obj){
15
+ console.log("Hello CloudCC")
16
+ }`
17
+ fs.writeFileSync(path.join(filePath, body.scriptName + ".js"), fileTmp)
18
+ fs.writeFileSync(path.join(filePath, "config.json"), JSON.stringify(body))
19
+ console.log()
20
+ console.log(chalk.green("Successfully Created:" + body.scriptName))
21
+ console.log()
22
+ } catch (e) {
23
+ console.log()
24
+ console.log(chalk.red("Creation Failed:" + e))
25
+ console.log()
26
+ }
27
+ }
28
+ }
29
+
33
30
  module.exports = create;
@@ -1,8 +1,8 @@
1
- const cc = {}
2
- cc.create = require("./create")
3
- cc.publish = require("./publish")
4
- function main(action, argvs) {
5
- cc[action](argvs)
6
- }
7
-
8
- module.exports = main;
1
+ const cc = {}
2
+ cc.create = require("./create")
3
+ cc.publish = require("./publish")
4
+ function main(action, argvs) {
5
+ cc[action](argvs)
6
+ }
7
+
8
+ module.exports = main;