cloudcc-cli 1.2.5 → 1.2.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.
- package/README.md +16 -0
- package/package.json +1 -1
- package/src/publishProject.js +55 -49
- package/src/publishProjectH5.js +48 -46
- package/template/Appvue +29 -19
- package/template/httpjs +2 -3
- package/template/index.js +1 -0
- package/template/indexvue +163 -116
- package/template/mainjs +4 -1
- package/template/package-lockjson +26 -40
- package/template/packagejson +14 -8
- package/template/vueconfigjs +16 -2
- package/cloudcc-cli +0 -3332
package/README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
# ReleaseV1.2.7
|
|
2
|
+
#### 发布日期:2022-12-5
|
|
3
|
+
#### 发布范围:全量
|
|
4
|
+
#### 发布内容
|
|
5
|
+
* 迭代
|
|
6
|
+
* 打包项目增加详细日志输出
|
|
7
|
+
* 优化
|
|
8
|
+
|
|
9
|
+
# ReleaseV1.2.6
|
|
10
|
+
#### 发布日期:2022-11-21
|
|
11
|
+
#### 发布范围:全量
|
|
12
|
+
#### 发布内容
|
|
13
|
+
* 迭代
|
|
14
|
+
* 替换组件开发模板
|
|
15
|
+
* 优化
|
|
16
|
+
|
|
1
17
|
# ReleaseV1.2.5
|
|
2
18
|
#### 发布日期:2022-11-17
|
|
3
19
|
#### 发布范围:全量
|
package/package.json
CHANGED
package/src/publishProject.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const exec = require('child_process')
|
|
1
|
+
const { execSync, exec } = require('child_process');
|
|
2
2
|
const chalk = require("chalk")
|
|
3
3
|
// 文件编辑对象
|
|
4
4
|
const fs = require("fs")
|
|
@@ -41,7 +41,7 @@ class Publish {
|
|
|
41
41
|
let arr = item.split("=");
|
|
42
42
|
this.args.set(arr[0], arr[1]);
|
|
43
43
|
});
|
|
44
|
-
this.user = this.args.get("user") ||
|
|
44
|
+
this.user = this.args.get("user") || execSync("git config user.name").toString("utf8").trim();
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* 初始化
|
|
@@ -77,7 +77,7 @@ class Publish {
|
|
|
77
77
|
}
|
|
78
78
|
// 2:如果命令行包含了分支信息,那么git切换到命令行的分支
|
|
79
79
|
if (this.args.get("branch")) {
|
|
80
|
-
|
|
80
|
+
execSync(`git checkout ${this.args.get("branch")}`);
|
|
81
81
|
console.log(chalk.green("切换分支:" + this.args.get("branch")))
|
|
82
82
|
console.log()
|
|
83
83
|
}
|
|
@@ -112,40 +112,43 @@ class Publish {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
// 5:开始打包
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
115
|
+
this.build(condition, version)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* 编译成功回调
|
|
120
|
+
*/
|
|
121
|
+
buildSucess(condition, version) {
|
|
122
|
+
// 6:将readme生成为html,并复制到dist中
|
|
123
|
+
let outPath = "dist"
|
|
124
|
+
// 读取配置,是否改变了输出路径
|
|
125
|
+
if (projectConfig.config && projectConfig.config["doc-path"]) {
|
|
126
|
+
outPath = projectConfig.config["doc-path"];
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
// 设置readme文件位置
|
|
130
|
+
change("README", outPath);
|
|
131
|
+
} catch (error) {
|
|
132
|
+
console.log(chalk.red("README写入异常:" + error))
|
|
133
|
+
}
|
|
128
134
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
try {
|
|
136
|
+
// 7:写入版本信息
|
|
137
|
+
this.writeVersion(version);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
console.log(chalk.red("版本信息写入异常:" + error))
|
|
140
|
+
}
|
|
135
141
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
notifyFeishu(condition.type, version, projectConfig, this.user)
|
|
142
|
-
notifyDingDing(condition.type, version, projectConfig, this.user)
|
|
143
|
-
console.log();
|
|
144
|
-
console.log(chalk.green('发布完成'));
|
|
145
|
-
console.log();
|
|
146
|
-
}
|
|
142
|
+
// 8:发布代码并设置tags,触发发布,飞书提醒
|
|
143
|
+
if (pushCodeAndTags([condition.type], this.args.get("update"))) {
|
|
144
|
+
if (projectConfig && projectConfig.config) {
|
|
145
|
+
jenkins(projectConfig.config["jenkins-" + condition.type])
|
|
147
146
|
}
|
|
148
|
-
|
|
147
|
+
notifyFeishu(condition.type, version, projectConfig, this.user)
|
|
148
|
+
notifyDingDing(condition.type, version, projectConfig, this.user)
|
|
149
|
+
console.log();
|
|
150
|
+
console.log(chalk.green('发布完成'));
|
|
151
|
+
console.log();
|
|
149
152
|
}
|
|
150
153
|
}
|
|
151
154
|
/**
|
|
@@ -154,26 +157,29 @@ class Publish {
|
|
|
154
157
|
* @param {发布版本} versions:V12.0.0
|
|
155
158
|
* @returns
|
|
156
159
|
*/
|
|
157
|
-
|
|
160
|
+
build(condition, version) {
|
|
158
161
|
console.log(chalk.green('开始编译,请稍后...'));
|
|
159
162
|
console.log();
|
|
163
|
+
let that = this;
|
|
160
164
|
// 打包命令
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
exec('npm run build', (error, stdout, stderr) => {
|
|
166
|
+
if (error) {
|
|
167
|
+
exec('npx vue-cli-service build', (error, stdout, stderr) => {
|
|
168
|
+
if (error) {
|
|
169
|
+
console.log('编译失败:', error);
|
|
170
|
+
console.log(chalk.red('编译失败:' + stdout));
|
|
171
|
+
} else {
|
|
172
|
+
console.log(chalk.green('编译成功!'));
|
|
173
|
+
console.log();
|
|
174
|
+
that.buildSucess(condition, version);
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
} else {
|
|
169
178
|
console.log(chalk.green('编译成功!'));
|
|
170
179
|
console.log();
|
|
171
|
-
|
|
172
|
-
} catch (error) {
|
|
173
|
-
console.log(chalk.red('编译失败!' + error));
|
|
174
|
-
return false
|
|
180
|
+
that.buildSucess(condition, version);
|
|
175
181
|
}
|
|
176
|
-
}
|
|
182
|
+
})
|
|
177
183
|
|
|
178
184
|
}
|
|
179
185
|
/**
|
|
@@ -183,7 +189,7 @@ class Publish {
|
|
|
183
189
|
writeVersion(version) {
|
|
184
190
|
try {
|
|
185
191
|
// 获得分支信息
|
|
186
|
-
let branch =
|
|
192
|
+
let branch = execSync('git rev-parse --abbrev-ref HEAD');
|
|
187
193
|
branch = branch.toString("utf8").trim();
|
|
188
194
|
// 获得提交版本信息
|
|
189
195
|
var gitHEAD = fs.readFileSync('.git/HEAD', 'utf-8').trim()
|
package/src/publishProjectH5.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const exec = require('child_process')
|
|
1
|
+
const { execSync, exec } = require('child_process');
|
|
2
2
|
const chalk = require("chalk")
|
|
3
3
|
// 文件编辑对象
|
|
4
4
|
const fs = require("fs")
|
|
@@ -37,7 +37,7 @@ class Publish {
|
|
|
37
37
|
let arr = item.split("=");
|
|
38
38
|
this.args.set(arr[0], arr[1]);
|
|
39
39
|
});
|
|
40
|
-
this.user = this.args.get("user") ||
|
|
40
|
+
this.user = this.args.get("user") || execSync("git config user.name").toString("utf8").trim();
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* 初始化
|
|
@@ -64,39 +64,42 @@ class Publish {
|
|
|
64
64
|
console.log(chalk.green('待发布版本:' + version));
|
|
65
65
|
console.log();
|
|
66
66
|
// 4:开始打包
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
this.build(condition, version)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 编译成功
|
|
72
|
+
*/
|
|
73
|
+
buildSucess(condition, version) {
|
|
74
|
+
// 5:将readme生成为html,并复制到dist中
|
|
75
|
+
let outPath = "dist"
|
|
76
|
+
// 读取配置,是否改变了输出路径
|
|
77
|
+
if (projectConfig.config && projectConfig.config["doc-path"]) {
|
|
78
|
+
outPath = projectConfig.config["doc-path"];
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
// 设置readme文件位置
|
|
82
|
+
change("README", outPath);
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.log(chalk.red("README写入异常:" + error))
|
|
85
|
+
}
|
|
80
86
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
try {
|
|
88
|
+
// 6:写入版本信息
|
|
89
|
+
this.writeVersion(version, outPath);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.log(chalk.red("版本信息写入异常:" + error))
|
|
92
|
+
}
|
|
87
93
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
notifyDingDing(condition.type, version, projectConfig, this.user)
|
|
94
|
-
console.log();
|
|
95
|
-
console.log(chalk.green('发布完成'));
|
|
96
|
-
console.log();
|
|
97
|
-
}
|
|
94
|
+
// 7:发布代码并设置tags,触发发布,飞书提醒
|
|
95
|
+
if (pushCodeAndTags([condition.type], this.args.get("update"))) {
|
|
96
|
+
if (projectConfig && projectConfig.config) {
|
|
97
|
+
jenkins(projectConfig.config["jenkins-" + condition.type])
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
notifyDingDing(condition.type, version, projectConfig, this.user)
|
|
100
|
+
console.log();
|
|
101
|
+
console.log(chalk.green('发布完成'));
|
|
102
|
+
console.log();
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
/**
|
|
@@ -105,21 +108,20 @@ class Publish {
|
|
|
105
108
|
* @param {发布版本} versions:V12.0.0
|
|
106
109
|
* @returns
|
|
107
110
|
*/
|
|
108
|
-
|
|
111
|
+
build(condition, version) {
|
|
109
112
|
console.log(chalk.green('开始编译,请稍后...'));
|
|
110
113
|
console.log();
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
114
|
+
let that = this;
|
|
115
|
+
exec('cli.exe publish --platform h5 --project ' + projectConfig.name, (error, stdout, stderr) => {
|
|
116
|
+
if (error) {
|
|
117
|
+
console.log('编译失败:', error);
|
|
118
|
+
console.log(chalk.red('编译失败:' + stdout));
|
|
119
|
+
} else {
|
|
120
|
+
console.log(chalk.green('编译成功!'));
|
|
121
|
+
console.log();
|
|
122
|
+
that.buildSucess(condition, version);
|
|
123
|
+
}
|
|
124
|
+
})
|
|
123
125
|
}
|
|
124
126
|
/**
|
|
125
127
|
* 将版本信息写入文件
|
|
@@ -129,7 +131,7 @@ class Publish {
|
|
|
129
131
|
writeVersion(version, outPath = "dist") {
|
|
130
132
|
try {
|
|
131
133
|
// 获得分支信息
|
|
132
|
-
let branch =
|
|
134
|
+
let branch = execSync('git rev-parse --abbrev-ref HEAD');
|
|
133
135
|
branch = branch.toString("utf8").trim();
|
|
134
136
|
// 获得提交版本信息
|
|
135
137
|
var gitHEAD = fs.readFileSync('.git/HEAD', 'utf-8').trim()
|
package/template/Appvue
CHANGED
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
<
|
|
2
|
+
<div class="app">
|
|
3
|
+
<div @click="hello">hello CloudCC</div>
|
|
4
|
+
<Plugin />
|
|
4
5
|
</div>
|
|
5
6
|
</template>
|
|
6
7
|
|
|
7
8
|
<script>
|
|
8
|
-
import
|
|
9
|
-
export default {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
import Plugin from "../plugin/index.vue";
|
|
10
|
+
export default {
|
|
11
|
+
name: "App",
|
|
12
|
+
components: {
|
|
13
|
+
Plugin,
|
|
14
|
+
},
|
|
15
|
+
methods: {
|
|
16
|
+
hello() {
|
|
17
|
+
this.$CCDK.CCMessage.showMessage("Hello CloudCC");
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
15
21
|
</script>
|
|
16
22
|
|
|
17
|
-
<style>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
<style lang="scss">
|
|
24
|
+
html body {
|
|
25
|
+
padding: 0;
|
|
26
|
+
margin: 0;
|
|
27
|
+
height: 100vh;
|
|
28
|
+
width: 100%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.app {
|
|
32
|
+
margin: auto;
|
|
33
|
+
height: 100px;
|
|
34
|
+
width: 200px;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
package/template/httpjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import axios from 'axios'
|
|
2
2
|
import packageJson from '../package.json'
|
|
3
|
-
import * as CCDK from "cloudcc-ccdk/lib/ccdk.min.js";
|
|
4
3
|
const service = axios.create({
|
|
5
4
|
timeout: 60000, // request timeout
|
|
6
5
|
headers: {
|
|
@@ -11,7 +10,7 @@ const service = axios.create({
|
|
|
11
10
|
// request interceptor
|
|
12
11
|
service.interceptors.request.use(
|
|
13
12
|
config => {
|
|
14
|
-
config.headers.accessToken = CCDK.CCToken.getToken()
|
|
13
|
+
config.headers.accessToken = window.$CCDK.CCToken.getToken()
|
|
15
14
|
return config
|
|
16
15
|
},
|
|
17
16
|
error => {
|
|
@@ -39,7 +38,7 @@ const formateData = data => {
|
|
|
39
38
|
head: {
|
|
40
39
|
appType: packageJson.name,
|
|
41
40
|
appVersion: packageJson.version,
|
|
42
|
-
accessToken: CCDK.CCToken.getToken()
|
|
41
|
+
accessToken: window.$CCDK.CCToken.getToken()
|
|
43
42
|
},
|
|
44
43
|
body: {
|
|
45
44
|
...data
|
package/template/index.js
CHANGED