cloudcc-cli 1.2.9 → 1.3.1
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 +904 -888
- package/bin/build.js +5 -5
- package/bin/buildccbasesdk.js +5 -5
- package/bin/buildccsdk.js +5 -5
- package/bin/buildtag.js +6 -6
- package/bin/create.js +5 -5
- package/bin/publish.js +5 -5
- package/bin/publishh5.js +6 -6
- package/package.json +39 -39
- package/src/buildTag.js +74 -74
- package/src/builderBaseSDK.js +89 -89
- package/src/builderPlugin.js +210 -209
- package/src/builderSDK.js +160 -160
- package/src/creatorTemProject.js +90 -90
- package/src/publishProject.js +239 -239
- package/src/publishProjectH5.js +180 -180
- package/template/generateIDjs +4 -4
- package/template/httpjs +107 -108
- package/template/index.js +65 -65
- package/template/indexvue +343 -343
- package/template/mainjs +16 -16
- package/template/package-lockjson +12154 -12154
- package/template/packagejson +58 -58
- package/template/vueconfigjs +20 -20
- package/test/index.html +14 -14
- package/test/test.js +5 -5
- package/utils/askTool.js +95 -95
- package/utils/changeVersion copy.js +74 -74
- package/utils/changeVersion.js +26 -26
- package/utils/checkVersion.js +90 -90
- package/utils/deploy.js +8 -8
- package/utils/encryption.js +20 -20
- package/utils/http.js +95 -95
- package/utils/md2html.js +88 -88
- package/utils/notifyIM.js +86 -86
- package/utils/pushCode.js +186 -186
- package/utils/test.js +1 -1
- 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/buildtag.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const Creator = require("../src/buildTag.js");
|
|
4
|
-
|
|
5
|
-
const project = new Creator();
|
|
6
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const Creator = require("../src/buildTag.js");
|
|
4
|
+
|
|
5
|
+
const project = new Creator();
|
|
6
|
+
|
|
7
7
|
project.init();
|
package/bin/create.js
CHANGED
package/bin/publish.js
CHANGED
package/bin/publishh5.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const Publish = require("../src/publishProjectH5.js");
|
|
4
|
-
|
|
5
|
-
const publish = new Publish();
|
|
6
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const Publish = require("../src/publishProjectH5.js");
|
|
4
|
+
|
|
5
|
+
const publish = new Publish();
|
|
6
|
+
|
|
7
7
|
publish.init();
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "cloudcc-cli",
|
|
3
|
-
"version": "1.
|
|
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
|
-
"cloudccPublicH5": "bin/publishh5.js",
|
|
17
|
-
"cloudccBuildCCSDK": "bin/buildccsdk.js",
|
|
18
|
-
"cloudccBuildCCBaseSDK": "bin/buildccbasesdk.js",
|
|
19
|
-
"cloudccBuildTag": "bin/buildtag.js"
|
|
20
|
-
},
|
|
21
|
-
"scripts": {
|
|
22
|
-
"cc-pull": "git fetch --tags -f && git pull",
|
|
23
|
-
"publish-lib": "npm publish --registry https://registry.npmjs.org && curl https://npmmirror.com/sync/cloudcc-cli"
|
|
24
|
-
},
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"axios": "^0.21.4",
|
|
27
|
-
"boxen": "^4.0.0",
|
|
28
|
-
"chalk": "^2.4.2",
|
|
29
|
-
"crypto-js": "^4.1.1",
|
|
30
|
-
"dayjs": "^1.10.7",
|
|
31
|
-
"inquirer": "^8.1.0",
|
|
32
|
-
"marked": "^3.0.7",
|
|
33
|
-
"md-to-html": "^1.0.2",
|
|
34
|
-
"mem-fs": "^2.2.1",
|
|
35
|
-
"mem-fs-editor": "^9.0.1",
|
|
36
|
-
"vue-custom-element": "^3.3.0",
|
|
37
|
-
"vue-template-compiler": "^2.6.14"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "cloudcc-cli",
|
|
3
|
+
"version": "1.3.1",
|
|
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
|
+
"cloudccPublicH5": "bin/publishh5.js",
|
|
17
|
+
"cloudccBuildCCSDK": "bin/buildccsdk.js",
|
|
18
|
+
"cloudccBuildCCBaseSDK": "bin/buildccbasesdk.js",
|
|
19
|
+
"cloudccBuildTag": "bin/buildtag.js"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"cc-pull": "git fetch --tags -f && git pull",
|
|
23
|
+
"publish-lib": "npm publish --registry https://registry.npmjs.org && curl https://npmmirror.com/sync/cloudcc-cli"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"axios": "^0.21.4",
|
|
27
|
+
"boxen": "^4.0.0",
|
|
28
|
+
"chalk": "^2.4.2",
|
|
29
|
+
"crypto-js": "^4.1.1",
|
|
30
|
+
"dayjs": "^1.10.7",
|
|
31
|
+
"inquirer": "^8.1.0",
|
|
32
|
+
"marked": "^3.0.7",
|
|
33
|
+
"md-to-html": "^1.0.2",
|
|
34
|
+
"mem-fs": "^2.2.1",
|
|
35
|
+
"mem-fs-editor": "^9.0.1",
|
|
36
|
+
"vue-custom-element": "^3.3.0",
|
|
37
|
+
"vue-template-compiler": "^2.6.14"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/buildTag.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
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 { askTag } = require("../utils/askTool")
|
|
13
|
-
// 通知IM
|
|
14
|
-
const { notifyDingDing } = require("../utils/NotifyIM")
|
|
15
|
-
/**
|
|
16
|
-
* 打包基础SDK,并发布到NPM
|
|
17
|
-
*/
|
|
18
|
-
class Builder {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.user = exec("git config user.name").toString("utf8").trim();
|
|
21
|
-
}
|
|
22
|
-
async init() {
|
|
23
|
-
let res = await checkUpdate();
|
|
24
|
-
if (!res) {
|
|
25
|
-
let toTag = await askTag('请选择要创建的Tag:');
|
|
26
|
-
let fromTag = await askTag('基于哪个Tag创建:');
|
|
27
|
-
if (toTag.type == fromTag.type) {
|
|
28
|
-
console.log()
|
|
29
|
-
console.log(chalk.red("无法创建Tag:\n\n" + "from:" + fromTag.type + "\n" + "to:" + toTag.type))
|
|
30
|
-
console.log()
|
|
31
|
-
} else {
|
|
32
|
-
if (this.setTag(toTag.type, fromTag.type)) {
|
|
33
|
-
let version = exec(`git log ${fromTag.type} -1 --oneline`).toString("utf-8").split(" ")[1];
|
|
34
|
-
notifyDingDing(toTag.type, version, projectConfig, this.user)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* 设置Tags
|
|
42
|
-
*/
|
|
43
|
-
setTag(toTag, fromTag) {
|
|
44
|
-
console.log(chalk.green('开始创建Tag,请稍后...'));
|
|
45
|
-
try {
|
|
46
|
-
// 更新tag
|
|
47
|
-
exec("git fetch --tags -f")
|
|
48
|
-
} catch (error) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
// 删除本地Tag
|
|
54
|
-
exec("git tag -d " + toTag)
|
|
55
|
-
} catch (error) {
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
try {
|
|
59
|
-
// 删除远程Tag
|
|
60
|
-
exec("git push origin :refs/tags/" + toTag)
|
|
61
|
-
} catch (error) {
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// 添加tag
|
|
65
|
-
exec("git tag " + toTag + " " + fromTag + " -f")
|
|
66
|
-
|
|
67
|
-
// 推送tag
|
|
68
|
-
exec("git push --tags")
|
|
69
|
-
|
|
70
|
-
console.log(chalk.green('Tag设置成功!'));
|
|
71
|
-
console.log();
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
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 { askTag } = require("../utils/askTool")
|
|
13
|
+
// 通知IM
|
|
14
|
+
const { notifyDingDing } = require("../utils/NotifyIM")
|
|
15
|
+
/**
|
|
16
|
+
* 打包基础SDK,并发布到NPM
|
|
17
|
+
*/
|
|
18
|
+
class Builder {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.user = exec("git config user.name").toString("utf8").trim();
|
|
21
|
+
}
|
|
22
|
+
async init() {
|
|
23
|
+
let res = await checkUpdate();
|
|
24
|
+
if (!res) {
|
|
25
|
+
let toTag = await askTag('请选择要创建的Tag:');
|
|
26
|
+
let fromTag = await askTag('基于哪个Tag创建:');
|
|
27
|
+
if (toTag.type == fromTag.type) {
|
|
28
|
+
console.log()
|
|
29
|
+
console.log(chalk.red("无法创建Tag:\n\n" + "from:" + fromTag.type + "\n" + "to:" + toTag.type))
|
|
30
|
+
console.log()
|
|
31
|
+
} else {
|
|
32
|
+
if (this.setTag(toTag.type, fromTag.type)) {
|
|
33
|
+
let version = exec(`git log ${fromTag.type} -1 --oneline`).toString("utf-8").split(" ")[1];
|
|
34
|
+
notifyDingDing(toTag.type, version, projectConfig, this.user)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 设置Tags
|
|
42
|
+
*/
|
|
43
|
+
setTag(toTag, fromTag) {
|
|
44
|
+
console.log(chalk.green('开始创建Tag,请稍后...'));
|
|
45
|
+
try {
|
|
46
|
+
// 更新tag
|
|
47
|
+
exec("git fetch --tags -f")
|
|
48
|
+
} catch (error) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
// 删除本地Tag
|
|
54
|
+
exec("git tag -d " + toTag)
|
|
55
|
+
} catch (error) {
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
// 删除远程Tag
|
|
60
|
+
exec("git push origin :refs/tags/" + toTag)
|
|
61
|
+
} catch (error) {
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 添加tag
|
|
65
|
+
exec("git tag " + toTag + " " + fromTag + " -f")
|
|
66
|
+
|
|
67
|
+
// 推送tag
|
|
68
|
+
exec("git push --tags")
|
|
69
|
+
|
|
70
|
+
console.log(chalk.green('Tag设置成功!'));
|
|
71
|
+
console.log();
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
75
|
module.exports = Builder;
|
package/src/builderBaseSDK.js
CHANGED
|
@@ -1,90 +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,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
|
-
}
|
|
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
|
+
}
|
|
90
90
|
module.exports = Builder;
|