cloudcc-cli 1.6.0 → 1.6.2
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 +1147 -1128
- package/bin/cc.js +48 -48
- package/bin/plugin.js +5 -5
- package/bin/project.js +5 -5
- package/package.json +34 -34
- package/src/classes/create.js +43 -43
- package/src/classes/index.js +8 -8
- package/src/classes/publish.js +48 -47
- package/src/config/get.js +22 -0
- package/src/config/index.js +8 -0
- package/src/config/use.js +16 -0
- package/src/object/get.js +16 -0
- package/src/object/index.js +7 -0
- package/src/plugin/create.js +80 -80
- package/src/plugin/create1.js +66 -67
- package/src/plugin/index.js +8 -8
- package/src/plugin/publish.js +298 -305
- package/src/plugin/publish1.js +286 -293
- package/src/project/create.js +89 -89
- package/src/project/create1.js +111 -94
- package/src/project/index.js +7 -7
- package/src/recordType/get.js +16 -0
- package/src/recordType/index.js +7 -0
- package/src/script/create.js +33 -0
- package/src/script/index.js +8 -0
- package/src/script/publish.js +69 -0
- 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 -0
- package/src/token/index.js +7 -0
- 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/cloudcc-cli.configjs +1 -0
- package/template/demojava +14 -14
- package/template/gitignore +11 -0
- package/template/index.js +57 -52
- 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 -46
- package/template/vueconfigjs +26 -26
- package/utils/checkVersion.js +105 -105
- package/utils/http.js +122 -122
- package/utils/utils.js +54 -44
package/utils/utils.js
CHANGED
|
@@ -1,44 +1,54 @@
|
|
|
1
|
-
const { getParams, postNormal } = require("./http")
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
const path = require("path")
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 获得配置信息
|
|
7
|
-
* @returns 配置信息
|
|
8
|
-
*/
|
|
9
|
-
function
|
|
10
|
-
const packageJson = JSON.parse(fs.readFileSync(path.join(
|
|
11
|
-
return packageJson.devConsoleConfig;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 获取业务访问baseurl
|
|
15
|
-
*/
|
|
16
|
-
async function getBaseUrl(orgId) {
|
|
17
|
-
let u = "https://developer.apis.cloudcc.cn/oauth/apidomain?scope=cloudccCRM&orgId=" + orgId
|
|
18
|
-
let res = await getParams(u)
|
|
19
|
-
global.baseUrl = res.orgapi_address
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* 获取业务token
|
|
23
|
-
*/
|
|
24
|
-
async function getBusToken() {
|
|
25
|
-
let devConfig = getPackageJson();
|
|
26
|
-
let body = {
|
|
27
|
-
username: devConfig.username,
|
|
28
|
-
safetyMark: devConfig.safetyMark,
|
|
29
|
-
clientId: devConfig.clientId,
|
|
30
|
-
secretKey: devConfig.openSecretKey,
|
|
31
|
-
orgId: devConfig.orgId
|
|
32
|
-
}
|
|
33
|
-
await getBaseUrl(devConfig.orgId)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
const { getParams, postNormal } = require("./http")
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path")
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 获得配置信息
|
|
7
|
+
* @returns 配置信息
|
|
8
|
+
*/
|
|
9
|
+
function getPackageJson_old(projectPath = process.cwd()) {
|
|
10
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(projectPath, "package.json")), 'utf8');
|
|
11
|
+
return packageJson.devConsoleConfig;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 获取业务访问baseurl
|
|
15
|
+
*/
|
|
16
|
+
async function getBaseUrl(orgId) {
|
|
17
|
+
let u = "https://developer.apis.cloudcc.cn/oauth/apidomain?scope=cloudccCRM&orgId=" + orgId
|
|
18
|
+
let res = await getParams(u)
|
|
19
|
+
global.baseUrl = res.orgapi_address
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 获取业务token
|
|
23
|
+
*/
|
|
24
|
+
async function getBusToken(path) {
|
|
25
|
+
let devConfig = getPackageJson(path);
|
|
26
|
+
let body = {
|
|
27
|
+
username: devConfig.username,
|
|
28
|
+
safetyMark: devConfig.safetyMark,
|
|
29
|
+
clientId: devConfig.clientId,
|
|
30
|
+
secretKey: devConfig.openSecretKey,
|
|
31
|
+
orgId: devConfig.orgId
|
|
32
|
+
}
|
|
33
|
+
await getBaseUrl(devConfig.orgId)
|
|
34
|
+
let res = await postNormal(global.baseUrl + "/api/cauth/token", body)
|
|
35
|
+
if (res.result) {
|
|
36
|
+
global.accessToken = res.data.accessToken
|
|
37
|
+
return res.data.accessToken;
|
|
38
|
+
}
|
|
39
|
+
return false
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 获取配置参数
|
|
44
|
+
*/
|
|
45
|
+
function getPackageJson(projectPath = process.cwd()) {
|
|
46
|
+
let config = getPackageJson_old(projectPath);
|
|
47
|
+
if (!config) {
|
|
48
|
+
config = require(path.join(projectPath, "cloudcc-cli.config.js"))
|
|
49
|
+
config = config[config.use]
|
|
50
|
+
}
|
|
51
|
+
return config
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = { getBusToken, getPackageJson }
|