cloudcc-cli 1.5.6 → 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.
Files changed (49) hide show
  1. package/README.md +9 -0
  2. package/bin/cc.js +44 -0
  3. package/bin/plugin.js +7 -0
  4. package/bin/project.js +7 -0
  5. package/cloudcc-cli/accessToken +1 -0
  6. package/package.json +6 -12
  7. package/src/classes/create.js +43 -0
  8. package/src/classes/index.js +8 -0
  9. package/src/classes/publish.js +47 -0
  10. package/src/plugin/create.js +80 -0
  11. package/src/plugin/index.js +8 -0
  12. package/src/{builderPlugin.js → plugin/publish.js} +2 -3
  13. package/src/{creatorTemProject.js → project/create.js} +14 -18
  14. package/template/demojava +15 -0
  15. package/template/index.js +19 -7
  16. package/template/javaconfigjson +3 -0
  17. package/utils/checkVersion.js +1 -1
  18. package/utils/http.js +24 -1
  19. package/utils/utils.js +45 -0
  20. package/bin/build.js +0 -7
  21. package/bin/buildccbasesdk.js +0 -7
  22. package/bin/buildccsdk.js +0 -7
  23. package/bin/buildtag.js +0 -7
  24. package/bin/create.js +0 -7
  25. package/bin/createPlugin.js +0 -7
  26. package/bin/publish.js +0 -7
  27. package/bin/publishBuild.js +0 -7
  28. package/bin/publishh5.js +0 -7
  29. package/bin/publishh5Build.js +0 -7
  30. package/src/buildTag.js +0 -75
  31. package/src/builderBaseSDK.js +0 -90
  32. package/src/builderCreate.js +0 -84
  33. package/src/builderSDK.js +0 -162
  34. package/src/publishProject.js +0 -221
  35. package/src/publishProjectBuild.js +0 -223
  36. package/src/publishProjectH5.js +0 -218
  37. package/src/publishProjectH5Build.js +0 -224
  38. package/utils/askTool.js +0 -96
  39. package/utils/changeVersion copy.js +0 -75
  40. package/utils/changeVersion.js +0 -24
  41. package/utils/deploy.js +0 -9
  42. package/utils/encryption.js +0 -20
  43. package/utils/github-markdown.min.css +0 -2
  44. package/utils/md2html.js +0 -89
  45. package/utils/notifyIM.js +0 -87
  46. package/utils/pushCode.js +0 -202
  47. package/utils/trigger.js +0 -23
  48. package/utils/updatei18n.js +0 -127
  49. package/utils/writeVersion.js +0 -56
