mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-11-01 15:23:11 +08:00
cli modular refactor (#16)
* add logic to support SENTRY_PROPERTIES parameter * remove update.json and meta.json files in ppk * udpapte * refactor modles * update * add package-module file * update * update readme file * modifu cli.json file * fix command issues * improve version workflow logic * udpate * update * update * update * udpate * udpate * add example * update readme file * udpate version * change logic to use pushy command uniformly
This commit is contained in:
552
example/scripts/enhanced-workflow-demo.ts
Normal file
552
example/scripts/enhanced-workflow-demo.ts
Normal file
@@ -0,0 +1,552 @@
|
||||
#!/usr/bin/env ts-node
|
||||
|
||||
import { moduleManager } from '../../src/module-manager';
|
||||
import { enhancedCoreWorkflows } from '../workflows/enhanced-core-workflows';
|
||||
|
||||
/**
|
||||
* 增强核心工作流演示脚本
|
||||
* 展示如何使用为核心模块设计的高级工作流
|
||||
*/
|
||||
|
||||
async function registerEnhancedWorkflows() {
|
||||
console.log('📦 注册增强核心工作流...\n');
|
||||
|
||||
const provider = moduleManager.getProvider();
|
||||
|
||||
// 注册所有增强核心工作流
|
||||
enhancedCoreWorkflows.forEach((workflow) => {
|
||||
provider.registerWorkflow(workflow);
|
||||
console.log(`✅ 注册工作流: ${workflow.name}`);
|
||||
console.log(` 描述: ${workflow.description}`);
|
||||
console.log(` 步骤数: ${workflow.steps.length}`);
|
||||
console.log();
|
||||
});
|
||||
|
||||
console.log('📋 所有增强核心工作流注册完成\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示App模块工作流
|
||||
*/
|
||||
async function demonstrateAppWorkflows() {
|
||||
console.log('📱 演示App模块增强工作流\n');
|
||||
console.log('='.repeat(70));
|
||||
|
||||
// 1. 应用初始化工作流
|
||||
console.log('🚀 应用初始化工作流演示');
|
||||
console.log('-'.repeat(40));
|
||||
|
||||
try {
|
||||
const initResult = await moduleManager.executeWorkflow(
|
||||
'app-initialization',
|
||||
{
|
||||
args: [],
|
||||
options: {
|
||||
name: 'MyAwesomeApp',
|
||||
platform: 'ios',
|
||||
downloadUrl: 'https://example.com/download',
|
||||
force: false,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
console.log('\\n📊 应用初始化结果:');
|
||||
console.log(
|
||||
`创建状态: ${initResult.data?.created ? '✅ 成功' : '❌ 失败'}`,
|
||||
);
|
||||
console.log(
|
||||
`配置状态: ${initResult.data?.configured ? '✅ 成功' : '❌ 失败'}`,
|
||||
);
|
||||
console.log(
|
||||
`验证状态: ${initResult.data?.verified ? '✅ 成功' : '❌ 失败'}`,
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
'❌ 应用初始化工作流失败:',
|
||||
error instanceof Error ? error.message : error,
|
||||
);
|
||||
}
|
||||
|
||||
console.log('\\n' + '-'.repeat(40));
|
||||
|
||||
// 2. 多平台应用管理工作流
|
||||
console.log('\\n🌍 多平台应用管理工作流演示');
|
||||
console.log('-'.repeat(40));
|
||||
|
||||
try {
|
||||
const managementResult = await moduleManager.executeWorkflow(
|
||||
'multi-platform-app-management',
|
||||
{
|
||||
args: [],
|
||||
options: {
|
||||
includeInactive: true,
|
||||
autoOptimize: true,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
console.log('\\n📊 多平台管理结果:');
|
||||
if (managementResult.data?.analysis) {
|
||||
const analysis = managementResult.data.analysis;
|
||||
console.log(`总应用数: ${analysis.totalApps}`);
|
||||
console.log(`活跃应用: ${analysis.activeApps}`);
|
||||
console.log(`平台分布: ${JSON.stringify(analysis.platformDistribution)}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(
|
||||
'❌ 多平台应用管理工作流失败:',
|
||||
error instanceof Error ? error.message : error,
|
||||
);
|
||||
}
|
||||
|
||||
console.log('\\n' + '='.repeat(70) + '\\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示Bundle模块工作流
|
||||
*/
|
||||
async function demonstrateBundleWorkflows() {
|
||||
console.log('📦 演示Bundle模块增强工作流\n');
|
||||
console.log('='.repeat(70));
|
||||
|
||||
// 1. 智能打包工作流
|
||||
console.log('🧠 智能打包工作流演示');
|
||||
console.log('-'.repeat(40));
|
||||
|
||||
try {
|
||||
const bundleResult = await moduleManager.executeWorkflow(
|
||||
'intelligent-bundle',
|
||||
{
|
||||
args: [],
|
||||
options: {
|
||||
platform: 'ios',
|
||||
dev: false,
|
||||
sourcemap: true,
|
||||
optimize: true,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
console.log('\\n📊 智能打包结果:');
|
||||
if (bundleResult.data?.buildResults) {
|
||||
const builds = bundleResult.data.buildResults;
|
||||
builds.forEach((build: any) => {
|
||||
console.log(
|
||||
`${build.platform}: ${build.success ? '✅ 成功' : '❌ 失败'} (${build.buildTime}s, ${build.bundleSize}MB)`,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
if (bundleResult.data?.averageScore) {
|
||||
console.log(`平均质量评分: ${bundleResult.data.averageScore}%`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(
|
||||
'❌ 智能打包工作流失败:',
|
||||
error instanceof Error ? error.message : error,
|
||||
);
|
||||
}
|
||||
|
||||
console.log('\\n' + '-'.repeat(40));
|
||||
|
||||
// 2. 增量构建工作流
|
||||
console.log('\\n🔄 增量构建工作流演示');
|
||||
console.log('-'.repeat(40));
|
||||
|
||||
try {
|
||||
const incrementalResult = await moduleManager.executeWorkflow(
|
||||
'incremental-build',
|
||||
{
|
||||
args: [],
|
||||
options: {
|
||||
platform: 'android',
|
||||
baseVersion: 'v1.0.0',
|
||||
skipValidation: false,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
console.log('\\n📊 增量构建结果:');
|
||||
if (incrementalResult.data?.diffPackage) {
|
||||
const diff = incrementalResult.data.diffPackage;
|
||||
console.log(`基准版本: ${diff.fromVersion}`);
|
||||
console.log(`目标版本: ${diff.toVersion}`);
|
||||
console.log(`原始大小: ${diff.originalSize}MB`);
|
||||
console.log(`差异包大小: ${diff.diffSize}MB`);
|
||||
console.log(`压缩比: ${diff.compressionRatio}%`);
|
||||
}
|
||||
|
||||
console.log(
|
||||
`验证状态: ${incrementalResult.data?.allValid ? '✅ 通过' : '❌ 失败'}`,
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
'❌ 增量构建工作流失败:',
|
||||
error instanceof Error ? error.message : error,
|
||||
);
|
||||
}
|
||||
|
||||
console.log('\\n' + '='.repeat(70) + '\\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示Package模块工作流
|
||||
*/
|
||||
async function demonstratePackageWorkflows() {
|
||||
console.log('📄 演示Package模块增强工作流\n');
|
||||
console.log('='.repeat(70));
|
||||
|
||||
// 批量包处理工作流
|
||||
console.log('📦 批量包处理工作流演示');
|
||||
console.log('-'.repeat(40));
|
||||
|
||||
try {
|
||||
const packageResult = await moduleManager.executeWorkflow(
|
||||
'batch-package-processing',
|
||||
{
|
||||
args: [],
|
||||
options: {
|
||||
directory: './packages',
|
||||
pattern: '*.{ipa,apk,app}',
|
||||
skipUpload: false,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
console.log('\\n📊 批量包处理结果:');
|
||||
if (packageResult.data?.report) {
|
||||
const report = packageResult.data.report;
|
||||
console.log(`总包数: ${report.summary.totalPackages}`);
|
||||
console.log(`解析成功: ${report.summary.parsedSuccessfully}`);
|
||||
console.log(`上传成功: ${report.summary.uploadedSuccessfully}`);
|
||||
console.log(`总大小: ${report.summary.totalSize.toFixed(1)}MB`);
|
||||
|
||||
if (report.failedOperations.length > 0) {
|
||||
console.log('\\n❌ 失败操作:');
|
||||
report.failedOperations.forEach((op: any) => {
|
||||
console.log(` ${op.operation}: ${op.file}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(
|
||||
'❌ 批量包处理工作流失败:',
|
||||
error instanceof Error ? error.message : error,
|
||||
);
|
||||
}
|
||||
|
||||
console.log('\\n' + '='.repeat(70) + '\\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示Version模块工作流
|
||||
*/
|
||||
async function demonstrateVersionWorkflows() {
|
||||
console.log('🏷️ 演示Version模块增强工作流\n');
|
||||
console.log('='.repeat(70));
|
||||
|
||||
// 版本发布管理工作流
|
||||
console.log('🚀 版本发布管理工作流演示');
|
||||
console.log('-'.repeat(40));
|
||||
|
||||
try {
|
||||
const versionResult = await moduleManager.executeWorkflow(
|
||||
'version-release-management',
|
||||
{
|
||||
args: [],
|
||||
options: {
|
||||
name: 'v2.1.0',
|
||||
description: 'Major feature update with bug fixes',
|
||||
platform: 'ios',
|
||||
rollout: 50,
|
||||
dryRun: true, // 使用模拟发布
|
||||
force: false,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
console.log('\\n📊 版本发布结果:');
|
||||
if (versionResult.data?.summary) {
|
||||
const summary = versionResult.data.summary;
|
||||
console.log(`版本: ${summary.version}`);
|
||||
console.log(`平台: ${summary.platform}`);
|
||||
console.log(`发布状态: ${summary.success ? '✅ 成功' : '❌ 失败'}`);
|
||||
console.log(
|
||||
`监控状态: ${summary.monitoringHealthy ? '✅ 正常' : '⚠️ 有警告'}`,
|
||||
);
|
||||
|
||||
if (summary.releaseId) {
|
||||
console.log(`发布ID: ${summary.releaseId}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (versionResult.data?.dryRun) {
|
||||
console.log('\\n🔍 这是一次模拟发布,未实际执行');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(
|
||||
'❌ 版本发布管理工作流失败:',
|
||||
error instanceof Error ? error.message : error,
|
||||
);
|
||||
}
|
||||
|
||||
console.log('\\n' + '='.repeat(70) + '\\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示工作流组合使用
|
||||
*/
|
||||
async function demonstrateWorkflowComposition() {
|
||||
console.log('🔗 演示工作流组合使用\n');
|
||||
console.log('='.repeat(70));
|
||||
|
||||
console.log('📋 完整发布流程演示 (应用初始化 → 智能打包 → 版本发布)');
|
||||
console.log('-'.repeat(60));
|
||||
|
||||
try {
|
||||
// 1. 应用初始化
|
||||
console.log('\\n步骤 1: 应用初始化');
|
||||
const appResult = await moduleManager.executeWorkflow(
|
||||
'app-initialization',
|
||||
{
|
||||
args: [],
|
||||
options: {
|
||||
name: 'CompositeApp',
|
||||
platform: 'android',
|
||||
force: true,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
if (!appResult.success) {
|
||||
throw new Error('应用初始化失败');
|
||||
}
|
||||
|
||||
// 2. 智能打包
|
||||
console.log('\\n步骤 2: 智能打包');
|
||||
const bundleResult = await moduleManager.executeWorkflow(
|
||||
'intelligent-bundle',
|
||||
{
|
||||
args: [],
|
||||
options: {
|
||||
platform: 'android',
|
||||
dev: false,
|
||||
optimize: true,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
if (!bundleResult.success) {
|
||||
throw new Error('智能打包失败');
|
||||
}
|
||||
|
||||
// 3. 版本发布
|
||||
console.log('\\n步骤 3: 版本发布');
|
||||
const releaseResult = await moduleManager.executeWorkflow(
|
||||
'version-release-management',
|
||||
{
|
||||
args: [],
|
||||
options: {
|
||||
name: 'v1.0.0',
|
||||
description: 'Initial release via composition workflow',
|
||||
platform: 'android',
|
||||
rollout: 10,
|
||||
dryRun: true,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
if (!releaseResult.success) {
|
||||
throw new Error('版本发布失败');
|
||||
}
|
||||
|
||||
console.log('\\n🎉 完整发布流程执行成功!');
|
||||
console.log('📊 流程总结:');
|
||||
console.log(
|
||||
` ✅ 应用初始化: ${appResult.data?.created ? '成功' : '失败'}`,
|
||||
);
|
||||
console.log(
|
||||
` ✅ 智能打包: ${bundleResult.data?.allSuccess ? '成功' : '失败'}`,
|
||||
);
|
||||
console.log(
|
||||
` ✅ 版本发布: ${releaseResult.data?.summary?.success ? '成功' : '失败'}`,
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
'❌ 工作流组合执行失败:',
|
||||
error instanceof Error ? error.message : error,
|
||||
);
|
||||
}
|
||||
|
||||
console.log('\\n' + '='.repeat(70) + '\\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出所有增强工作流及其用途
|
||||
*/
|
||||
async function listEnhancedWorkflows() {
|
||||
console.log('📋 增强核心工作流列表\n');
|
||||
console.log('='.repeat(70));
|
||||
|
||||
const workflowCategories = {
|
||||
App模块工作流: [
|
||||
{
|
||||
name: 'app-initialization',
|
||||
description: '完整应用初始化流程 - 创建、配置、验证',
|
||||
useCase: '新应用创建和设置',
|
||||
},
|
||||
{
|
||||
name: 'multi-platform-app-management',
|
||||
description: '多平台应用统一管理工作流',
|
||||
useCase: '跨平台应用管理和优化',
|
||||
},
|
||||
],
|
||||
Bundle模块工作流: [
|
||||
{
|
||||
name: 'intelligent-bundle',
|
||||
description: '智能打包工作流 - 自动优化和多平台构建',
|
||||
useCase: '高效的自动化构建',
|
||||
},
|
||||
{
|
||||
name: 'incremental-build',
|
||||
description: '增量构建工作流 - 生成差异包',
|
||||
useCase: '减少更新包大小',
|
||||
},
|
||||
],
|
||||
Package模块工作流: [
|
||||
{
|
||||
name: 'batch-package-processing',
|
||||
description: '批量包处理工作流 - 上传、解析、验证',
|
||||
useCase: '批量处理应用包文件',
|
||||
},
|
||||
],
|
||||
Version模块工作流: [
|
||||
{
|
||||
name: 'version-release-management',
|
||||
description: '版本发布管理工作流 - 完整的版本发布生命周期',
|
||||
useCase: '规范化版本发布流程',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
Object.entries(workflowCategories).forEach(([category, workflows]) => {
|
||||
console.log(`\\n📂 ${category}:`);
|
||||
console.log('-'.repeat(50));
|
||||
|
||||
workflows.forEach((workflow, index) => {
|
||||
console.log(`${index + 1}. ${workflow.name}`);
|
||||
console.log(` 描述: ${workflow.description}`);
|
||||
console.log(` 用途: ${workflow.useCase}`);
|
||||
console.log();
|
||||
});
|
||||
});
|
||||
|
||||
console.log('='.repeat(70) + '\\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 主函数
|
||||
*/
|
||||
async function main() {
|
||||
console.log('🎯 增强核心工作流演示脚本\\n');
|
||||
|
||||
try {
|
||||
// 1. 注册增强工作流
|
||||
await registerEnhancedWorkflows();
|
||||
|
||||
// 2. 列出所有工作流
|
||||
await listEnhancedWorkflows();
|
||||
|
||||
// 3. 演示各模块工作流
|
||||
await demonstrateAppWorkflows();
|
||||
await demonstrateBundleWorkflows();
|
||||
await demonstratePackageWorkflows();
|
||||
await demonstrateVersionWorkflows();
|
||||
|
||||
// 4. 演示工作流组合
|
||||
await demonstrateWorkflowComposition();
|
||||
|
||||
console.log('🎉 所有增强核心工作流演示完成!');
|
||||
} catch (error) {
|
||||
console.error('❌ 演示过程中发生错误:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 交互式工作流执行
|
||||
*/
|
||||
async function interactiveEnhancedWorkflowExecution() {
|
||||
console.log('\\n🎮 交互式增强工作流执行\\n');
|
||||
|
||||
const workflowName = process.argv[3];
|
||||
|
||||
if (!workflowName) {
|
||||
console.log('使用方法:');
|
||||
console.log(' npm run enhanced-workflow-demo [工作流名称]');
|
||||
console.log('\\n可用的增强工作流:');
|
||||
console.log(' App模块:');
|
||||
console.log(' - app-initialization');
|
||||
console.log(' - multi-platform-app-management');
|
||||
console.log(' Bundle模块:');
|
||||
console.log(' - intelligent-bundle');
|
||||
console.log(' - incremental-build');
|
||||
console.log(' Package模块:');
|
||||
console.log(' - batch-package-processing');
|
||||
console.log(' Version模块:');
|
||||
console.log(' - version-release-management');
|
||||
return;
|
||||
}
|
||||
|
||||
// 解析命令行参数
|
||||
const options: Record<string, any> = {};
|
||||
for (let i = 4; i < process.argv.length; i += 2) {
|
||||
const key = process.argv[i]?.replace(/^--/, '');
|
||||
const value = process.argv[i + 1];
|
||||
if (key && value) {
|
||||
// 尝试解析布尔值和数字
|
||||
if (value === 'true') options[key] = true;
|
||||
else if (value === 'false') options[key] = false;
|
||||
else if (/^\d+$/.test(value)) options[key] = Number.parseInt(value);
|
||||
else options[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`执行增强工作流: ${workflowName}`);
|
||||
console.log('参数:', options);
|
||||
console.log();
|
||||
|
||||
try {
|
||||
await registerEnhancedWorkflows();
|
||||
|
||||
const result = await moduleManager.executeWorkflow(workflowName, {
|
||||
args: [],
|
||||
options,
|
||||
});
|
||||
|
||||
console.log('\\n📊 工作流执行结果:');
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
} catch (error) {
|
||||
console.error('❌ 工作流执行失败:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// 执行脚本
|
||||
if (require.main === module) {
|
||||
if (process.argv.length > 2 && process.argv[2] === 'interactive') {
|
||||
interactiveEnhancedWorkflowExecution()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error('❌ 交互式执行失败:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
} else {
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error('❌ 演示脚本执行失败:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
}
|
||||
342
example/scripts/provider-api-example.ts
Normal file
342
example/scripts/provider-api-example.ts
Normal file
@@ -0,0 +1,342 @@
|
||||
#!/usr/bin/env ts-node
|
||||
|
||||
import { moduleManager } from '../../src/module-manager';
|
||||
import type { CLIProvider, Platform } from '../../src/types';
|
||||
|
||||
/**
|
||||
* Provider API 使用示例
|
||||
* 演示如何使用 CLIProvider 进行编程式操作
|
||||
*/
|
||||
|
||||
class DeploymentService {
|
||||
private provider: CLIProvider;
|
||||
|
||||
constructor() {
|
||||
this.provider = moduleManager.getProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动化构建和发布流程
|
||||
*/
|
||||
async buildAndPublish(platform: Platform, version: string) {
|
||||
console.log(
|
||||
`🚀 开始 ${platform} 平台的构建和发布流程 (版本: ${version})\n`,
|
||||
);
|
||||
|
||||
try {
|
||||
// 1. 打包应用
|
||||
console.log('📦 正在打包应用...');
|
||||
const bundleResult = await this.provider.bundle({
|
||||
platform,
|
||||
dev: false,
|
||||
sourcemap: true,
|
||||
bundleName: `app-${version}.bundle`,
|
||||
});
|
||||
|
||||
if (!bundleResult.success) {
|
||||
throw new Error(`打包失败: ${bundleResult.error}`);
|
||||
}
|
||||
console.log('✅ 打包完成');
|
||||
|
||||
// 2. 发布版本
|
||||
console.log('\n📡 正在发布版本...');
|
||||
const publishResult = await this.provider.publish({
|
||||
name: version,
|
||||
description: `自动发布版本 ${version}`,
|
||||
rollout: 100,
|
||||
});
|
||||
|
||||
if (!publishResult.success) {
|
||||
throw new Error(`发布失败: ${publishResult.error}`);
|
||||
}
|
||||
console.log('✅ 发布完成');
|
||||
|
||||
return {
|
||||
success: true,
|
||||
bundleData: bundleResult.data,
|
||||
publishData: publishResult.data,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('❌ 构建发布失败:', error);
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Unknown error',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用管理示例
|
||||
*/
|
||||
async manageApp(platform: Platform) {
|
||||
console.log(`📱 管理 ${platform} 应用\n`);
|
||||
|
||||
try {
|
||||
// 获取当前选中的应用
|
||||
const { appId } = await this.provider.getSelectedApp(platform);
|
||||
console.log(`当前应用ID: ${appId}`);
|
||||
|
||||
// 列出应用版本
|
||||
const versionsResult = await this.provider.listVersions(appId);
|
||||
if (versionsResult.success && versionsResult.data) {
|
||||
console.log('📋 应用版本列表:');
|
||||
versionsResult.data.forEach((version: any, index: number) => {
|
||||
console.log(` ${index + 1}. ${version.name} (${version.id})`);
|
||||
});
|
||||
}
|
||||
|
||||
// 列出应用包
|
||||
const packagesResult = await (this.provider as any).listPackages(appId);
|
||||
if (packagesResult.success && packagesResult.data) {
|
||||
console.log('\n📦 应用包列表:');
|
||||
packagesResult.data.forEach((pkg: any, index: number) => {
|
||||
console.log(` ${index + 1}. ${pkg.name} (${pkg.id})`);
|
||||
});
|
||||
}
|
||||
|
||||
return { appId, platform };
|
||||
} catch (error) {
|
||||
console.error('❌ 应用管理失败:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量操作示例
|
||||
*/
|
||||
async batchOperations() {
|
||||
console.log('🔄 批量操作示例\n');
|
||||
|
||||
const platforms: Platform[] = ['ios', 'android'];
|
||||
const results = [];
|
||||
|
||||
for (const platform of platforms) {
|
||||
try {
|
||||
console.log(`--- 处理 ${platform} 平台 ---`);
|
||||
|
||||
// 获取平台信息
|
||||
const platformInfo = await this.provider.getPlatform(platform);
|
||||
console.log(`平台: ${platformInfo}`);
|
||||
|
||||
// 模拟打包操作
|
||||
const bundleResult = await this.provider.bundle({
|
||||
platform,
|
||||
dev: true,
|
||||
sourcemap: false,
|
||||
});
|
||||
|
||||
results.push({
|
||||
platform,
|
||||
success: bundleResult.success,
|
||||
data: bundleResult.data,
|
||||
});
|
||||
|
||||
console.log(
|
||||
`${platform} 处理完成: ${bundleResult.success ? '✅' : '❌'}\n`,
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(`${platform} 处理失败:`, error);
|
||||
results.push({
|
||||
platform,
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Unknown error',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传示例
|
||||
*/
|
||||
async uploadExample() {
|
||||
console.log('📤 文件上传示例\n');
|
||||
|
||||
// 模拟上传文件路径
|
||||
const mockFilePaths = {
|
||||
ios: '/path/to/app.ipa',
|
||||
android: '/path/to/app.apk',
|
||||
};
|
||||
|
||||
try {
|
||||
for (const [platform, filePath] of Object.entries(mockFilePaths)) {
|
||||
console.log(`上传 ${platform} 文件: ${filePath}`);
|
||||
|
||||
// 注意:这里是模拟,实际使用时需要真实的文件路径
|
||||
const uploadResult = await this.provider.upload({
|
||||
platform: platform as Platform,
|
||||
filePath,
|
||||
appId: 'mock-app-id',
|
||||
});
|
||||
|
||||
console.log(
|
||||
`${platform} 上传结果:`,
|
||||
uploadResult.success ? '✅' : '❌',
|
||||
);
|
||||
if (!uploadResult.success) {
|
||||
console.log(`错误: ${uploadResult.error}`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ 上传过程中发生错误:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 高级工作流示例
|
||||
*/
|
||||
async function demonstrateAdvancedWorkflows() {
|
||||
console.log('\n🔧 高级工作流示例\n');
|
||||
|
||||
const provider = moduleManager.getProvider();
|
||||
|
||||
// 注册自定义工作流
|
||||
provider.registerWorkflow({
|
||||
name: 'advanced-ci-cd',
|
||||
description: '高级CI/CD流程',
|
||||
steps: [
|
||||
{
|
||||
name: 'environment-check',
|
||||
description: '环境检查',
|
||||
execute: async (context) => {
|
||||
console.log('🔍 检查环境配置...');
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
return { environmentValid: true };
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'quality-gate',
|
||||
description: '质量门禁',
|
||||
execute: async (context, previousResult) => {
|
||||
console.log('🛡️ 执行质量门禁检查...');
|
||||
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||
|
||||
// 模拟质量检查
|
||||
const qualityScore = Math.random() * 100;
|
||||
const passed = qualityScore > 80;
|
||||
|
||||
console.log(
|
||||
`质量分数: ${qualityScore.toFixed(1)}/100 ${passed ? '✅' : '❌'}`,
|
||||
);
|
||||
|
||||
if (!passed) {
|
||||
throw new Error('质量门禁检查未通过');
|
||||
}
|
||||
|
||||
return { ...previousResult, qualityScore };
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'multi-platform-build',
|
||||
description: '多平台构建',
|
||||
execute: async (context, previousResult) => {
|
||||
console.log('🏗️ 多平台并行构建...');
|
||||
|
||||
const platforms: Platform[] = ['ios', 'android'];
|
||||
const buildResults = [];
|
||||
|
||||
// 模拟并行构建
|
||||
for (const platform of platforms) {
|
||||
console.log(` 构建 ${platform}...`);
|
||||
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||
buildResults.push({ platform, success: true });
|
||||
}
|
||||
|
||||
return { ...previousResult, builds: buildResults };
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'deployment-notification',
|
||||
description: '部署通知',
|
||||
execute: async (context, previousResult) => {
|
||||
console.log('📢 发送部署通知...');
|
||||
|
||||
const notification = {
|
||||
message: '部署完成',
|
||||
platforms: previousResult.builds?.map((b: any) => b.platform) || [],
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
|
||||
console.log('通知内容:', JSON.stringify(notification, null, 2));
|
||||
|
||||
return { ...previousResult, notification };
|
||||
},
|
||||
},
|
||||
],
|
||||
validate: (context) => {
|
||||
if (!context.options.environment) {
|
||||
console.error('❌ 必须指定环境参数');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
options: {
|
||||
environment: {
|
||||
hasValue: true,
|
||||
description: '部署环境 (必需)',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// 执行高级工作流
|
||||
try {
|
||||
const result = await provider.executeWorkflow('advanced-ci-cd', {
|
||||
args: [],
|
||||
options: {
|
||||
environment: 'production',
|
||||
},
|
||||
});
|
||||
console.log('\n🎉 高级工作流执行完成:', result);
|
||||
} catch (error) {
|
||||
console.error('❌ 高级工作流执行失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 主函数
|
||||
*/
|
||||
async function main() {
|
||||
console.log('🎯 Provider API 使用示例\n');
|
||||
|
||||
const service = new DeploymentService();
|
||||
|
||||
try {
|
||||
// 1. 构建和发布示例
|
||||
await service.buildAndPublish('ios', '1.2.3');
|
||||
console.log('\n' + '='.repeat(50) + '\n');
|
||||
|
||||
// 2. 应用管理示例
|
||||
await service.manageApp('ios');
|
||||
console.log('\n' + '='.repeat(50) + '\n');
|
||||
|
||||
// 3. 批量操作示例
|
||||
const batchResults = await service.batchOperations();
|
||||
console.log('批量操作结果:', batchResults);
|
||||
console.log('\n' + '='.repeat(50) + '\n');
|
||||
|
||||
// 4. 文件上传示例
|
||||
await service.uploadExample();
|
||||
console.log('\n' + '='.repeat(50) + '\n');
|
||||
|
||||
// 5. 高级工作流示例
|
||||
await demonstrateAdvancedWorkflows();
|
||||
} catch (error) {
|
||||
console.error('❌ 示例执行失败:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// 执行示例
|
||||
if (require.main === module) {
|
||||
main()
|
||||
.then(() => {
|
||||
console.log('\n✨ Provider API 示例执行完成');
|
||||
process.exit(0);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('❌ 示例执行失败:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
155
example/scripts/register-modules.ts
Normal file
155
example/scripts/register-modules.ts
Normal file
@@ -0,0 +1,155 @@
|
||||
#!/usr/bin/env ts-node
|
||||
|
||||
import { moduleManager } from '../../src/module-manager';
|
||||
import { analyticsModule } from '../modules/analytics-module';
|
||||
import { customDeployModule } from '../modules/custom-deploy-module';
|
||||
|
||||
/**
|
||||
* 模块注册和执行示例脚本
|
||||
* 演示如何注册自定义模块并执行命令和工作流
|
||||
*/
|
||||
|
||||
async function main() {
|
||||
console.log('🚀 开始模块注册和执行示例\n');
|
||||
|
||||
try {
|
||||
// 1. 注册自定义模块
|
||||
console.log('📦 注册自定义模块...');
|
||||
moduleManager.registerModule(customDeployModule);
|
||||
moduleManager.registerModule(analyticsModule);
|
||||
console.log('✅ 模块注册完成\n');
|
||||
|
||||
// 2. 列出所有可用的命令
|
||||
console.log('📋 可用命令列表:');
|
||||
const commands = moduleManager.listCommands();
|
||||
commands.forEach((cmd) => {
|
||||
console.log(` - ${cmd.name}: ${cmd.description || '无描述'}`);
|
||||
});
|
||||
console.log();
|
||||
|
||||
// 3. 列出所有可用的工作流
|
||||
console.log('🔄 可用工作流列表:');
|
||||
const workflows = moduleManager.listWorkflows();
|
||||
workflows.forEach((workflow) => {
|
||||
console.log(` - ${workflow.name}: ${workflow.description || '无描述'}`);
|
||||
});
|
||||
console.log();
|
||||
|
||||
// 4. 执行自定义命令示例
|
||||
console.log('🎯 执行命令示例:\n');
|
||||
|
||||
// 执行开发部署命令
|
||||
console.log('--- 执行 deploy-dev 命令 ---');
|
||||
const devDeployResult = await moduleManager.executeCommand('deploy-dev', {
|
||||
args: [],
|
||||
options: {
|
||||
platform: 'ios',
|
||||
force: true,
|
||||
},
|
||||
});
|
||||
console.log('结果:', devDeployResult);
|
||||
console.log();
|
||||
|
||||
// 执行分析统计命令
|
||||
console.log('--- 执行 track-deployment 命令 ---');
|
||||
const trackResult = await moduleManager.executeCommand('track-deployment', {
|
||||
args: [],
|
||||
options: {
|
||||
platform: 'android',
|
||||
environment: 'production',
|
||||
version: '1.2.3',
|
||||
},
|
||||
});
|
||||
console.log('结果:', trackResult);
|
||||
console.log();
|
||||
|
||||
// 生成部署报告
|
||||
console.log('--- 执行 deployment-report 命令 ---');
|
||||
const reportResult = await moduleManager.executeCommand(
|
||||
'deployment-report',
|
||||
{
|
||||
args: [],
|
||||
options: {
|
||||
days: 30,
|
||||
},
|
||||
},
|
||||
);
|
||||
console.log('结果:', reportResult);
|
||||
console.log();
|
||||
|
||||
// 5. 执行工作流示例
|
||||
console.log('🔄 执行工作流示例:\n');
|
||||
|
||||
// 执行带统计的部署工作流
|
||||
console.log('--- 执行 deploy-with-analytics 工作流 ---');
|
||||
const analyticsWorkflowResult = await moduleManager.executeWorkflow(
|
||||
'deploy-with-analytics',
|
||||
{
|
||||
args: [],
|
||||
options: {},
|
||||
},
|
||||
);
|
||||
console.log('工作流结果:', analyticsWorkflowResult);
|
||||
console.log();
|
||||
|
||||
// 执行热修复工作流
|
||||
console.log('--- 执行 hotfix-deploy 工作流 ---');
|
||||
const hotfixWorkflowResult = await moduleManager.executeWorkflow(
|
||||
'hotfix-deploy',
|
||||
{
|
||||
args: [],
|
||||
options: {
|
||||
hotfixId: 'HF-2024-001',
|
||||
},
|
||||
},
|
||||
);
|
||||
console.log('工作流结果:', hotfixWorkflowResult);
|
||||
console.log();
|
||||
|
||||
console.log('🎉 所有示例执行完成!');
|
||||
} catch (error) {
|
||||
console.error('❌ 执行过程中发生错误:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// 错误处理函数
|
||||
async function demonstrateErrorHandling() {
|
||||
console.log('\n🚨 错误处理示例:\n');
|
||||
|
||||
try {
|
||||
// 尝试执行不存在的命令
|
||||
console.log('--- 尝试执行不存在的命令 ---');
|
||||
await moduleManager.executeCommand('non-existent-command', {
|
||||
args: [],
|
||||
options: {},
|
||||
});
|
||||
} catch (error) {
|
||||
console.log('捕获错误:', error instanceof Error ? error.message : error);
|
||||
}
|
||||
|
||||
try {
|
||||
// 尝试执行缺少必需参数的命令
|
||||
console.log('\n--- 尝试执行缺少必需参数的命令 ---');
|
||||
await moduleManager.executeCommand('deploy-prod', {
|
||||
args: [],
|
||||
options: {}, // 缺少必需的 version 参数
|
||||
});
|
||||
} catch (error) {
|
||||
console.log('捕获错误:', error instanceof Error ? error.message : error);
|
||||
}
|
||||
}
|
||||
|
||||
// 主函数执行
|
||||
if (require.main === module) {
|
||||
main()
|
||||
.then(() => demonstrateErrorHandling())
|
||||
.then(() => {
|
||||
console.log('\n✨ 示例脚本执行完成');
|
||||
process.exit(0);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('❌ 脚本执行失败:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
290
example/scripts/workflow-demo.ts
Normal file
290
example/scripts/workflow-demo.ts
Normal file
@@ -0,0 +1,290 @@
|
||||
#!/usr/bin/env ts-node
|
||||
|
||||
import { moduleManager } from '../../src/module-manager';
|
||||
import { customWorkflows } from '../workflows/custom-workflows';
|
||||
|
||||
/**
|
||||
* 工作流演示脚本
|
||||
* 展示如何注册和执行复杂的工作流
|
||||
*/
|
||||
|
||||
async function registerCustomWorkflows() {
|
||||
console.log('📋 注册自定义工作流...\n');
|
||||
|
||||
const provider = moduleManager.getProvider();
|
||||
|
||||
// 注册所有自定义工作流
|
||||
customWorkflows.forEach((workflow) => {
|
||||
provider.registerWorkflow(workflow);
|
||||
console.log(`✅ 注册工作流: ${workflow.name} - ${workflow.description}`);
|
||||
});
|
||||
|
||||
console.log('\n📋 所有工作流注册完成\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示灰度发布工作流
|
||||
*/
|
||||
async function demonstrateCanaryDeployment() {
|
||||
console.log('🔥 演示灰度发布工作流\n');
|
||||
console.log('='.repeat(60));
|
||||
|
||||
try {
|
||||
const result = await moduleManager.executeWorkflow('canary-deployment', {
|
||||
args: [],
|
||||
options: {
|
||||
version: '2.1.0',
|
||||
initialRollout: 10,
|
||||
autoExpand: true,
|
||||
},
|
||||
});
|
||||
|
||||
console.log('\n📊 灰度发布工作流结果:');
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
} catch (error) {
|
||||
console.error('❌ 灰度发布工作流执行失败:', error);
|
||||
}
|
||||
|
||||
console.log('\n' + '='.repeat(60) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示多环境发布工作流
|
||||
*/
|
||||
async function demonstrateMultiEnvironmentDeploy() {
|
||||
console.log('🌍 演示多环境发布工作流\n');
|
||||
console.log('='.repeat(60));
|
||||
|
||||
try {
|
||||
const result = await moduleManager.executeWorkflow('multi-env-deploy', {
|
||||
args: [],
|
||||
options: {
|
||||
version: '2.1.0',
|
||||
skipProduction: false,
|
||||
forceProduction: false,
|
||||
},
|
||||
});
|
||||
|
||||
console.log('\n📊 多环境发布工作流结果:');
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
} catch (error) {
|
||||
console.error('❌ 多环境发布工作流执行失败:', error);
|
||||
}
|
||||
|
||||
console.log('\n' + '='.repeat(60) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示回滚工作流
|
||||
*/
|
||||
async function demonstrateRollbackWorkflow() {
|
||||
console.log('🔄 演示回滚工作流\n');
|
||||
console.log('='.repeat(60));
|
||||
|
||||
try {
|
||||
const result = await moduleManager.executeWorkflow('rollback-workflow', {
|
||||
args: [],
|
||||
options: {
|
||||
targetVersion: '2.0.5',
|
||||
skipVerification: false,
|
||||
},
|
||||
});
|
||||
|
||||
console.log('\n📊 回滚工作流结果:');
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
} catch (error) {
|
||||
console.error('❌ 回滚工作流执行失败:', error);
|
||||
}
|
||||
|
||||
console.log('\n' + '='.repeat(60) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示工作流验证失败的情况
|
||||
*/
|
||||
async function demonstrateWorkflowValidation() {
|
||||
console.log('⚠️ 演示工作流验证\n');
|
||||
console.log('='.repeat(60));
|
||||
|
||||
// 1. 演示缺少必需参数的情况
|
||||
console.log('--- 测试缺少必需参数 ---');
|
||||
try {
|
||||
await moduleManager.executeWorkflow('canary-deployment', {
|
||||
args: [],
|
||||
options: {}, // 缺少 version 参数
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(
|
||||
'✅ 正确捕获验证错误:',
|
||||
error instanceof Error ? error.message : error,
|
||||
);
|
||||
}
|
||||
|
||||
console.log('\n--- 测试回滚工作流验证 ---');
|
||||
try {
|
||||
await moduleManager.executeWorkflow('rollback-workflow', {
|
||||
args: [],
|
||||
options: {}, // 缺少 targetVersion 参数
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(
|
||||
'✅ 正确捕获验证错误:',
|
||||
error instanceof Error ? error.message : error,
|
||||
);
|
||||
}
|
||||
|
||||
console.log('\n' + '='.repeat(60) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示工作流的条件执行
|
||||
*/
|
||||
async function demonstrateConditionalExecution() {
|
||||
console.log('🔀 演示条件执行\n');
|
||||
console.log('='.repeat(60));
|
||||
|
||||
// 演示跳过生产部署
|
||||
console.log('--- 跳过生产环境部署 ---');
|
||||
try {
|
||||
const result = await moduleManager.executeWorkflow('multi-env-deploy', {
|
||||
args: [],
|
||||
options: {
|
||||
version: '2.1.1',
|
||||
skipProduction: true, // 跳过生产部署
|
||||
},
|
||||
});
|
||||
|
||||
console.log('📊 跳过生产部署的结果:');
|
||||
console.log(`包含生产部署步骤: ${result.data?.production ? '是' : '否'}`);
|
||||
} catch (error) {
|
||||
console.error('❌ 条件执行演示失败:', error);
|
||||
}
|
||||
|
||||
console.log('\n' + '='.repeat(60) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出所有可用的工作流
|
||||
*/
|
||||
async function listAvailableWorkflows() {
|
||||
console.log('📋 可用工作流列表\n');
|
||||
console.log('='.repeat(60));
|
||||
|
||||
const workflows = moduleManager.listWorkflows();
|
||||
|
||||
workflows.forEach((workflow, index) => {
|
||||
console.log(`${index + 1}. ${workflow.name}`);
|
||||
console.log(` 描述: ${workflow.description || '无描述'}`);
|
||||
console.log(` 步骤数: ${workflow.steps.length}`);
|
||||
|
||||
if (workflow.options) {
|
||||
console.log(' 选项:');
|
||||
Object.entries(workflow.options).forEach(([key, option]) => {
|
||||
const opt = option as any;
|
||||
const required = opt.hasValue && !opt.default;
|
||||
console.log(
|
||||
` --${key}: ${opt.description || '无描述'} ${required ? '(必需)' : ''}`,
|
||||
);
|
||||
});
|
||||
}
|
||||
console.log();
|
||||
});
|
||||
|
||||
console.log('='.repeat(60) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 主函数
|
||||
*/
|
||||
async function main() {
|
||||
console.log('🎯 工作流演示脚本\n');
|
||||
|
||||
try {
|
||||
// 1. 注册自定义工作流
|
||||
await registerCustomWorkflows();
|
||||
|
||||
// 2. 列出所有可用工作流
|
||||
await listAvailableWorkflows();
|
||||
|
||||
// 3. 演示各种工作流
|
||||
await demonstrateCanaryDeployment();
|
||||
await demonstrateMultiEnvironmentDeploy();
|
||||
await demonstrateRollbackWorkflow();
|
||||
|
||||
// 4. 演示验证和条件执行
|
||||
await demonstrateWorkflowValidation();
|
||||
await demonstrateConditionalExecution();
|
||||
|
||||
console.log('🎉 所有工作流演示完成!');
|
||||
} catch (error) {
|
||||
console.error('❌ 演示过程中发生错误:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 交互式工作流执行
|
||||
*/
|
||||
async function interactiveWorkflowExecution() {
|
||||
console.log('\n🎮 交互式工作流执行\n');
|
||||
|
||||
const workflowName = process.argv[3];
|
||||
|
||||
if (!workflowName) {
|
||||
console.log('使用方法:');
|
||||
console.log(' npm run workflow-demo [工作流名称]');
|
||||
console.log('\n可用的工作流:');
|
||||
console.log(' - canary-deployment');
|
||||
console.log(' - multi-env-deploy');
|
||||
console.log(' - rollback-workflow');
|
||||
return;
|
||||
}
|
||||
|
||||
// 解析命令行参数
|
||||
const options: Record<string, any> = {};
|
||||
for (let i = 4; i < process.argv.length; i += 2) {
|
||||
const key = process.argv[i]?.replace(/^--/, '');
|
||||
const value = process.argv[i + 1];
|
||||
if (key && value) {
|
||||
options[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`执行工作流: ${workflowName}`);
|
||||
console.log('参数:', options);
|
||||
console.log();
|
||||
|
||||
try {
|
||||
await registerCustomWorkflows();
|
||||
|
||||
const result = await moduleManager.executeWorkflow(workflowName, {
|
||||
args: [],
|
||||
options,
|
||||
});
|
||||
|
||||
console.log('\n📊 工作流执行结果:');
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
} catch (error) {
|
||||
console.error('❌ 工作流执行失败:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// 执行脚本
|
||||
if (require.main === module) {
|
||||
if (process.argv.length > 2 && process.argv[2] === 'interactive') {
|
||||
interactiveWorkflowExecution()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error('❌ 交互式执行失败:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
} else {
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error('❌ 演示脚本执行失败:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user