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.
Files changed (49) hide show
  1. package/README.md +1168 -1154
  2. package/bin/cc.js +49 -49
  3. package/bin/plugin.js +6 -6
  4. package/bin/project.js +6 -6
  5. package/package.json +34 -34
  6. package/src/classes/create.js +43 -43
  7. package/src/classes/index.js +8 -8
  8. package/src/classes/publish.js +47 -47
  9. package/src/config/get.js +22 -22
  10. package/src/config/index.js +8 -8
  11. package/src/config/use.js +16 -16
  12. package/src/object/get.js +16 -16
  13. package/src/object/index.js +7 -7
  14. package/src/plugin/create.js +80 -80
  15. package/src/plugin/create1.js +66 -66
  16. package/src/plugin/index.js +8 -8
  17. package/src/plugin/publish.js +298 -298
  18. package/src/plugin/publish1.js +286 -286
  19. package/src/project/create.js +89 -89
  20. package/src/project/create1.js +111 -111
  21. package/src/project/index.js +7 -7
  22. package/src/recordType/get.js +16 -16
  23. package/src/recordType/index.js +7 -7
  24. package/src/script/create.js +32 -32
  25. package/src/script/index.js +8 -8
  26. package/src/script/publish.js +69 -69
  27. package/src/timer/create.js +29 -29
  28. package/src/timer/index.js +8 -8
  29. package/src/timer/publish.js +47 -47
  30. package/src/token/get.js +13 -13
  31. package/src/token/index.js +7 -7
  32. package/src/triggers/create.js +35 -35
  33. package/src/triggers/index.js +8 -8
  34. package/src/triggers/publish.js +51 -51
  35. package/template/Appvue +29 -29
  36. package/template/babelconfigjs +5 -5
  37. package/template/demojava +14 -14
  38. package/template/gitignore +11 -11
  39. package/template/index.js +57 -57
  40. package/template/indexhtml +21 -21
  41. package/template/indexvue +34 -34
  42. package/template/javaconfigjson +2 -2
  43. package/template/mainjs +13 -13
  44. package/template/package-lockjson +12115 -12115
  45. package/template/packagejson +42 -42
  46. package/template/vueconfigjs +26 -26
  47. package/utils/checkVersion.js +105 -105
  48. package/utils/http.js +122 -122
  49. package/utils/utils.js +59 -53
package/utils/utils.js CHANGED
@@ -1,54 +1,60 @@
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
-
1
+ const { getParams, postNormal } = require("./http")
2
+ const fs = require("fs");
3
+ const path = require("path")
4
+ const chalk = require("chalk")
5
+
6
+ /**
7
+ * 获得配置信息
8
+ * @returns 配置信息
9
+ */
10
+ function getPackageJson_old(projectPath = process.cwd()) {
11
+ const packageJson = JSON.parse(fs.readFileSync(path.join(projectPath, "package.json")), 'utf8');
12
+ return packageJson.devConsoleConfig;
13
+ }
14
+ /**
15
+ * 获取业务访问baseurl
16
+ */
17
+ async function getBaseUrl(orgId) {
18
+ let u = "https://developer.apis.cloudcc.cn/oauth/apidomain?scope=cloudccCRM&orgId=" + orgId
19
+ let res = await getParams(u)
20
+ global.baseUrl = res.orgapi_address
21
+ }
22
+ /**
23
+ * 获取业务token
24
+ */
25
+ async function getBusToken(path) {
26
+ let devConfig = getPackageJson(path);
27
+ if(!devConfig.username||!devConfig.safetyMark||!devConfig.clientId||!devConfig.openSecretKey||!devConfig.orgId){
28
+ console.log(chalk.red('安全标记配置有误,请查看文档进行配置:https://cloudccone.feishu.cn/wiki/IE0RwAOUFitPEMko1IxcaYMwnGx'));
29
+ console.log();
30
+ return false;
31
+ }
32
+ let body = {
33
+ username: devConfig.username,
34
+ safetyMark: devConfig.safetyMark,
35
+ clientId: devConfig.clientId,
36
+ secretKey: devConfig.openSecretKey,
37
+ orgId: devConfig.orgId
38
+ }
39
+ await getBaseUrl(devConfig.orgId)
40
+ let res = await postNormal(global.baseUrl + "/api/cauth/token", body)
41
+ if (res.result) {
42
+ global.accessToken = res.data.accessToken
43
+ return res.data.accessToken;
44
+ }
45
+ return false
46
+ }
47
+
48
+ /**
49
+ * 获取配置参数
50
+ */
51
+ function getPackageJson(projectPath = process.cwd()) {
52
+ let config = getPackageJson_old(projectPath);
53
+ if (!config) {
54
+ config = require(path.join(projectPath, "cloudcc-cli.config.js"))
55
+ config = config[config.use]
56
+ }
57
+ return config
58
+ }
59
+
54
60
  module.exports = { getBusToken, getPackageJson }