cloudcc-cli 1.7.2 → 1.7.3
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 +1211 -1204
- package/bin/cc.js +49 -49
- package/bin/plugin.js +6 -6
- package/bin/project.js +6 -6
- package/core/core/ServiceResult.java +35 -35
- package/core/core/UserInfo.java +45 -45
- package/package.json +34 -34
- package/src/classes/create.js +40 -40
- package/src/classes/index.js +8 -8
- package/src/classes/publish.js +43 -43
- package/src/config/get.js +20 -20
- package/src/config/index.js +8 -8
- package/src/config/use.js +14 -14
- package/src/object/get.js +14 -14
- package/src/object/index.js +7 -7
- package/src/plugin/create.js +70 -70
- package/src/plugin/create1.js +58 -58
- package/src/plugin/index.js +8 -8
- package/src/plugin/publish.js +262 -262
- package/src/plugin/publish1.js +256 -256
- package/src/project/create.js +87 -87
- package/src/project/create1.js +109 -109
- package/src/project/index.js +7 -7
- package/src/recordType/get.js +13 -13
- package/src/recordType/index.js +7 -7
- package/src/script/create.js +29 -29
- package/src/script/index.js +8 -8
- package/src/script/publish.js +62 -62
- package/src/timer/create.js +26 -26
- package/src/timer/index.js +8 -8
- package/src/timer/publish.js +43 -43
- package/src/token/get.js +11 -11
- package/src/token/index.js +7 -7
- package/src/triggers/create.js +27 -27
- package/src/triggers/index.js +8 -8
- package/src/triggers/publish.js +48 -48
- package/template/Appvue +24 -24
- package/template/babelconfigjs +5 -5
- package/template/demojava +14 -14
- package/template/gitignore +11 -11
- package/template/index.js +57 -57
- package/template/indexhtml +21 -21
- package/template/indexvue +29 -29
- package/template/javaconfigjson +2 -2
- package/template/mainjs +13 -13
- package/template/package-lockjson +13952 -13952
- package/template/packagejson +42 -42
- package/template/vueconfigjs +21 -21
- package/tool/branch/index.js +25 -25
- package/tool/checkLange/checkLang.js +68 -68
- package/tool/checkLange/clearLang.js +85 -85
- package/utils/checkVersion.js +94 -94
- package/utils/config.js +18 -0
- package/utils/http.js +123 -123
- package/utils/utils.js +40 -58
package/bin/cc.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const chalk = require("chalk")
|
|
3
|
-
|
|
4
|
-
let argvs = process.argv.splice(2);
|
|
5
|
-
|
|
6
|
-
let action = argvs[0]
|
|
7
|
-
if (!action) {
|
|
8
|
-
console.log()
|
|
9
|
-
console.log(chalk.yellow("Please see the help documentation"));
|
|
10
|
-
console.log()
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
let type = argvs[1]
|
|
16
|
-
if (!type) {
|
|
17
|
-
console.log()
|
|
18
|
-
console.log(chalk.yellow("Please see the help documentation"));
|
|
19
|
-
console.log()
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const cc = {}
|
|
24
|
-
|
|
25
|
-
cc.project = require("../src/project/index")
|
|
26
|
-
|
|
27
|
-
cc.plugin = require("../src/plugin/index")
|
|
28
|
-
|
|
29
|
-
cc.classes = require("../src/classes/index")
|
|
30
|
-
|
|
31
|
-
cc.timer = require("../src/timer/index")
|
|
32
|
-
|
|
33
|
-
cc.triggers = require("../src/triggers/index")
|
|
34
|
-
|
|
35
|
-
cc.script = require("../src/script/index")
|
|
36
|
-
|
|
37
|
-
cc.token = require("../src/token/index")
|
|
38
|
-
|
|
39
|
-
cc.object = require("../src/object/index")
|
|
40
|
-
|
|
41
|
-
cc.recordType = require("../src/recordType/index")
|
|
42
|
-
|
|
43
|
-
cc.config = require("../src/config/index")
|
|
44
|
-
try {
|
|
45
|
-
cc[argvs[1]](argvs[0], argvs);
|
|
46
|
-
} catch (e) {
|
|
47
|
-
console.log()
|
|
48
|
-
console.log(chalk.yellow("Please see the help documentation"), e);
|
|
49
|
-
console.log()
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const chalk = require("chalk")
|
|
3
|
+
|
|
4
|
+
let argvs = process.argv.splice(2);
|
|
5
|
+
|
|
6
|
+
let action = argvs[0]
|
|
7
|
+
if (!action) {
|
|
8
|
+
console.log()
|
|
9
|
+
console.log(chalk.yellow("Please see the help documentation"));
|
|
10
|
+
console.log()
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
let type = argvs[1]
|
|
16
|
+
if (!type) {
|
|
17
|
+
console.log()
|
|
18
|
+
console.log(chalk.yellow("Please see the help documentation"));
|
|
19
|
+
console.log()
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const cc = {}
|
|
24
|
+
|
|
25
|
+
cc.project = require("../src/project/index")
|
|
26
|
+
|
|
27
|
+
cc.plugin = require("../src/plugin/index")
|
|
28
|
+
|
|
29
|
+
cc.classes = require("../src/classes/index")
|
|
30
|
+
|
|
31
|
+
cc.timer = require("../src/timer/index")
|
|
32
|
+
|
|
33
|
+
cc.triggers = require("../src/triggers/index")
|
|
34
|
+
|
|
35
|
+
cc.script = require("../src/script/index")
|
|
36
|
+
|
|
37
|
+
cc.token = require("../src/token/index")
|
|
38
|
+
|
|
39
|
+
cc.object = require("../src/object/index")
|
|
40
|
+
|
|
41
|
+
cc.recordType = require("../src/recordType/index")
|
|
42
|
+
|
|
43
|
+
cc.config = require("../src/config/index")
|
|
44
|
+
try {
|
|
45
|
+
cc[argvs[1]](argvs[0], argvs);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
console.log()
|
|
48
|
+
console.log(chalk.yellow("Please see the help documentation"), e);
|
|
49
|
+
console.log()
|
|
50
50
|
}
|
package/bin/plugin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const Builder = require("../src/plugin/publish.js");
|
|
4
|
-
|
|
5
|
-
const builder = new Builder();
|
|
6
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const Builder = require("../src/plugin/publish.js");
|
|
4
|
+
|
|
5
|
+
const builder = new Builder();
|
|
6
|
+
|
|
7
7
|
builder.init();
|
package/bin/project.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const Create = require("../src/project/create.js");
|
|
4
|
-
|
|
5
|
-
const project = new Create();
|
|
6
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const Create = require("../src/project/create.js");
|
|
4
|
+
|
|
5
|
+
const project = new Create();
|
|
6
|
+
|
|
7
7
|
project.init();
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
package com.cloudcc.core;
|
|
2
|
-
|
|
3
|
-
import com.alibaba.fastjson.JSONObject;
|
|
4
|
-
|
|
5
|
-
import java.util.HashMap;
|
|
6
|
-
|
|
7
|
-
public class ServiceResult extends HashMap {
|
|
8
|
-
public String success;
|
|
9
|
-
public String message;
|
|
10
|
-
public String Id;
|
|
11
|
-
|
|
12
|
-
public void addErrorMessage(String msg) throws Exception{
|
|
13
|
-
this.put("message",msg);
|
|
14
|
-
this.put("success","false");
|
|
15
|
-
throw new Exception(msg);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public String getMessage(){
|
|
19
|
-
return (String)this.get("message");
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public String getSuccess(){
|
|
23
|
-
return (String)this.get("success");
|
|
24
|
-
}
|
|
25
|
-
public String getId(){
|
|
26
|
-
return (String)this.get("id");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@Override
|
|
30
|
-
public String toString(){
|
|
31
|
-
JSONObject data = new JSONObject();
|
|
32
|
-
data.putAll(this);
|
|
33
|
-
return data.toString();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
package com.cloudcc.core;
|
|
2
|
+
|
|
3
|
+
import com.alibaba.fastjson.JSONObject;
|
|
4
|
+
|
|
5
|
+
import java.util.HashMap;
|
|
6
|
+
|
|
7
|
+
public class ServiceResult extends HashMap {
|
|
8
|
+
public String success;
|
|
9
|
+
public String message;
|
|
10
|
+
public String Id;
|
|
11
|
+
|
|
12
|
+
public void addErrorMessage(String msg) throws Exception{
|
|
13
|
+
this.put("message",msg);
|
|
14
|
+
this.put("success","false");
|
|
15
|
+
throw new Exception(msg);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public String getMessage(){
|
|
19
|
+
return (String)this.get("message");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public String getSuccess(){
|
|
23
|
+
return (String)this.get("success");
|
|
24
|
+
}
|
|
25
|
+
public String getId(){
|
|
26
|
+
return (String)this.get("id");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Override
|
|
30
|
+
public String toString(){
|
|
31
|
+
JSONObject data = new JSONObject();
|
|
32
|
+
data.putAll(this);
|
|
33
|
+
return data.toString();
|
|
34
|
+
}
|
|
35
|
+
}
|
package/core/core/UserInfo.java
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
package com.cloudcc.core;
|
|
2
|
-
|
|
3
|
-
import com.cloudcc.core.CCObject;
|
|
4
|
-
|
|
5
|
-
public class UserInfo extends CCObject{
|
|
6
|
-
public String binding;
|
|
7
|
-
public String getUserId() {
|
|
8
|
-
return (String)this.get("id");
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public String getRoleId() {
|
|
12
|
-
return (String)this.get("role");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public UserInfo (String username,String pwd) throws Exception {
|
|
16
|
-
this.put("userName", username);
|
|
17
|
-
this.put("password", pwd);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public UserInfo() {
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public String getLoginName(){
|
|
25
|
-
return (String)this.get("userName");
|
|
26
|
-
}
|
|
27
|
-
public String getProfileId() {
|
|
28
|
-
// TODO Auto-generated method stub
|
|
29
|
-
return (String)this.get("profileId");
|
|
30
|
-
}
|
|
31
|
-
public void setBinding(String bind){
|
|
32
|
-
this.binding = bind;
|
|
33
|
-
this.put("binding",bind);
|
|
34
|
-
}
|
|
35
|
-
public String getBinding(){
|
|
36
|
-
if (this.binding == null){
|
|
37
|
-
return (String)this.get("binding");
|
|
38
|
-
} else {
|
|
39
|
-
return this.binding;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
public String getUserName() {
|
|
43
|
-
return (String)this.get("name");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
package com.cloudcc.core;
|
|
2
|
+
|
|
3
|
+
import com.cloudcc.core.CCObject;
|
|
4
|
+
|
|
5
|
+
public class UserInfo extends CCObject{
|
|
6
|
+
public String binding;
|
|
7
|
+
public String getUserId() {
|
|
8
|
+
return (String)this.get("id");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public String getRoleId() {
|
|
12
|
+
return (String)this.get("role");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public UserInfo (String username,String pwd) throws Exception {
|
|
16
|
+
this.put("userName", username);
|
|
17
|
+
this.put("password", pwd);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public UserInfo() {
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public String getLoginName(){
|
|
25
|
+
return (String)this.get("userName");
|
|
26
|
+
}
|
|
27
|
+
public String getProfileId() {
|
|
28
|
+
// TODO Auto-generated method stub
|
|
29
|
+
return (String)this.get("profileId");
|
|
30
|
+
}
|
|
31
|
+
public void setBinding(String bind){
|
|
32
|
+
this.binding = bind;
|
|
33
|
+
this.put("binding",bind);
|
|
34
|
+
}
|
|
35
|
+
public String getBinding(){
|
|
36
|
+
if (this.binding == null){
|
|
37
|
+
return (String)this.get("binding");
|
|
38
|
+
} else {
|
|
39
|
+
return this.binding;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
public String getUserName() {
|
|
43
|
+
return (String)this.get("name");
|
|
44
|
+
}
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "cloudcc-cli",
|
|
3
|
-
"version": "1.7.
|
|
4
|
-
"description": "cloudcc-cli",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"cloudcc",
|
|
7
|
-
"cloudcc-cli"
|
|
8
|
-
],
|
|
9
|
-
"main": "./bin",
|
|
10
|
-
"author": "cloudcc",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"bin": {
|
|
13
|
-
"cloudccCreate": "bin/project.js",
|
|
14
|
-
"cloudccBuild": "bin/plugin.js",
|
|
15
|
-
"cc": "bin/cc.js"
|
|
16
|
-
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"cc-pull": "git fetch --tags -f && git pull",
|
|
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
|
-
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"axios": "^0.21.4",
|
|
23
|
-
"boxen": "^4.0.0",
|
|
24
|
-
"chalk": "^2.4.2",
|
|
25
|
-
"crypto-js": "^4.1.1",
|
|
26
|
-
"dayjs": "^1.10.7",
|
|
27
|
-
"fs-extra": "^11.2.0",
|
|
28
|
-
"inquirer": "^8.1.0",
|
|
29
|
-
"marked": "^5.0.1",
|
|
30
|
-
"mem-fs": "^2.2.1",
|
|
31
|
-
"mem-fs-editor": "^9.0.1",
|
|
32
|
-
"vue-custom-element": "^3.3.0",
|
|
33
|
-
"vue-template-compiler": "^2.6.14"
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "cloudcc-cli",
|
|
3
|
+
"version": "1.7.3",
|
|
4
|
+
"description": "cloudcc-cli",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cloudcc",
|
|
7
|
+
"cloudcc-cli"
|
|
8
|
+
],
|
|
9
|
+
"main": "./bin",
|
|
10
|
+
"author": "cloudcc",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"bin": {
|
|
13
|
+
"cloudccCreate": "bin/project.js",
|
|
14
|
+
"cloudccBuild": "bin/plugin.js",
|
|
15
|
+
"cc": "bin/cc.js"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"cc-pull": "git fetch --tags -f && git pull",
|
|
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
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"axios": "^0.21.4",
|
|
23
|
+
"boxen": "^4.0.0",
|
|
24
|
+
"chalk": "^2.4.2",
|
|
25
|
+
"crypto-js": "^4.1.1",
|
|
26
|
+
"dayjs": "^1.10.7",
|
|
27
|
+
"fs-extra": "^11.2.0",
|
|
28
|
+
"inquirer": "^8.1.0",
|
|
29
|
+
"marked": "^5.0.1",
|
|
30
|
+
"mem-fs": "^2.2.1",
|
|
31
|
+
"mem-fs-editor": "^9.0.1",
|
|
32
|
+
"vue-custom-element": "^3.3.0",
|
|
33
|
+
"vue-template-compiler": "^2.6.14"
|
|
34
|
+
}
|
|
35
35
|
}
|
package/src/classes/create.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
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(name) {
|
|
7
|
-
let res = await checkUpdate();
|
|
8
|
-
if (!res) {
|
|
9
|
-
const classesPath = path.join(process.cwd(), "classes/" + name);
|
|
10
|
-
try {
|
|
11
|
-
fs.mkdirSync(classesPath, { recursive: true })
|
|
12
|
-
const javaTmp =
|
|
13
|
-
`public class ${name}{
|
|
14
|
-
private UserInfo userInfo;
|
|
15
|
-
|
|
16
|
-
public ${name}(UserInfo userInfo){
|
|
17
|
-
this.userInfo = userInfo;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
public String demo(String str){
|
|
22
|
-
str = "demo";
|
|
23
|
-
return str;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
`
|
|
27
|
-
fs.writeFileSync(path.join(classesPath, name + ".java"), javaTmp)
|
|
28
|
-
fs.writeFileSync(path.join(classesPath, "config.json"), `{"name":"${name}","version":"3"}`)
|
|
29
|
-
console.log()
|
|
30
|
-
console.log(chalk.green("Successfully Created:" + name))
|
|
31
|
-
console.log()
|
|
32
|
-
} catch (e) {
|
|
33
|
-
console.log()
|
|
34
|
-
console.log(chalk.red("Creation Failed:" + e))
|
|
35
|
-
console.log()
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
module.exports = create;
|
|
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(name) {
|
|
7
|
+
let res = await checkUpdate();
|
|
8
|
+
if (!res) {
|
|
9
|
+
const classesPath = path.join(process.cwd(), "classes/" + name);
|
|
10
|
+
try {
|
|
11
|
+
fs.mkdirSync(classesPath, { recursive: true })
|
|
12
|
+
const javaTmp =
|
|
13
|
+
`public class ${name}{
|
|
14
|
+
private UserInfo userInfo;
|
|
15
|
+
|
|
16
|
+
public ${name}(UserInfo userInfo){
|
|
17
|
+
this.userInfo = userInfo;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
public String demo(String str){
|
|
22
|
+
str = "demo";
|
|
23
|
+
return str;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`
|
|
27
|
+
fs.writeFileSync(path.join(classesPath, name + ".java"), javaTmp)
|
|
28
|
+
fs.writeFileSync(path.join(classesPath, "config.json"), `{"name":"${name}","version":"3"}`)
|
|
29
|
+
console.log()
|
|
30
|
+
console.log(chalk.green("Successfully Created:" + name))
|
|
31
|
+
console.log()
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.log()
|
|
34
|
+
console.log(chalk.red("Creation Failed:" + e))
|
|
35
|
+
console.log()
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = create;
|
package/src/classes/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const cc = {}
|
|
2
|
-
cc.create = require("./create")
|
|
3
|
-
cc.publish = require("./publish")
|
|
4
|
-
function Classes(action, argvs) {
|
|
5
|
-
cc[action](argvs[2])
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
module.exports = Classes;
|
|
1
|
+
const cc = {}
|
|
2
|
+
cc.create = require("./create")
|
|
3
|
+
cc.publish = require("./publish")
|
|
4
|
+
function Classes(action, argvs) {
|
|
5
|
+
cc[action](argvs[2])
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
module.exports = Classes;
|
package/src/classes/publish.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
const { checkUpdate } = require("../../utils/checkVersion")
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path")
|
|
5
|
-
const chalk = require("chalk")
|
|
6
|
-
const { postNormal } = require("../../utils/http")
|
|
7
|
-
|
|
8
|
-
const { getBusToken } = require("../../utils/utils")
|
|
9
|
-
|
|
10
|
-
async function publish(name) {
|
|
11
|
-
let res = await checkUpdate();
|
|
12
|
-
if (!res) {
|
|
13
|
-
console.log();
|
|
14
|
-
console.log(chalk.green('Posting, please wait...'));
|
|
15
|
-
console.log();
|
|
16
|
-
const classPath = path.join(process.cwd(), `classes/${name}/`);
|
|
17
|
-
let classContent = fs.readFileSync(classPath + `${name}.java`, 'utf8');
|
|
18
|
-
let configContent = JSON.parse(fs.readFileSync(classPath + "config.json", 'utf8'));
|
|
19
|
-
|
|
20
|
-
if (await getBusToken()) {
|
|
21
|
-
let body = {
|
|
22
|
-
"id": configContent.id,
|
|
23
|
-
"name": name,
|
|
24
|
-
"version": configContent.version,
|
|
25
|
-
"source": encodeURI(classContent),
|
|
26
|
-
"folderId": "wgd"
|
|
27
|
-
}
|
|
28
|
-
let res = await postNormal(global.setupSvc + "/api/ccfag/save", body)
|
|
29
|
-
if (res.result) {
|
|
30
|
-
console.log(chalk.green('Success!'));
|
|
31
|
-
console.log();
|
|
32
|
-
|
|
33
|
-
if (!configContent.id) {
|
|
34
|
-
configContent.id = res.data
|
|
35
|
-
fs.writeFileSync(path.join(classPath, "config.json"), JSON.stringify(configContent))
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
console.log(chalk.red('Fail:' + res.returnInfo));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
module.exports = publish;
|
|
1
|
+
|
|
2
|
+
const { checkUpdate } = require("../../utils/checkVersion")
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path")
|
|
5
|
+
const chalk = require("chalk")
|
|
6
|
+
const { postNormal } = require("../../utils/http")
|
|
7
|
+
|
|
8
|
+
const { getBusToken } = require("../../utils/utils")
|
|
9
|
+
|
|
10
|
+
async function publish(name) {
|
|
11
|
+
let res = await checkUpdate();
|
|
12
|
+
if (!res) {
|
|
13
|
+
console.log();
|
|
14
|
+
console.log(chalk.green('Posting, please wait...'));
|
|
15
|
+
console.log();
|
|
16
|
+
const classPath = path.join(process.cwd(), `classes/${name}/`);
|
|
17
|
+
let classContent = fs.readFileSync(classPath + `${name}.java`, 'utf8');
|
|
18
|
+
let configContent = JSON.parse(fs.readFileSync(classPath + "config.json", 'utf8'));
|
|
19
|
+
|
|
20
|
+
if (await getBusToken()) {
|
|
21
|
+
let body = {
|
|
22
|
+
"id": configContent.id,
|
|
23
|
+
"name": name,
|
|
24
|
+
"version": configContent.version,
|
|
25
|
+
"source": encodeURI(classContent),
|
|
26
|
+
"folderId": "wgd"
|
|
27
|
+
}
|
|
28
|
+
let res = await postNormal(global.setupSvc + "/api/ccfag/save", body)
|
|
29
|
+
if (res.result) {
|
|
30
|
+
console.log(chalk.green('Success!'));
|
|
31
|
+
console.log();
|
|
32
|
+
|
|
33
|
+
if (!configContent.id) {
|
|
34
|
+
configContent.id = res.data
|
|
35
|
+
fs.writeFileSync(path.join(classPath, "config.json"), JSON.stringify(configContent))
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
console.log(chalk.red('Fail:' + res.returnInfo));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
module.exports = publish;
|
package/src/config/get.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
const chalk = require("chalk")
|
|
3
|
-
const path = require("path")
|
|
4
|
-
|
|
5
|
-
async function get(projectPath = process.cwd()) {
|
|
6
|
-
let config = require(path.join(projectPath, "cloudcc-cli.config.js"))
|
|
7
|
-
if (config) {
|
|
8
|
-
console.log();
|
|
9
|
-
Object.keys(config).map((item) => {
|
|
10
|
-
if (item == config.use) {
|
|
11
|
-
console.log(chalk.green(`*${item}`));
|
|
12
|
-
} else if ("use" != item) {
|
|
13
|
-
console.log(item);
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
console.log();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
module.exports = get;
|
|
1
|
+
|
|
2
|
+
const chalk = require("chalk")
|
|
3
|
+
const path = require("path")
|
|
4
|
+
|
|
5
|
+
async function get(projectPath = process.cwd()) {
|
|
6
|
+
let config = require(path.join(projectPath, "cloudcc-cli.config.js"))
|
|
7
|
+
if (config) {
|
|
8
|
+
console.log();
|
|
9
|
+
Object.keys(config).map((item) => {
|
|
10
|
+
if (item == config.use) {
|
|
11
|
+
console.log(chalk.green(`*${item}`));
|
|
12
|
+
} else if ("use" != item) {
|
|
13
|
+
console.log(item);
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
console.log();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = get;
|
package/src/config/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const cc = {}
|
|
2
|
-
cc.use = require("./use")
|
|
3
|
-
cc.get = require("./get")
|
|
4
|
-
function main(action, argvs) {
|
|
5
|
-
cc[action](argvs[2], argvs[3])
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
module.exports = main;
|
|
1
|
+
const cc = {}
|
|
2
|
+
cc.use = require("./use")
|
|
3
|
+
cc.get = require("./get")
|
|
4
|
+
function main(action, argvs) {
|
|
5
|
+
cc[action](argvs[2], argvs[3])
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
module.exports = main;
|
package/src/config/use.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const path = require("path")
|
|
2
|
-
const fs = require("fs")
|
|
3
|
-
|
|
4
|
-
function use(env, projectPath = process.cwd()) {
|
|
5
|
-
let config = require(path.join(projectPath, "cloudcc-cli.config.js"));
|
|
6
|
-
config.use = env;
|
|
7
|
-
fs.writeFileSync(path.join(projectPath, "cloudcc-cli.config.js"),
|
|
8
|
-
`module.exports =
|
|
9
|
-
${JSON.stringify(config)}
|
|
10
|
-
`
|
|
11
|
-
, 'utf8');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = use;
|
|
1
|
+
const path = require("path")
|
|
2
|
+
const fs = require("fs")
|
|
3
|
+
|
|
4
|
+
function use(env, projectPath = process.cwd()) {
|
|
5
|
+
let config = require(path.join(projectPath, "cloudcc-cli.config.js"));
|
|
6
|
+
config.use = env;
|
|
7
|
+
fs.writeFileSync(path.join(projectPath, "cloudcc-cli.config.js"),
|
|
8
|
+
`module.exports =
|
|
9
|
+
${JSON.stringify(config)}
|
|
10
|
+
`
|
|
11
|
+
, 'utf8');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = use;
|
package/src/object/get.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const { getBusToken } = require("../../utils/utils")
|
|
2
|
-
const { postNormal } = require("../../utils/http")
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
async function get(path = process.cwd()) {
|
|
6
|
-
|
|
7
|
-
if (await getBusToken(path)) {
|
|
8
|
-
let res = await postNormal(global.setupSvc + "/api/customObject/standardObjList")
|
|
9
|
-
console.log(JSON.stringify(res.data))
|
|
10
|
-
return res.data
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = get;
|
|
1
|
+
const { getBusToken } = require("../../utils/utils")
|
|
2
|
+
const { postNormal } = require("../../utils/http")
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
async function get(path = process.cwd()) {
|
|
6
|
+
|
|
7
|
+
if (await getBusToken(path)) {
|
|
8
|
+
let res = await postNormal(global.setupSvc + "/api/customObject/standardObjList")
|
|
9
|
+
console.log(JSON.stringify(res.data))
|
|
10
|
+
return res.data
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = get;
|