cloudcc-cli 1.6.3 → 1.6.5
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 +1168 -1154
- package/bin/cc.js +49 -49
- package/bin/plugin.js +6 -6
- package/bin/project.js +6 -6
- package/package.json +34 -34
- package/src/classes/create.js +43 -43
- package/src/classes/index.js +8 -8
- package/src/classes/publish.js +47 -47
- package/src/config/get.js +22 -22
- package/src/config/index.js +8 -8
- package/src/config/use.js +16 -16
- package/src/object/get.js +16 -16
- package/src/object/index.js +7 -7
- package/src/plugin/create.js +80 -80
- package/src/plugin/create1.js +66 -66
- package/src/plugin/index.js +8 -8
- package/src/plugin/publish.js +298 -298
- package/src/plugin/publish1.js +286 -286
- package/src/project/create.js +89 -89
- package/src/project/create1.js +111 -111
- package/src/project/index.js +7 -7
- package/src/recordType/get.js +16 -16
- package/src/recordType/index.js +7 -7
- package/src/script/create.js +32 -32
- package/src/script/index.js +8 -8
- package/src/script/publish.js +69 -69
- package/src/timer/create.js +29 -29
- package/src/timer/index.js +8 -8
- package/src/timer/publish.js +47 -47
- package/src/token/get.js +13 -13
- package/src/token/index.js +7 -7
- package/src/triggers/create.js +35 -35
- package/src/triggers/index.js +8 -8
- package/src/triggers/publish.js +51 -51
- package/template/Appvue +29 -29
- 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 +34 -34
- package/template/javaconfigjson +2 -2
- package/template/mainjs +13 -13
- package/template/package-lockjson +12115 -12115
- package/template/packagejson +42 -42
- package/template/vueconfigjs +26 -26
- package/utils/checkVersion.js +105 -105
- package/utils/http.js +122 -122
- package/utils/utils.js +59 -53
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("请查看帮助文档:https://cloudccone.feishu.cn/wiki/Q2AgwlxAtijmMJkjXXZcYgQVnmw?fromScene=spaceOverview"));
|
|
10
|
-
console.log()
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// 类型
|
|
15
|
-
let type = argvs[1]
|
|
16
|
-
if (!type) {
|
|
17
|
-
console.log()
|
|
18
|
-
console.log(chalk.yellow("请查看帮助文档:https://cloudccone.feishu.cn/wiki/Q2AgwlxAtijmMJkjXXZcYgQVnmw?fromScene=spaceOverview"));
|
|
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
|
-
// token管理
|
|
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("请查看帮助文档:https://cloudccone.feishu.cn/wiki/Q2AgwlxAtijmMJkjXXZcYgQVnmw?fromScene=spaceOverview"), 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("请查看帮助文档:https://cloudccone.feishu.cn/wiki/Q2AgwlxAtijmMJkjXXZcYgQVnmw?fromScene=spaceOverview"));
|
|
10
|
+
console.log()
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// 类型
|
|
15
|
+
let type = argvs[1]
|
|
16
|
+
if (!type) {
|
|
17
|
+
console.log()
|
|
18
|
+
console.log(chalk.yellow("请查看帮助文档:https://cloudccone.feishu.cn/wiki/Q2AgwlxAtijmMJkjXXZcYgQVnmw?fromScene=spaceOverview"));
|
|
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
|
+
// token管理
|
|
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("请查看帮助文档:https://cloudccone.feishu.cn/wiki/Q2AgwlxAtijmMJkjXXZcYgQVnmw?fromScene=spaceOverview"), 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();
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "cloudcc-cli",
|
|
3
|
-
"version": "1.6.
|
|
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 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.6.5",
|
|
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 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,43 +1,43 @@
|
|
|
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(name) {
|
|
10
|
-
let res = await checkUpdate();
|
|
11
|
-
if (!res) {
|
|
12
|
-
const classesPath = path.join(process.cwd(), "classes/" + name);
|
|
13
|
-
try {
|
|
14
|
-
fs.mkdirSync(classesPath, { recursive: true })
|
|
15
|
-
const javaTmp = `
|
|
16
|
-
public class ${name}{
|
|
17
|
-
private UserInfo userInfo;
|
|
18
|
-
|
|
19
|
-
public ${name}(UserInfo userInfo){
|
|
20
|
-
this.userInfo = userInfo;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
public String demo(String str){
|
|
25
|
-
str = "demo";
|
|
26
|
-
return str;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`
|
|
30
|
-
fs.writeFileSync(path.join(classesPath, name + ".java"), javaTmp)
|
|
31
|
-
fs.writeFileSync(path.join(classesPath, "config.json"), `{"name":"${name}","version":"3"}`)
|
|
32
|
-
console.log()
|
|
33
|
-
console.log(chalk.green("创建成功:" + name))
|
|
34
|
-
console.log()
|
|
35
|
-
} catch (e) {
|
|
36
|
-
console.log()
|
|
37
|
-
console.log(chalk.red("创建失败:" + e))
|
|
38
|
-
console.log()
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
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
|
+
* 创建文件
|
|
7
|
+
* @param {string} name 文件名称
|
|
8
|
+
*/
|
|
9
|
+
async function create(name) {
|
|
10
|
+
let res = await checkUpdate();
|
|
11
|
+
if (!res) {
|
|
12
|
+
const classesPath = path.join(process.cwd(), "classes/" + name);
|
|
13
|
+
try {
|
|
14
|
+
fs.mkdirSync(classesPath, { recursive: true })
|
|
15
|
+
const javaTmp = `
|
|
16
|
+
public class ${name}{
|
|
17
|
+
private UserInfo userInfo;
|
|
18
|
+
|
|
19
|
+
public ${name}(UserInfo userInfo){
|
|
20
|
+
this.userInfo = userInfo;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
public String demo(String str){
|
|
25
|
+
str = "demo";
|
|
26
|
+
return str;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`
|
|
30
|
+
fs.writeFileSync(path.join(classesPath, name + ".java"), javaTmp)
|
|
31
|
+
fs.writeFileSync(path.join(classesPath, "config.json"), `{"name":"${name}","version":"3"}`)
|
|
32
|
+
console.log()
|
|
33
|
+
console.log(chalk.green("创建成功:" + name))
|
|
34
|
+
console.log()
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.log()
|
|
37
|
+
console.log(chalk.red("创建失败:" + e))
|
|
38
|
+
console.log()
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
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,47 +1,47 @@
|
|
|
1
|
-
// 检查cli版本更新功能
|
|
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
|
-
* 发布文件
|
|
11
|
-
* @param {string} name 文件名称
|
|
12
|
-
*/
|
|
13
|
-
async function publish(name) {
|
|
14
|
-
let res = await checkUpdate();
|
|
15
|
-
if (!res) {
|
|
16
|
-
console.log();
|
|
17
|
-
console.log(chalk.green('发布中,请稍后...'));
|
|
18
|
-
console.log();
|
|
19
|
-
const classPath = path.join(process.cwd(), `classes/${name}/`);
|
|
20
|
-
let classContent = fs.readFileSync(classPath + `${name}.java`, 'utf8');
|
|
21
|
-
let configContent = JSON.parse(fs.readFileSync(classPath + "config.json", 'utf8'));
|
|
22
|
-
// 获取token成功后,发布内容
|
|
23
|
-
if (await getBusToken()) {
|
|
24
|
-
let body = {
|
|
25
|
-
"id": configContent.id,
|
|
26
|
-
"name": name,
|
|
27
|
-
"version": configContent.version,
|
|
28
|
-
"source": encodeURI(classContent),
|
|
29
|
-
"folderId": "wgd"
|
|
30
|
-
}
|
|
31
|
-
let url = new URL(global.baseUrl).origin
|
|
32
|
-
let res = await postNormal(url + "/setup/api/ccfag/save", body)
|
|
33
|
-
if (res.result) {
|
|
34
|
-
console.log(chalk.green('发布成功!'));
|
|
35
|
-
console.log();
|
|
36
|
-
// 组件发布成功后,判断下配置文件是否有id,如果没有,那么将id存储到配置中
|
|
37
|
-
if (!configContent.id) {
|
|
38
|
-
configContent.id = res.data
|
|
39
|
-
fs.writeFileSync(path.join(classPath, "config.json"), JSON.stringify(configContent))
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
console.log(chalk.red('发布失败:' + res.returnInfo));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
module.exports = publish;
|
|
1
|
+
// 检查cli版本更新功能
|
|
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
|
+
* 发布文件
|
|
11
|
+
* @param {string} name 文件名称
|
|
12
|
+
*/
|
|
13
|
+
async function publish(name) {
|
|
14
|
+
let res = await checkUpdate();
|
|
15
|
+
if (!res) {
|
|
16
|
+
console.log();
|
|
17
|
+
console.log(chalk.green('发布中,请稍后...'));
|
|
18
|
+
console.log();
|
|
19
|
+
const classPath = path.join(process.cwd(), `classes/${name}/`);
|
|
20
|
+
let classContent = fs.readFileSync(classPath + `${name}.java`, 'utf8');
|
|
21
|
+
let configContent = JSON.parse(fs.readFileSync(classPath + "config.json", 'utf8'));
|
|
22
|
+
// 获取token成功后,发布内容
|
|
23
|
+
if (await getBusToken()) {
|
|
24
|
+
let body = {
|
|
25
|
+
"id": configContent.id,
|
|
26
|
+
"name": name,
|
|
27
|
+
"version": configContent.version,
|
|
28
|
+
"source": encodeURI(classContent),
|
|
29
|
+
"folderId": "wgd"
|
|
30
|
+
}
|
|
31
|
+
let url = new URL(global.baseUrl).origin
|
|
32
|
+
let res = await postNormal(url + "/setup/api/ccfag/save", body)
|
|
33
|
+
if (res.result) {
|
|
34
|
+
console.log(chalk.green('发布成功!'));
|
|
35
|
+
console.log();
|
|
36
|
+
// 组件发布成功后,判断下配置文件是否有id,如果没有,那么将id存储到配置中
|
|
37
|
+
if (!configContent.id) {
|
|
38
|
+
configContent.id = res.data
|
|
39
|
+
fs.writeFileSync(path.join(classPath, "config.json"), JSON.stringify(configContent))
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
console.log(chalk.red('发布失败:' + res.returnInfo));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
module.exports = publish;
|
package/src/config/get.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
const chalk = require("chalk")
|
|
3
|
-
const path = require("path")
|
|
4
|
-
/**
|
|
5
|
-
* 获取token
|
|
6
|
-
*/
|
|
7
|
-
async function get(projectPath = process.cwd()) {
|
|
8
|
-
let config = require(path.join(projectPath, "cloudcc-cli.config.js"))
|
|
9
|
-
if (config) {
|
|
10
|
-
console.log();
|
|
11
|
-
Object.keys(config).map((item) => {
|
|
12
|
-
if (item == config.use) {
|
|
13
|
-
console.log(chalk.green(`*${item}`));
|
|
14
|
-
} else if ("use" != item) {
|
|
15
|
-
console.log(item);
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
console.log();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = get;
|
|
1
|
+
|
|
2
|
+
const chalk = require("chalk")
|
|
3
|
+
const path = require("path")
|
|
4
|
+
/**
|
|
5
|
+
* 获取token
|
|
6
|
+
*/
|
|
7
|
+
async function get(projectPath = process.cwd()) {
|
|
8
|
+
let config = require(path.join(projectPath, "cloudcc-cli.config.js"))
|
|
9
|
+
if (config) {
|
|
10
|
+
console.log();
|
|
11
|
+
Object.keys(config).map((item) => {
|
|
12
|
+
if (item == config.use) {
|
|
13
|
+
console.log(chalk.green(`*${item}`));
|
|
14
|
+
} else if ("use" != item) {
|
|
15
|
+
console.log(item);
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
console.log();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
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,16 +1,16 @@
|
|
|
1
|
-
const path = require("path")
|
|
2
|
-
const fs = require("fs")
|
|
3
|
-
/**
|
|
4
|
-
* 获取token
|
|
5
|
-
*/
|
|
6
|
-
function use(env, projectPath = process.cwd()) {
|
|
7
|
-
let config = require(path.join(projectPath, "cloudcc-cli.config.js"));
|
|
8
|
-
config.use = env;
|
|
9
|
-
fs.writeFileSync(path.join(projectPath, "cloudcc-cli.config.js"),
|
|
10
|
-
`module.exports =
|
|
11
|
-
${JSON.stringify(config)}
|
|
12
|
-
`
|
|
13
|
-
, 'utf8');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports = use;
|
|
1
|
+
const path = require("path")
|
|
2
|
+
const fs = require("fs")
|
|
3
|
+
/**
|
|
4
|
+
* 获取token
|
|
5
|
+
*/
|
|
6
|
+
function use(env, projectPath = process.cwd()) {
|
|
7
|
+
let config = require(path.join(projectPath, "cloudcc-cli.config.js"));
|
|
8
|
+
config.use = env;
|
|
9
|
+
fs.writeFileSync(path.join(projectPath, "cloudcc-cli.config.js"),
|
|
10
|
+
`module.exports =
|
|
11
|
+
${JSON.stringify(config)}
|
|
12
|
+
`
|
|
13
|
+
, 'utf8');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = use;
|
package/src/object/get.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const { getBusToken } = require("../../utils/utils")
|
|
2
|
-
const { postNormal } = require("../../utils/http")
|
|
3
|
-
/**
|
|
4
|
-
* 获取对象集合
|
|
5
|
-
*/
|
|
6
|
-
async function get(path = process.cwd()) {
|
|
7
|
-
// 获取token成功后,发布内容
|
|
8
|
-
if (await getBusToken(path)) {
|
|
9
|
-
let url = new URL(global.baseUrl).origin
|
|
10
|
-
let res = await postNormal(url + "/setup/api/customObject/standardObjList")
|
|
11
|
-
console.log(JSON.stringify(res.data))
|
|
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
|
+
* 获取对象集合
|
|
5
|
+
*/
|
|
6
|
+
async function get(path = process.cwd()) {
|
|
7
|
+
// 获取token成功后,发布内容
|
|
8
|
+
if (await getBusToken(path)) {
|
|
9
|
+
let url = new URL(global.baseUrl).origin
|
|
10
|
+
let res = await postNormal(url + "/setup/api/customObject/standardObjList")
|
|
11
|
+
console.log(JSON.stringify(res.data))
|
|
12
|
+
return res.data
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = get;
|
package/src/object/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const cc = {}
|
|
2
|
-
cc.get = require("./get")
|
|
3
|
-
function main(action, argvs) {
|
|
4
|
-
cc[action](argvs[2])
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
module.exports = main;
|
|
1
|
+
const cc = {}
|
|
2
|
+
cc.get = require("./get")
|
|
3
|
+
function main(action, argvs) {
|
|
4
|
+
cc[action](argvs[2])
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
module.exports = main;
|