Skip to content

Commit 0980037

Browse files
committed
ts
1 parent 75f8fdb commit 0980037

38 files changed

+1103
-635
lines changed

.prettierrc.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

.prettierrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"trailingComma": "all",
3+
"singleQuote": true
4+
}

example/scripts/enhanced-workflow-demo.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ async function registerEnhancedWorkflows() {
1414
const provider = moduleManager.getProvider();
1515

1616
// 注册所有增强核心工作流
17-
enhancedCoreWorkflows.forEach((workflow) => {
17+
for (const workflow of enhancedCoreWorkflows) {
1818
provider.registerWorkflow(workflow);
1919
console.log(`✅ 注册工作流: ${workflow.name}`);
2020
console.log(` 描述: ${workflow.description}`);
2121
console.log(` 步骤数: ${workflow.steps.length}`);
2222
console.log();
23-
});
23+
}
2424

2525
console.log('📋 所有增强核心工作流注册完成\n');
2626
}
@@ -67,7 +67,7 @@ async function demonstrateAppWorkflows() {
6767
);
6868
}
6969

70-
console.log('\\n' + '-'.repeat(40));
70+
console.log(`\\n${'-'.repeat(40)}`);
7171

7272
// 2. 多平台应用管理工作流
7373
console.log('\\n🌍 多平台应用管理工作流演示');
@@ -99,7 +99,7 @@ async function demonstrateAppWorkflows() {
9999
);
100100
}
101101

102-
console.log('\\n' + '='.repeat(70) + '\\n');
102+
console.log(`\\n${'='.repeat(70)}\\n`);
103103
}
104104

