@taole/deploy-helper 0.7.4 → 0.7.5
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/index.mjs
CHANGED
|
@@ -28,13 +28,16 @@ function fmtAssetsCommit(msg) {
|
|
|
28
28
|
* 加载配置
|
|
29
29
|
* @returns 配置对象
|
|
30
30
|
*/
|
|
31
|
-
async function loadConfig() {
|
|
32
|
-
|
|
31
|
+
async function loadConfig(configFileName) {
|
|
32
|
+
if(!configFileName){
|
|
33
|
+
configFileName = 'deploy.config.json';
|
|
34
|
+
}
|
|
35
|
+
const configJsonPath = join(process.cwd(), configFileName);
|
|
33
36
|
if (fs.existsSync(configJsonPath)) {
|
|
34
37
|
const configJson = JSON.parse(fs.readFileSync(configJsonPath, "utf-8"));
|
|
35
38
|
return configJson;
|
|
36
39
|
}
|
|
37
|
-
log(
|
|
40
|
+
log(`文件${configFileName}不存在, 请先创建`);
|
|
38
41
|
return null;
|
|
39
42
|
}
|
|
40
43
|
|
|
@@ -131,8 +134,8 @@ async function main() {
|
|
|
131
134
|
if (command === "help") {
|
|
132
135
|
console.log(`deploy-helper v${version}`);
|
|
133
136
|
console.log(`usage: deploy-helper [command]`);
|
|
134
|
-
console.log(`command: init 初始化配置`);
|
|
135
|
-
console.log(`command: prod 生产环境部署`);
|
|
137
|
+
console.log(`command: init [-c {configFileName}] 初始化配置`);
|
|
138
|
+
console.log(`command: prod [-c {configFileName}] 生产环境部署`);
|
|
136
139
|
console.log(`command: test 测试环境部署`);
|
|
137
140
|
console.log(`command: scp {file} 复制文件{file}到OfficialSite测试服务器{file}`);
|
|
138
141
|
console.log(`command: scp {file} {dest} 复制文件{file}到OfficialSite测试服务器{dest}`);
|
|
@@ -230,9 +233,22 @@ async function main() {
|
|
|
230
233
|
const mode = process.argv[2] === 'prod' ? 'prod' : 'test'; // 部署环境
|
|
231
234
|
log(`deploy mode: ${mode}`);
|
|
232
235
|
log(`workDir: ${workDir}`);
|
|
233
|
-
|
|
236
|
+
let configFileName = '';
|
|
237
|
+
if(process.argv[3] === '-c'){
|
|
238
|
+
// 尝试从-c中获取配置文件名
|
|
239
|
+
configFileName = process.argv[4];
|
|
240
|
+
if(!configFileName){
|
|
241
|
+
log(`-c参数必须指定配置文件名`);
|
|
242
|
+
process.exit(1);
|
|
243
|
+
} else if(configFileName){
|
|
244
|
+
log(`将使用配置文件: ${configFileName}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
234
247
|
// 读取配置
|
|
235
|
-
const config = await loadConfig();
|
|
248
|
+
const config = await loadConfig(configFileName);
|
|
249
|
+
if(!config){
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
236
252
|
// log(`config`, config);
|
|
237
253
|
|
|
238
254
|
const result = hasChangeMe(JSON.stringify(config));
|
|
@@ -52,7 +52,7 @@ export async function listPipelinesFunc(organizationId, options) {
|
|
|
52
52
|
queryParams.page = options.page;
|
|
53
53
|
}
|
|
54
54
|
const url = utils.buildUrl(baseUrl, queryParams);
|
|
55
|
-
|
|
55
|
+
let response = await utils.yunxiaoRequest(url, {
|
|
56
56
|
method: "GET",
|
|
57
57
|
});
|
|
58
58
|
const pagination = {
|
|
@@ -65,6 +65,13 @@ export async function listPipelinesFunc(organizationId, options) {
|
|
|
65
65
|
};
|
|
66
66
|
let items = [];
|
|
67
67
|
if (Array.isArray(response)) {
|
|
68
|
+
response = response.map((item) => ({
|
|
69
|
+
...item,
|
|
70
|
+
id: item.id || item.pipelineId,
|
|
71
|
+
name: item.name || item.pipelineName,
|
|
72
|
+
creatorAccountId: item.creatorAccountId || item.createAccountId,
|
|
73
|
+
createTime: item.createTime || item.createTime,
|
|
74
|
+
}))
|
|
68
75
|
items = response.map(item => PipelineListItemSchema.parse(item));
|
|
69
76
|
}
|
|
70
77
|
return {
|