cloudcc-cli 1.5.5 → 1.5.7
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 +16 -0
- package/bin/cc.js +44 -0
- package/bin/plugin.js +7 -0
- package/bin/project.js +7 -0
- package/cloudcc-cli/accessToken +1 -0
- package/package.json +6 -12
- package/src/classes/create.js +43 -0
- package/src/classes/index.js +8 -0
- package/src/classes/publish.js +47 -0
- package/src/plugin/create.js +80 -0
- package/src/plugin/index.js +8 -0
- package/src/{builderPlugin.js → plugin/publish.js} +3 -4
- package/src/{creatorTemProject.js → project/create.js} +14 -18
- package/template/demojava +15 -0
- package/template/index.js +19 -7
- package/template/javaconfigjson +3 -0
- package/utils/checkVersion.js +1 -1
- package/utils/http.js +24 -1
- package/utils/utils.js +45 -0
- package/bin/build.js +0 -7
- package/bin/buildccbasesdk.js +0 -7
- package/bin/buildccsdk.js +0 -7
- package/bin/buildtag.js +0 -7
- package/bin/create.js +0 -7
- package/bin/createPlugin.js +0 -7
- package/bin/publish.js +0 -7
- package/bin/publishBuild.js +0 -7
- package/bin/publishh5.js +0 -7
- package/bin/publishh5Build.js +0 -7
- package/src/buildTag.js +0 -75
- package/src/builderBaseSDK.js +0 -90
- package/src/builderCreate.js +0 -84
- package/src/builderSDK.js +0 -162
- package/src/publishProject.js +0 -221
- package/src/publishProjectBuild.js +0 -223
- package/src/publishProjectH5.js +0 -218
- package/src/publishProjectH5Build.js +0 -224
- package/utils/askTool.js +0 -96
- package/utils/changeVersion copy.js +0 -75
- package/utils/changeVersion.js +0 -24
- package/utils/deploy.js +0 -9
- package/utils/encryption.js +0 -20
- package/utils/github-markdown.min.css +0 -2
- package/utils/md2html.js +0 -89
- package/utils/notifyIM.js +0 -87
- package/utils/pushCode.js +0 -202
- package/utils/trigger.js +0 -23
- package/utils/updatei18n.js +0 -127
- package/utils/writeVersion.js +0 -56
package/README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
# ReleaseV1.5.7
|
|
2
|
+
#### 发布日期:2024-2-22
|
|
3
|
+
#### 发布范围:全量
|
|
4
|
+
#### 发布内容
|
|
5
|
+
* 优化
|
|
6
|
+
* axios关闭httpsAgent和httpAgent认证。
|
|
7
|
+
* 修改生成版本逻辑。
|
|
8
|
+
* 删除无用代码,只保留cli代码。
|
|
9
|
+
|
|
10
|
+
# ReleaseV1.5.6
|
|
11
|
+
#### 发布日期:2024-1-3
|
|
12
|
+
#### 发布范围:全量
|
|
13
|
+
#### 发布内容
|
|
14
|
+
* 修复
|
|
15
|
+
* 组件打包使用build1命令。
|
|
16
|
+
|
|
1
17
|
# ReleaseV1.5.5
|
|
2
18
|
#### 发布日期:2023-12-26
|
|
3
19
|
#### 发布范围:全量
|
package/bin/cc.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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://help.cloudcc.developer.com"));
|
|
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://help.cloudcc.developer.com"));
|
|
19
|
+
console.log()
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// 要创建的资源名称
|
|
24
|
+
let name = argvs[2]
|
|
25
|
+
if (!name) {
|
|
26
|
+
console.log()
|
|
27
|
+
console.log(chalk.yellow("请查看帮助文档:https://help.cloudcc.developer.com"));
|
|
28
|
+
console.log()
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const cc = {}
|
|
34
|
+
// 类的管理
|
|
35
|
+
cc.classes = require("../src/classes/index")
|
|
36
|
+
// 组件的管理
|
|
37
|
+
cc.plugin = require("../src/plugin/index")
|
|
38
|
+
try {
|
|
39
|
+
cc[type](action, name);
|
|
40
|
+
} catch (e) {
|
|
41
|
+
console.log()
|
|
42
|
+
console.log(chalk.yellow("请查看帮助文档:https://help.cloudcc.developer.com"));
|
|
43
|
+
console.log()
|
|
44
|
+
}
|
package/bin/plugin.js
ADDED
package/bin/project.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJjbG91ZGNjIiwibG9naW5OYW1lIjoidGVzdHVhdEBjbG91ZGNjLmNvbSIsImJpbmRpbmciOiJjOTExNWExNC05YjUzLTRiMTQtYjc1MC01MTFkYzY1NDk4MjQiLCJDbGllbnRJZCI6IjJaTFdoZW94UWxRQTZHeU51cHdQY1BiRUciLCJleHAiOjE3MDcyNzE1ODQsIm9yZ0lkIjoib3JnMDhmODRlOWMwNTY2ZWFmMGMifQ.6WyZ2VZqNanyGYNZYKp9lPiqbf2iUSSCe86WMyQq9_k
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcc-cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.7",
|
|
4
4
|
"description": "cloudcc-cli",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudcc",
|
|
@@ -10,20 +10,13 @@
|
|
|
10
10
|
"author": "cloudcc",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"bin": {
|
|
13
|
-
"cloudccCreate": "bin/
|
|
14
|
-
"cloudccBuild": "bin/
|
|
15
|
-
"
|
|
16
|
-
"cloudccPublic": "bin/publish.js",
|
|
17
|
-
"cloudccPublicBuild": "bin/publishBuild.js",
|
|
18
|
-
"cloudccPublicH5": "bin/publishh5.js",
|
|
19
|
-
"cloudccPublicH5Build": "bin/publishh5Build.js",
|
|
20
|
-
"cloudccBuildCCSDK": "bin/buildccsdk.js",
|
|
21
|
-
"cloudccBuildCCBaseSDK": "bin/buildccbasesdk.js",
|
|
22
|
-
"cloudccBuildTag": "bin/buildtag.js"
|
|
13
|
+
"cloudccCreate": "bin/project.js",
|
|
14
|
+
"cloudccBuild": "bin/plugin.js",
|
|
15
|
+
"cc": "bin/cc.js"
|
|
23
16
|
},
|
|
24
17
|
"scripts": {
|
|
25
18
|
"cc-pull": "git fetch --tags -f && git pull",
|
|
26
|
-
"publish-lib": "npm publish --registry https://registry.npmjs.org && curl https://npmmirror.com/sync/cloudcc-cli"
|
|
19
|
+
"publish-lib": "npm publish --registry https://registry.npmjs.org --proxy http://127.0.0.1:33210 && curl https://npmmirror.com/sync/cloudcc-cli"
|
|
27
20
|
},
|
|
28
21
|
"dependencies": {
|
|
29
22
|
"axios": "^0.21.4",
|
|
@@ -36,6 +29,7 @@
|
|
|
36
29
|
"marked": "^5.0.1",
|
|
37
30
|
"mem-fs": "^2.2.1",
|
|
38
31
|
"mem-fs-editor": "^9.0.1",
|
|
32
|
+
"node-localstorage": "^3.0.5",
|
|
39
33
|
"vue-custom-element": "^3.3.0",
|
|
40
34
|
"vue-template-compiler": "^2.6.14"
|
|
41
35
|
}
|
|
@@ -0,0 +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)
|
|
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;
|
|
@@ -0,0 +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 + "/ccsetup/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(classesPath, "config.json"), JSON.stringify(configContent))
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
console.log(chalk.red('发布失败:' + res.returnInfo));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
module.exports = publish;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const inquirer = require("inquirer")
|
|
3
|
+
// 检查cli版本更新功能
|
|
4
|
+
const { checkUpdate } = require("../../utils/checkVersion")
|
|
5
|
+
const temp = `<template>
|
|
6
|
+
<div class="cc-container">
|
|
7
|
+
<div>Hello CloudCC</div>
|
|
8
|
+
<div>
|
|
9
|
+
<a href="https://cloudccone.feishu.cn/wiki/JZ7CwcRfriU8taknCKCcwKEmncd">
|
|
10
|
+
开发者文档</a
|
|
11
|
+
>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
componentInfo: {
|
|
21
|
+
// 组件唯一标识,全局唯一
|
|
22
|
+
component: "cloudcc-demo-01",
|
|
23
|
+
// 组件名称,在页面编辑器显示的名字
|
|
24
|
+
compName: "cloudcc-demo-01",
|
|
25
|
+
// 组件描述信息
|
|
26
|
+
compDesc: "组件描述信息",
|
|
27
|
+
},
|
|
28
|
+
isLock: false,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
</script>
|
|
33
|
+
<style lang="scss" scoped>
|
|
34
|
+
.cc-container {
|
|
35
|
+
text-align: center;
|
|
36
|
+
padding: 8px;
|
|
37
|
+
background: goldenrod;
|
|
38
|
+
}
|
|
39
|
+
</style>`
|
|
40
|
+
/**
|
|
41
|
+
* 创建组件模板文件
|
|
42
|
+
*/
|
|
43
|
+
class Builder {
|
|
44
|
+
constructor() {
|
|
45
|
+
this.options = {
|
|
46
|
+
// 开发配置信息
|
|
47
|
+
devConsoleConfig: {
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
this.plugin = process.argv.splice(2)[0]
|
|
51
|
+
}
|
|
52
|
+
async init() {
|
|
53
|
+
let res = await checkUpdate();
|
|
54
|
+
if (!res) {
|
|
55
|
+
// 获得用户输入
|
|
56
|
+
let answers;
|
|
57
|
+
if (this.plugin) {
|
|
58
|
+
answers = { buildFileName: this.plugin + "/demo.vue" }
|
|
59
|
+
} else {
|
|
60
|
+
answers = await this.ask();
|
|
61
|
+
answers.buildFileName = "./plugin/" + answers.buildFileName
|
|
62
|
+
}
|
|
63
|
+
fs.writeFileSync(answers.buildFileName, temp);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 命令行交互
|
|
68
|
+
* @returns 结果
|
|
69
|
+
*/
|
|
70
|
+
ask() {
|
|
71
|
+
const prompt = [];
|
|
72
|
+
prompt.push({
|
|
73
|
+
type: "input",
|
|
74
|
+
name: "buildFileName",
|
|
75
|
+
message: "请输入文件名,如index.vue",
|
|
76
|
+
})
|
|
77
|
+
return inquirer.prompt(prompt)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
module.exports = Builder;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
const { exec } = require('child_process');
|
|
2
|
-
const { post } = require('
|
|
2
|
+
const { post } = require('../../utils/http');
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require("path")
|
|
5
5
|
const chalk = require("chalk")
|
|
6
6
|
const inquirer = require("inquirer")
|
|
7
7
|
// 检查cli版本更新功能
|
|
8
|
-
const { checkUpdate } = require("
|
|
8
|
+
const { checkUpdate } = require("../../utils/checkVersion")
|
|
9
9
|
const BaseUrl = "https://developer.apis.cloudcc.cn"
|
|
10
|
-
const axios = require("axios")
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* 自定义组件,组件打包命令,将组件打包发布到服务器。
|
|
@@ -192,7 +191,7 @@ class Builder {
|
|
|
192
191
|
* @param {string} plginTemp 生成模板代码存储路径
|
|
193
192
|
*/
|
|
194
193
|
initPluginFile(buildFileName, component, plginTemp) {
|
|
195
|
-
this.
|
|
194
|
+
this.initPluginFile1(buildFileName, component, plginTemp)
|
|
196
195
|
}
|
|
197
196
|
/**
|
|
198
197
|
* 生成依赖文件,vue-custom-element
|
|
@@ -4,8 +4,7 @@ const memFs = require("mem-fs")
|
|
|
4
4
|
const memFsEditor = require("mem-fs-editor")
|
|
5
5
|
const fs = require("fs")
|
|
6
6
|
const path = require("path")
|
|
7
|
-
const { checkUpdate } = require("
|
|
8
|
-
const exec = require('child_process').execSync;
|
|
7
|
+
const { checkUpdate } = require("../../utils/checkVersion")
|
|
9
8
|
/**
|
|
10
9
|
* 创建自定组件开发模板项目
|
|
11
10
|
*/
|
|
@@ -17,22 +16,27 @@ class Creator {
|
|
|
17
16
|
description: ""
|
|
18
17
|
}
|
|
19
18
|
// 当前目录
|
|
20
|
-
this.rootPath = path.resolve(__dirname, "
|
|
19
|
+
this.rootPath = path.resolve(__dirname, "../../");
|
|
21
20
|
// 模板目录
|
|
22
21
|
this.tplDirPath = path.join(this.rootPath, "template");
|
|
23
22
|
}
|
|
24
23
|
// 初始化
|
|
25
|
-
async init() {
|
|
24
|
+
async init(name) {
|
|
26
25
|
let res = await checkUpdate();
|
|
27
26
|
if (!res) {
|
|
28
27
|
console.log()
|
|
29
28
|
console.log(chalk.green('欢迎使用CloudCC-CLI'));
|
|
30
29
|
console.log()
|
|
31
|
-
|
|
32
|
-
this.
|
|
33
|
-
|
|
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 }
|
|
34
38
|
this.write();
|
|
35
|
-
}
|
|
39
|
+
}
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
// 命令行交互
|
|
@@ -55,25 +59,17 @@ class Creator {
|
|
|
55
59
|
return true;
|
|
56
60
|
}
|
|
57
61
|
});
|
|
58
|
-
prompt.push({
|
|
59
|
-
type: "input",
|
|
60
|
-
name: "description",
|
|
61
|
-
message: "请输入项目描述",
|
|
62
|
-
})
|
|
63
62
|
return inquirer.prompt(prompt)
|
|
64
63
|
}
|
|
65
64
|
// 拷贝和写数据
|
|
66
65
|
write() {
|
|
67
66
|
console.log();
|
|
68
67
|
console.log(chalk.green("开始构建,请稍后"));
|
|
69
|
-
const tplBuilder = require("
|
|
68
|
+
const tplBuilder = require("../../template/index");
|
|
70
69
|
tplBuilder(this, this.options, () => {
|
|
71
|
-
// console.log();
|
|
72
|
-
// console.log(chalk.green('安装依赖'));
|
|
73
|
-
// let os = process.platform
|
|
74
|
-
// exec(`cd ${this.options.name} && ${'darwin' == os ? 'sudo' : ''} npm install --registry http://registry.npmmirror.com && code . `)
|
|
75
70
|
console.log();
|
|
76
71
|
console.log(chalk.green('构建完成,运行前请安装依赖'))
|
|
72
|
+
console.log();
|
|
77
73
|
})
|
|
78
74
|
}
|
|
79
75
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
public class Test{
|
|
2
|
+
private CCServiceV3 cs;
|
|
3
|
+
private UserInfo userInfo;
|
|
4
|
+
|
|
5
|
+
public Test(UserInfo userInfo){
|
|
6
|
+
this.userInfo = userInfo;
|
|
7
|
+
cs = new CCServiceV3(userInfo);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
public String demo(String str){
|
|
12
|
+
str = "demo";
|
|
13
|
+
return str;
|
|
14
|
+
}
|
|
15
|
+
}
|
package/template/index.js
CHANGED
|
@@ -8,18 +8,22 @@ module.exports = function (creator, options, callback) {
|
|
|
8
8
|
|
|
9
9
|
|
|
10
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
11
|
fs.mkdirSync(projectPath)
|
|
12
|
+
|
|
13
|
+
const pluginPath = path.join(projectPath, "plugin");
|
|
19
14
|
fs.mkdirSync(pluginPath)
|
|
15
|
+
|
|
16
|
+
fs.mkdirSync(path.join(projectPath, "classes"))
|
|
17
|
+
const classesPath = path.join(projectPath, "classes/classdemo");
|
|
18
|
+
fs.mkdirSync(classesPath)
|
|
19
|
+
|
|
20
|
+
const src = path.join(projectPath, "src");
|
|
20
21
|
fs.mkdirSync(src)
|
|
22
|
+
|
|
23
|
+
const public = path.join(projectPath, "public");
|
|
21
24
|
fs.mkdirSync(public)
|
|
22
25
|
|
|
26
|
+
|
|
23
27
|
creator.copyTpl('packagejson', path.join(projectPath, "package.json"), {
|
|
24
28
|
name, description
|
|
25
29
|
})
|
|
@@ -40,6 +44,10 @@ module.exports = function (creator, options, callback) {
|
|
|
40
44
|
|
|
41
45
|
creator.copyTpl('indexhtml', path.join(public, "index.html"))
|
|
42
46
|
|
|
47
|
+
creator.copyTpl('demojava', path.join(classesPath, "demo.java"))
|
|
48
|
+
|
|
49
|
+
creator.copyTpl('javaconfigjson', path.join(classesPath, "config.json"))
|
|
50
|
+
|
|
43
51
|
|
|
44
52
|
creator.fs.commit(() => {
|
|
45
53
|
console.log();
|
|
@@ -47,6 +55,10 @@ module.exports = function (creator, options, callback) {
|
|
|
47
55
|
console.log(`${chalk.grey(`创建目录: ${name}/plugin`)} ${chalk.green('✔ ')}`);
|
|
48
56
|
console.log(`${chalk.grey(`创建文件: ${name}/plugin/index.vue`)} ${chalk.green('✔ ')}`);
|
|
49
57
|
|
|
58
|
+
console.log(`${chalk.grey(`创建目录: ${name}/classes/classdemo`)} ${chalk.green('✔ ')}`);
|
|
59
|
+
console.log(`${chalk.grey(`创建文件: ${name}/classdemo/demo.java`)} ${chalk.green('✔ ')}`);
|
|
60
|
+
console.log(`${chalk.grey(`创建文件: ${name}/classdemo/config.json`)} ${chalk.green('✔ ')}`);
|
|
61
|
+
|
|
50
62
|
console.log(`${chalk.grey(`创建目录: ${name}/public`)} ${chalk.green('✔ ')}`);
|
|
51
63
|
console.log(`${chalk.grey(`创建文件: ${name}/plugin/index.html`)} ${chalk.green('✔ ')}`);
|
|
52
64
|
|
package/utils/checkVersion.js
CHANGED
package/utils/http.js
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
const https = require("https")
|
|
2
|
+
const http = require("http")
|
|
1
3
|
const axios = require("axios")
|
|
4
|
+
|
|
5
|
+
const httpsAgent = new https.Agent({
|
|
6
|
+
rejectUnauthorized: false,
|
|
7
|
+
})
|
|
8
|
+
const httpAgent = new http.Agent({
|
|
9
|
+
rejectUnauthorized: false,
|
|
10
|
+
})
|
|
11
|
+
axios.defaults.httpsAgent = httpsAgent
|
|
12
|
+
axios.defaults.httpAgent = httpAgent
|
|
13
|
+
|
|
2
14
|
const service = axios.create({
|
|
3
15
|
timeout: 60000, // request timeout
|
|
4
16
|
headers: {
|
|
@@ -9,6 +21,9 @@ const service = axios.create({
|
|
|
9
21
|
// request interceptor
|
|
10
22
|
service.interceptors.request.use(
|
|
11
23
|
config => {
|
|
24
|
+
if (global.accessToken) {
|
|
25
|
+
config.headers.accessToken = global.accessToken
|
|
26
|
+
}
|
|
12
27
|
return config
|
|
13
28
|
},
|
|
14
29
|
error => {
|
|
@@ -53,6 +68,13 @@ module.exports = {
|
|
|
53
68
|
responseType: responseType
|
|
54
69
|
})
|
|
55
70
|
},
|
|
71
|
+
getParams: (url, data = {}) => {
|
|
72
|
+
return service({
|
|
73
|
+
url: url,
|
|
74
|
+
method: 'get',
|
|
75
|
+
params: data,
|
|
76
|
+
})
|
|
77
|
+
},
|
|
56
78
|
post: (url, data = {}, header = { appVersion: "1.0.0" }, responseType = '') => {
|
|
57
79
|
return service({
|
|
58
80
|
url: url,
|
|
@@ -65,7 +87,7 @@ module.exports = {
|
|
|
65
87
|
return service({
|
|
66
88
|
url: url,
|
|
67
89
|
method: 'post',
|
|
68
|
-
params: data
|
|
90
|
+
params: data,
|
|
69
91
|
})
|
|
70
92
|
},
|
|
71
93
|
postNormal: (url, data = {}) => {
|
|
@@ -96,4 +118,5 @@ module.exports = {
|
|
|
96
118
|
data: formateData(data)
|
|
97
119
|
})
|
|
98
120
|
}
|
|
121
|
+
|
|
99
122
|
}
|
package/utils/utils.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const { getParams, postNormal } = require("./http")
|
|
2
|
+
const LocalStorage = require('node-localstorage').LocalStorage;
|
|
3
|
+
const localStorage = new LocalStorage('./cloudcc-cli');
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path")
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 获得配置信息
|
|
9
|
+
* @returns 配置信息
|
|
10
|
+
*/
|
|
11
|
+
function getPackageJson() {
|
|
12
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json"), 'utf8'));
|
|
13
|
+
return packageJson.devConsoleConfig;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 获取业务访问baseurl
|
|
17
|
+
*/
|
|
18
|
+
async function getBaseUrl(orgId) {
|
|
19
|
+
let u = "https://developer.apis.cloudcc.cn/oauth/apidomain?scope=cloudccCRM&orgId=" + orgId
|
|
20
|
+
let res = await getParams(u)
|
|
21
|
+
global.baseUrl = res.orgapi_address
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 获取业务token
|
|
25
|
+
*/
|
|
26
|
+
async function getBusToken() {
|
|
27
|
+
let devConfig = getPackageJson();
|
|
28
|
+
let body = {
|
|
29
|
+
username: devConfig.username,
|
|
30
|
+
safetyMark: devConfig.safetyMark,
|
|
31
|
+
clientId: devConfig.clientId,
|
|
32
|
+
secretKey: devConfig.openSecretKey,
|
|
33
|
+
orgId: devConfig.orgId
|
|
34
|
+
}
|
|
35
|
+
await getBaseUrl(devConfig.orgId)
|
|
36
|
+
let res = await postNormal(global.baseUrl + "/api/cauth/token", body)
|
|
37
|
+
if (res.result) {
|
|
38
|
+
global.accessToken = res.data.accessToken
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
module.exports = { getBusToken }
|
package/bin/build.js
DELETED
package/bin/buildccbasesdk.js
DELETED
package/bin/buildccsdk.js
DELETED
package/bin/buildtag.js
DELETED
package/bin/create.js
DELETED
package/bin/createPlugin.js
DELETED
package/bin/publish.js
DELETED