105105
/**
@@ -130,11 +130,11 @@ async function demonstrateBundleWorkflows() {
130130
console.log('\\n📊 智能打包结果:');
131131
if (bundleResult.data?.buildResults) {
132132
const builds = bundleResult.data.buildResults;
133-
builds.forEach((build: any) => {
133+
for (const build of builds as Array<Record<string, unknown>>) {
134134
console.log(
135135
`${build.platform}: ${build.success ? '✅ 成功' : '❌ 失败'} (${build.buildTime}s, ${build.bundleSize}MB)`,
136136
);
137-
});
137+
}
138138
}
139139

140140
if (bundleResult.data?.averageScore) {
@@ -147,7 +147,7 @@ async function demonstrateBundleWorkflows() {
147147
);
148148
}
149149

150-
console.log('\\n' + '-'.repeat(40));
150+
console.log(`\\n${'-'.repeat(40)}`);
151151

152152
// 2. 增量构建工作流
153153
console.log('\\n🔄 增量构建工作流演示');
@@ -186,7 +186,7 @@ async function demonstrateBundleWorkflows() {
186186
);
187187
}
188188

189-
console.log('\\n' + '='.repeat(70) + '\\n');
189+
console.log(`\\n${'='.repeat(70)}\\n`);
190190
}
191191

192192
/**
@@ -223,9 +223,11 @@ async function demonstratePackageWorkflows() {
223223

224224
if (report.failedOperations.length > 0) {
225225
console.log('\\n❌ 失败操作:');
226-
report.failedOperations.forEach((op: any) => {
226+
for (const op of report.failedOperations as Array<
227+
Record<string, unknown>
228+
>) {
227229
console.log(` ${op.operation}: ${op.file}`);
228-
});
230+
}
229231
}
230232
}
231233
} catch (error) {
@@ -235,7 +237,7 @@ async function demonstratePackageWorkflows() {
235237
);
236238
}
237239

238-
console.log('\\n' + '='.repeat(70) + '\\n');
240+
console.log(`\\n${'='.repeat(70)}\\n`);
239241
}
240242

241243
/**
@@ -290,7 +292,7 @@ async function demonstrateVersionWorkflows() {
290292
);
291293
}
292294

293-
console.log('\\n' + '='.repeat(70) + '\\n');
295+
console.log(`\\n${'='.repeat(70)}\\n`);
294296
}
295297

296298
/**
@@ -378,7 +380,7 @@ async function demonstrateWorkflowComposition() {
378380
);
379381
}
380382

381-
console.log('\\n' + '='.repeat(70) + '\\n');
383+
console.log(`\\n${'='.repeat(70)}\\n`);
382384
}
383385

384386
/**
@@ -429,19 +431,19 @@ async function listEnhancedWorkflows() {
429431
],
430432
};
431433

432-
Object.entries(workflowCategories).forEach(([category, workflows]) => {
434+
for (const [category, workflows] of Object.entries(workflowCategories)) {
433435
console.log(`\\n📂 ${category}:`);
434436
console.log('-'.repeat(50));
435437

436-
workflows.forEach((workflow, index) => {
438+
for (const [index, workflow] of workflows.entries()) {
437439
console.log(`${index + 1}. ${workflow.name}`);
438440
console.log(` 描述: ${workflow.description}`);
439441
console.log(` 用途: ${workflow.useCase}`);
440442
console.log();
441-
});
442-
});
443+
}
444+
}
443445

444-
console.log('='.repeat(70) + '\\n');
446+
console.log(`${'='.repeat(70)}\\n`);
445447
}
446448

447449
/**

example/scripts/provider-api-example.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,20 +305,20 @@ async function main() {
305305
try {
306306
// 1. 构建和发布示例
307307
await service.buildAndPublish('ios', '1.2.3');
308-
console.log('\n' + '='.repeat(50) + '\n');
308+
console.log(`\n${'='.repeat(50)}\n`);
309309

310310
// 2. 应用管理示例
311311
await service.manageApp('ios');
312-
console.log('\n' + '='.repeat(50) + '\n');
312+
console.log(`\n${'='.repeat(50)}\n`);
313313

314314
// 3. 批量操作示例
315315
const batchResults = await service.batchOperations();
316316
console.log('批量操作结果:', batchResults);
317-
console.log('\n' + '='.repeat(50) + '\n');
317+
console.log(`\n${'='.repeat(50)}\n`);
318318

319319
// 4. 文件上传示例
320320
await service.uploadExample();
321-
console.log('\n' + '='.repeat(50) + '\n');
321+
console.log(`\n${'='.repeat(50)}\n`);
322322

323323
// 5. 高级工作流示例
324324
await demonstrateAdvancedWorkflows();

example/scripts/register-modules.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ async function main() {
2222
// 2. 列出所有可用的命令
2323
console.log('📋 可用命令列表:');
2424
const commands = moduleManager.listCommands();
25-
commands.forEach((cmd) => {
25+
for (const cmd of commands) {
2626
console.log(` - ${cmd.name}: ${cmd.description || '无描述'}`);
27-
});
27+
}
2828
console.log();
2929

3030
// 3. 列出所有可用的工作流
3131
console.log('🔄 可用工作流列表:');
3232
const workflows = moduleManager.listWorkflows();
33-
workflows.forEach((workflow) => {
33+
for (const workflow of workflows) {
3434
console.log(` - ${workflow.name}: ${workflow.description || '无描述'}`);
35-
});
35+
}
3636
console.log();
3737

3838
// 4. 执行自定义命令示例

example/scripts/workflow-demo.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ async function registerCustomWorkflows() {
1414
const provider = moduleManager.getProvider();
1515

1616
// 注册所有自定义工作流
17-
customWorkflows.forEach((workflow) => {
17+
for (const workflow of customWorkflows) {
1818
provider.registerWorkflow(workflow);
1919
console.log(`✅ 注册工作流: ${workflow.name} - ${workflow.description}`);
20-
});
20+
}
2121

2222
console.log('\n📋 所有工作流注册完成\n');
2323
}
@@ -45,7 +45,7 @@ async function demonstrateCanaryDeployment() {
4545
console.error('❌ 灰度发布工作流执行失败:', error);
4646
}
4747

48-
console.log('\n' + '='.repeat(60) + '\n');
48+
console.log(`\n${'='.repeat(60)}\n`);
4949
}
5050

5151
/**
@@ -71,7 +71,7 @@ async function demonstrateMultiEnvironmentDeploy() {
7171
console.error('❌ 多环境发布工作流执行失败:', error);
7272
}
7373

74-
console.log('\n' + '='.repeat(60) + '\n');
74+
console.log(`\n${'='.repeat(60)}\n`);
7575
}
7676

7777
/**
@@ -96,7 +96,7 @@ async function demonstrateRollbackWorkflow() {
9696
console.error('❌ 回滚工作流执行失败:', error);
9797
}
9898

99-
console.log('\n' + '='.repeat(60) + '\n');
99+
console.log(`\n${'='.repeat(60)}\n`);
100100
}
101101

102102
/**
@@ -133,7 +133,7 @@ async function demonstrateWorkflowValidation() {
133133
);
134134
}
135135

136-
console.log('\n' + '='.repeat(60) + '\n');
136+
console.log(`\n${'='.repeat(60)}\n`);
137137
}
138138

139139
/**
@@ -160,7 +160,7 @@ async function demonstrateConditionalExecution() {
160160
console.error('❌ 条件执行演示失败:', error);
161161
}
162162

163-
console.log('\n' + '='.repeat(60) + '\n');
163+
console.log(`\n${'='.repeat(60)}\n`);
164164
}
165165

166166
/**
@@ -172,25 +172,25 @@ async function listAvailableWorkflows() {
172172

173173
const workflows = moduleManager.listWorkflows();
174174

175-
workflows.forEach((workflow, index) => {
175+
for (const [index, workflow] of workflows.entries()) {
176176
console.log(`${index + 1}. ${workflow.name}`);
177177
console.log(` 描述: ${workflow.description || '无描述'}`);
178178
console.log(` 步骤数: ${workflow.steps.length}`);
179179

180180
if (workflow.options) {
181181
console.log(' 选项:');
182-
Object.entries(workflow.options).forEach(([key, option]) => {
182+
for (const [key, option] of Object.entries(workflow.options)) {
183183
const opt = option as any;
184184
const required = opt.hasValue && !opt.default;
185185
console.log(
186186
` --${key}: ${opt.description || '无描述'} ${required ? '(必需)' : ''}`,
187187
);
188-
});
188+
}
189189
}
190190
console.log();
191-
});
191+
}
192192

193-
console.log('='.repeat(60) + '\n');
193+
console.log(`${'='.repeat(60)}\n`);
194194
}
195195

196196
/**

example/workflows/custom-workflows.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,9 @@ export const rollbackWorkflow: CustomWorkflow = {
537537
};
538538

539539
console.log('📬 发送通知给:');
540-
notification.notifiedStakeholders.forEach((stakeholder) => {
540+
for (const stakeholder of notification.notifiedStakeholders) {
541541
console.log(` - ${stakeholder}`);
542-
});
542+
}
543543

544544
await new Promise((resolve) => setTimeout(resolve, 500));
545545

0 commit comments

Comments
 (0)