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.
Files changed (50) hide show
  1. package/README.md +1147 -1128
  2. package/bin/cc.js +48 -48
  3. package/bin/plugin.js +5 -5
  4. package/bin/project.js +5 -5
  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 +48 -47
  9. package/src/config/get.js +22 -0
  10. package/src/config/index.js +8 -0
  11. package/src/config/use.js +16 -0
  12. package/src/object/get.js +16 -0
  13. package/src/object/index.js +7 -0
  14. package/src/plugin/create.js +80 -80
  15. package/src/plugin/create1.js +66 -67
  16. package/src/plugin/index.js +8 -8
  17. package/src/plugin/publish.js +298 -305
  18. package/src/plugin/publish1.js +286 -293
  19. package/src/project/create.js +89 -89
  20. package/src/project/create1.js +111 -94
  21. package/src/project/index.js +7 -7
  22. package/src/recordType/get.js +16 -0
  23. package/src/recordType/index.js +7 -0
  24. package/src/script/create.js +33 -0
  25. package/src/script/index.js +8 -0
  26. package/src/script/publish.js +69 -0
  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 -0
  31. package/src/token/index.js +7 -0
  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/cloudcc-cli.configjs +1 -0
  38. package/template/demojava +14 -14
  39. package/template/gitignore +11 -0
  40. package/template/index.js +57 -52
  41. package/template/indexhtml +21 -21
  42. package/template/indexvue +34 -34
  43. package/template/javaconfigjson +2 -2
  44. package/template/mainjs +13 -13
  45. package/template/package-lockjson +12115 -12115
  46. package/template/packagejson +42 -46
  47. package/template/vueconfigjs +26 -26
  48. package/utils/checkVersion.js +105 -105
  49. package/utils/http.js +122 -122
  50. 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 getPackageJson() {
10
- const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), "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() {
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
- let res = await postNormal(global.baseUrl + "/api/cauth/token", body)
36
- if (res.result) {
37
- global.accessToken = res.data.accessToken
38
- return true;
39
- }
40
- return false
41
- }
42
-
43
-
44
- module.exports = { getBusToken }
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 }