@@ -1,127 +0,0 @@
1
- //文件下载
2
- const fs = require("fs");
3
- const path = require("path");
4
- const axios = require('axios');
5
- const chalk = require("chalk")
6
- const inquirer = require("inquirer")
7
-
8
-
9
-
10
- // 创建文件夹目录
11
- const filepath = "src/utils/i18n";
12
- let dirCache = {};
13
- /**
14
- * 创建文件夹
15
- */
16
- function mkdir(filepath) {
17
- const arr = filepath.split('/');
18
- let dir = arr[0];
19
- for (let i = 1; i <= arr.length; i++) {
20
- if (!dirCache[dir] && !fs.existsSync(dir)) {
21
- dirCache[dir] = true;
22
- console.log("创建", dir);
23
- fs.mkdirSync(dir);
24
- } else {
25
- // console.log("文件夹" + dir + "已存在");
26
- }
27
- dir = dir + '/' + arr[i];
28
- }
29
- }
30
- mkdir(filepath)
31
- /**
32
- * 检查多语言文件是否需要更新,如果需要更新,返回要更新的语种集合,否则返回空。
33
- */
34
- function checkVersion() {
35
-
36
- }
37
- /**
38
- * 选择要更新的文件集合
39
- */
40
- function selectUpdateFiles() {
41
-
42
- }
43
-
44
- /**
45
- *
46
- * @param {fileUrl} 文件源地址
47
- * @param {localPath} 保存的地址
48
- * @param {fileName} 文件名
49
- */
50
- function down2save(fileUrl, localPath, fileName) {
51
- const mypath = path.resolve(localPath, fileName);
52
- const writer = fs.createWriteStream(mypath);
53
- console.log(fileName + " 开始下载");
54
- return axios({
55
- method: 'get',
56
- url: fileUrl,
57
- responseType: 'stream',
58
- }).then(response => {
59
- return new Promise((resolve, reject) => {
60
- response.data.pipe(writer);
61
- let error = null;
62
- writer.on('error', err => {
63
- console.log(fileName + " 下载失败", err);
64
- error = err;
65
- writer.close();
66
- reject(err);
67
- });
68
- writer.on('close', () => {
69
- if (!error) {
70
- resolve(true);
71
- console.log(chalk.blue(fileName + " 下载成功"));
72
- }
73
- });
74
- });
75
- });
76
- }
77
-
78
- /**
79
- * 获取文件名
80
- * @param {fileUrl} 文件地址
81
- * @returns 文件名
82
- */
83
- function getFileName(fileUrl) {
84
- const arr = fileUrl.split('/');
85
- return arr[arr.length - 1];
86
- }
87
-
88
- /**
89
- * 更新多语言
90
- * @returns 结果
91
- */
92
- async function updatei18n(languageList) {
93
- let promiseArr = []
94
- languageList.forEach(item => {
95
- promiseArr.push((async (item) => {
96
- let fileName = getFileName(item);
97
- await down2save(item, filepath, fileName)
98
- })(item))
99
- })
100
- return Promise.all(promiseArr).then(function (result) {
101
- console.log()
102
- console.log(chalk.blue("所有语言下载完成"));
103
- })
104
- }
105
-
106
- /**
107
- * 是否更新多语言词库
108
- * @returns 结果
109
- */
110
- function askI18n() {
111
- const prompt = [{
112
- type: 'list',
113
- message: '是否更新多语言词库:',
114
- name: 'checked',
115
- choices: [
116
- { name: "否", value: "0" },
117
- { name: "是", value: "1" },
118
- ],
119
- }
120
- ];
121
- return inquirer.prompt(prompt)
122
- }
123
-
124
-
125
- module.exports = {
126
- updatei18n, askI18n
127
- }
@@ -1,56 +0,0 @@
1
- // 时间库
2
- const dayjs = require("dayjs")
3
- // 文件编辑对象
4
- const fs = require("fs")
5
- const { execSync } = require('child_process');
6
- /**
7
- * 将版本信息写入文件
8
- * @param {版本信息} version
9
- */
10
- module.exports = {
11
- writeVersion(version, type, projectConfig, user, branch, path = "dist") {
12
- try {
13
- // 获得分支信息
14
- if (!branch) {
15
- branch = execSync('git branch --show-current');
16
- branch = branch.toString("utf8").trim();
17
- }
18
- let versionInfo =
19
- `
20
- <!DOCTYPE html>
21
- <html lang="en">
22
-
23
- <head>
24
- <meta charset="UTF-8">
25
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
26
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
27
- <title>版本信息</title>
28
- </head>
29
-
30
- <body>
31
- <div style="font-size: 20px">
32
- <div>${projectConfig.name}</div>
33
- <div style="margin-left:48px">
34
- <div>版本:${version}</div>
35
- <div>时间:${dayjs().format('YYYY-MM-DD HH:mm:ss')}</div>
36
- <div>人员:${user}</div>
37
- <div>分支:${branch}</div>
38
- <div>标签:${type}</div>
39
- </div>
40
- </div>
41
- </body>
42
-
43
- </html>
44
- `
45
- fs.writeFileSync(path + "/version.html", versionInfo, 'utf-8');
46
- let versionInfoJson =
47
- `{"serviceName":"${projectConfig.name}","status":"OK","codeVersion":"${projectConfig.codeVersion + version}","serviceType":"${projectConfig.serviceType}"}`
48
- fs.mkdirSync(path + "/ccmonitor", { recursive: true });
49
- fs.writeFileSync(path + "/ccmonitor/sck", versionInfoJson, 'utf-8');
50
- return true
51
- } catch (error) {
52
- console.log(error)
53
- return false
54
- }
55
- }
56
- }