cloudcc-cli 1.0.9 → 1.1.0
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 +755 -748
- package/bin/build.js +5 -5
- package/bin/buildccbasesdk.js +5 -5
- package/bin/buildccsdk.js +5 -5
- package/bin/create.js +5 -5
- package/bin/publish.js +5 -5
- package/package.json +36 -36
- package/src/builderBaseSDK.js +89 -88
- package/src/builderPlugin.js +200 -200
- package/src/builderSDK.js +160 -160
- package/src/creatorTemProject.js +89 -89
- package/src/publishProject.js +206 -205
- package/template/generateIDjs +4 -4
- package/template/httpjs +109 -109
- package/template/index.js +60 -60
- package/template/indexvue +296 -296
- package/template/mainjs +13 -13
- package/template/packagejson +52 -52
- package/template/vueconfigjs +6 -6
- package/test/index.html +14 -14
- package/test/test.js +5 -5
- package/utils/askTool.js +63 -63
- package/utils/changeVersion copy.js +74 -74
- package/utils/changeVersion.js +26 -26
- package/utils/checkVersion.js +74 -74
- package/utils/encryption.js +20 -20
- package/utils/http.js +95 -95
- package/utils/md2html.js +88 -88
- package/utils/notifyIM.js +86 -55
- package/utils/pushCode.js +170 -170
- package/utils/test.js +3 -3
- package/utils/trigger.js +15 -15
- package/utils/updatei18n.js +126 -126
package/bin/build.js
CHANGED
package/bin/buildccbasesdk.js
CHANGED
package/bin/buildccsdk.js
CHANGED
package/bin/create.js
CHANGED
package/bin/publish.js
CHANGED
package/package.json
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "cloudcc-cli",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "cloudcc-cli",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"cloudcc",
|
|
7
|
-
"cloudcc-cli"
|
|
8
|
-
],
|
|
9
|
-
"main": "./bin",
|
|
10
|
-
"author": "cloudcc",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"bin": {
|
|
13
|
-
"cloudccCreate": "bin/create.js",
|
|
14
|
-
"cloudccBuild": "bin/build.js",
|
|
15
|
-
"cloudccPublic": "bin/publish.js",
|
|
16
|
-
"cloudccBuildCCSDK": "bin/buildccsdk.js",
|
|
17
|
-
"cloudccBuildCCBaseSDK": "bin/buildccbasesdk.js"
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"publish-lib": "npm publish --registry https://registry.npmjs.org"
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"axios": "^0.21.4",
|
|
24
|
-
"boxen": "^4.0.0",
|
|
25
|
-
"chalk": "^2.4.2",
|
|
26
|
-
"crypto-js": "^4.1.1",
|
|
27
|
-
"dayjs": "^1.10.7",
|
|
28
|
-
"inquirer": "^8.1.0",
|
|
29
|
-
"marked": "^3.0.7",
|
|
30
|
-
"md-to-html": "^1.0.2",
|
|
31
|
-
"mem-fs": "^2.2.1",
|
|
32
|
-
"mem-fs-editor": "^9.0.1",
|
|
33
|
-
"vue-custom-element": "^3.3.0",
|
|
34
|
-
"vue-template-compiler": "^2.6.14"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "cloudcc-cli",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "cloudcc-cli",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cloudcc",
|
|
7
|
+
"cloudcc-cli"
|
|
8
|
+
],
|
|
9
|
+
"main": "./bin",
|
|
10
|
+
"author": "cloudcc",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"bin": {
|
|
13
|
+
"cloudccCreate": "bin/create.js",
|
|
14
|
+
"cloudccBuild": "bin/build.js",
|
|
15
|
+
"cloudccPublic": "bin/publish.js",
|
|
16
|
+
"cloudccBuildCCSDK": "bin/buildccsdk.js",
|
|
17
|
+
"cloudccBuildCCBaseSDK": "bin/buildccbasesdk.js"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"publish-lib": "npm publish --registry https://registry.npmjs.org"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"axios": "^0.21.4",
|
|
24
|
+
"boxen": "^4.0.0",
|
|
25
|
+
"chalk": "^2.4.2",
|
|
26
|
+
"crypto-js": "^4.1.1",
|
|
27
|
+
"dayjs": "^1.10.7",
|
|
28
|
+
"inquirer": "^8.1.0",
|
|
29
|
+
"marked": "^3.0.7",
|
|
30
|
+
"md-to-html": "^1.0.2",
|
|
31
|
+
"mem-fs": "^2.2.1",
|
|
32
|
+
"mem-fs-editor": "^9.0.1",
|
|
33
|
+
"vue-custom-element": "^3.3.0",
|
|
34
|
+
"vue-template-compiler": "^2.6.14"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/builderBaseSDK.js
CHANGED
|
@@ -1,89 +1,90 @@
|
|
|
1
|
-
// 同步执行exe命令
|
|
2
|
-
const exec = require('child_process').execSync;
|
|
3
|
-
// 文件管理器
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
// 控制台输出样式控件
|
|
6
|
-
const chalk = require("chalk")
|
|
7
|
-
// 检查版本更新
|
|
8
|
-
const { checkUpdate } = require("../utils/checkVersion")
|
|
9
|
-
// 配置信息
|
|
10
|
-
const projectConfig = JSON.parse(fs.readFileSync('package.json', 'utf8'))
|
|
11
|
-
// 控制台交互
|
|
12
|
-
const { askType, askTypeOther } = require("../utils/askTool")
|
|
13
|
-
// 提交代码,设置Tag
|
|
14
|
-
const { getNewVersionName, pushCodeAndTags } = require("../utils/pushCode")
|
|
15
|
-
// 通知飞书
|
|
16
|
-
const { notifyFeishu } = require("../utils/NotifyIM")
|
|
17
|
-
// 网络请求
|
|
18
|
-
const { postParams } = require("../utils/http")
|
|
19
|
-
/**
|
|
20
|
-
* 打包基础SDK,并发布到NPM
|
|
21
|
-
*/
|
|
22
|
-
class Builder {
|
|
23
|
-
constructor() {
|
|
24
|
-
}
|
|
25
|
-
async init() {
|
|
26
|
-
let res = await checkUpdate();
|
|
27
|
-
if (!res) {
|
|
28
|
-
let condition = await askType();
|
|
29
|
-
if ("other" == condition.type) {
|
|
30
|
-
condition = await askTypeOther();
|
|
31
|
-
}
|
|
32
|
-
let version = getNewVersionName([condition.type])
|
|
33
|
-
if (condition && condition.type) {
|
|
34
|
-
if (this.buildpush2npm(version[0].split("V")[1])) {
|
|
35
|
-
pushCodeAndTags([condition.type])
|
|
36
|
-
notifyFeishu(condition.type, version, projectConfig);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
console.log(
|
|
42
|
-
console.log();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
console.log(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
console.log(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
console.log(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
console.log(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
console.log(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
console.log(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
// 同步执行exe命令
|
|
2
|
+
const exec = require('child_process').execSync;
|
|
3
|
+
// 文件管理器
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
// 控制台输出样式控件
|
|
6
|
+
const chalk = require("chalk")
|
|
7
|
+
// 检查版本更新
|
|
8
|
+
const { checkUpdate } = require("../utils/checkVersion")
|
|
9
|
+
// 配置信息
|
|
10
|
+
const projectConfig = JSON.parse(fs.readFileSync('package.json', 'utf8'))
|
|
11
|
+
// 控制台交互
|
|
12
|
+
const { askType, askTypeOther } = require("../utils/askTool")
|
|
13
|
+
// 提交代码,设置Tag
|
|
14
|
+
const { getNewVersionName, pushCodeAndTags } = require("../utils/pushCode")
|
|
15
|
+
// 通知飞书
|
|
16
|
+
const { notifyFeishu,notifyDingDing } = require("../utils/NotifyIM")
|
|
17
|
+
// 网络请求
|
|
18
|
+
const { postParams } = require("../utils/http")
|
|
19
|
+
/**
|
|
20
|
+
* 打包基础SDK,并发布到NPM
|
|
21
|
+
*/
|
|
22
|
+
class Builder {
|
|
23
|
+
constructor() {
|
|
24
|
+
}
|
|
25
|
+
async init() {
|
|
26
|
+
let res = await checkUpdate();
|
|
27
|
+
if (!res) {
|
|
28
|
+
let condition = await askType();
|
|
29
|
+
if ("other" == condition.type) {
|
|
30
|
+
condition = await askTypeOther();
|
|
31
|
+
}
|
|
32
|
+
let version = getNewVersionName([condition.type])
|
|
33
|
+
if (condition && condition.type) {
|
|
34
|
+
if (this.buildpush2npm(version[0].split("V")[1])) {
|
|
35
|
+
pushCodeAndTags([condition.type])
|
|
36
|
+
notifyFeishu(condition.type, version, projectConfig);
|
|
37
|
+
notifyDingDing(condition.type, version, projectConfig);
|
|
38
|
+
console.log(chalk.green('发布完成'));
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
console.log();
|
|
42
|
+
console.log(chalk.red("请至少设置一个有效的Tag"));
|
|
43
|
+
console.log();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 打包并发布到npm
|
|
49
|
+
* @returns null
|
|
50
|
+
*/
|
|
51
|
+
buildpush2npm(version) {
|
|
52
|
+
try {
|
|
53
|
+
// 设置package.json版本号
|
|
54
|
+
projectConfig.version = version;
|
|
55
|
+
fs.writeFileSync('package.json', JSON.stringify(projectConfig), 'utf8')
|
|
56
|
+
} catch (e) {
|
|
57
|
+
console.log(e);
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
console.log()
|
|
61
|
+
console.log(chalk.green("开始编译,请稍后..."));
|
|
62
|
+
exec('npm run build');
|
|
63
|
+
console.log()
|
|
64
|
+
console.log(chalk.green("编译完成"));
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.log();
|
|
67
|
+
console.log(chalk.red('编译失败:' + error));
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
console.log()
|
|
72
|
+
console.log(chalk.green("NPM开始发布,请稍后..."));
|
|
73
|
+
exec(`npm publish --registry https://registry.npmjs.org`)
|
|
74
|
+
try {
|
|
75
|
+
postParams(`https://npm.taobao.org/sync/${projectConfig.name}`)
|
|
76
|
+
} catch (error) {
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
console.log()
|
|
80
|
+
console.log(chalk.green("NPM发布完成"));
|
|
81
|
+
return true
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.log();
|
|
84
|
+
console.log(chalk.red('NPM发布失败:' + error));
|
|
85
|
+
return false
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
}
|
|
89
90
|
module.exports = Builder;
|