pnpm-catalog-updates 0.5.6 → 0.6.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/bin/pcu.js +1 -1
- package/dist/index.js +9559 -32
- package/dist/index.js.map +1 -1
- package/package.json +61 -103
- package/src/cli/commands/checkCommand.ts +227 -0
- package/src/cli/commands/initCommand.ts +394 -0
- package/src/cli/commands/securityCommand.ts +569 -0
- package/src/cli/commands/updateCommand.ts +245 -0
- package/src/cli/formatters/outputFormatter.ts +830 -0
- package/src/cli/formatters/progressBar.ts +700 -0
- package/src/cli/index.ts +565 -0
- package/src/cli/interactive/interactivePrompts.ts +517 -0
- package/src/cli/options/globalOptions.ts +380 -0
- package/src/cli/options/index.ts +5 -0
- package/src/cli/themes/colorTheme.ts +379 -0
- package/src/cli/validators/commandValidator.ts +395 -0
- package/src/cli/validators/index.ts +5 -0
- package/src/index.ts +4 -0
- package/LICENSE +0 -21
- package/README.ja.md +0 -582
- package/README.md +0 -690
- package/README.zh-CN.md +0 -630
- package/dist/application/services/CatalogUpdateService.d.ts +0 -209
- package/dist/application/services/CatalogUpdateService.d.ts.map +0 -1
- package/dist/application/services/CatalogUpdateService.js +0 -836
- package/dist/application/services/CatalogUpdateService.js.map +0 -1
- package/dist/application/services/WorkspaceService.d.ts +0 -139
- package/dist/application/services/WorkspaceService.d.ts.map +0 -1
- package/dist/application/services/WorkspaceService.js +0 -340
- package/dist/application/services/WorkspaceService.js.map +0 -1
- package/dist/cli/commands/CheckCommand.d.ts +0 -40
- package/dist/cli/commands/CheckCommand.d.ts.map +0 -1
- package/dist/cli/commands/CheckCommand.js +0 -177
- package/dist/cli/commands/CheckCommand.js.map +0 -1
- package/dist/cli/commands/InitCommand.d.ts +0 -53
- package/dist/cli/commands/InitCommand.d.ts.map +0 -1
- package/dist/cli/commands/InitCommand.js +0 -338
- package/dist/cli/commands/InitCommand.js.map +0 -1
- package/dist/cli/commands/SecurityCommand.d.ts +0 -113
- package/dist/cli/commands/SecurityCommand.d.ts.map +0 -1
- package/dist/cli/commands/SecurityCommand.js +0 -410
- package/dist/cli/commands/SecurityCommand.js.map +0 -1
- package/dist/cli/commands/UpdateCommand.d.ts +0 -44
- package/dist/cli/commands/UpdateCommand.d.ts.map +0 -1
- package/dist/cli/commands/UpdateCommand.js +0 -189
- package/dist/cli/commands/UpdateCommand.js.map +0 -1
- package/dist/cli/formatters/OutputFormatter.d.ts +0 -116
- package/dist/cli/formatters/OutputFormatter.d.ts.map +0 -1
- package/dist/cli/formatters/OutputFormatter.js +0 -664
- package/dist/cli/formatters/OutputFormatter.js.map +0 -1
- package/dist/cli/formatters/ProgressBar.d.ts +0 -195
- package/dist/cli/formatters/ProgressBar.d.ts.map +0 -1
- package/dist/cli/formatters/ProgressBar.js +0 -622
- package/dist/cli/formatters/ProgressBar.js.map +0 -1
- package/dist/cli/index.d.ts +0 -12
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -492
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/interactive/InteractivePrompts.d.ts +0 -85
- package/dist/cli/interactive/InteractivePrompts.d.ts.map +0 -1
- package/dist/cli/interactive/InteractivePrompts.js +0 -434
- package/dist/cli/interactive/InteractivePrompts.js.map +0 -1
- package/dist/cli/options/GlobalOptions.d.ts +0 -117
- package/dist/cli/options/GlobalOptions.d.ts.map +0 -1
- package/dist/cli/options/GlobalOptions.js +0 -278
- package/dist/cli/options/GlobalOptions.js.map +0 -1
- package/dist/cli/options/index.d.ts +0 -5
- package/dist/cli/options/index.d.ts.map +0 -1
- package/dist/cli/options/index.js +0 -5
- package/dist/cli/options/index.js.map +0 -1
- package/dist/cli/themes/ColorTheme.d.ts +0 -211
- package/dist/cli/themes/ColorTheme.d.ts.map +0 -1
- package/dist/cli/themes/ColorTheme.js +0 -267
- package/dist/cli/themes/ColorTheme.js.map +0 -1
- package/dist/cli/validators/CommandValidator.d.ts +0 -60
- package/dist/cli/validators/CommandValidator.d.ts.map +0 -1
- package/dist/cli/validators/CommandValidator.js +0 -319
- package/dist/cli/validators/CommandValidator.js.map +0 -1
- package/dist/cli/validators/index.d.ts +0 -5
- package/dist/cli/validators/index.d.ts.map +0 -1
- package/dist/cli/validators/index.js +0 -5
- package/dist/cli/validators/index.js.map +0 -1
- package/dist/common/config/Config.d.ts +0 -142
- package/dist/common/config/Config.d.ts.map +0 -1
- package/dist/common/config/Config.js +0 -382
- package/dist/common/config/Config.js.map +0 -1
- package/dist/common/config/ConfigLoader.d.ts +0 -49
- package/dist/common/config/ConfigLoader.d.ts.map +0 -1
- package/dist/common/config/ConfigLoader.js +0 -180
- package/dist/common/config/ConfigLoader.js.map +0 -1
- package/dist/common/config/PackageFilterConfig.d.ts +0 -56
- package/dist/common/config/PackageFilterConfig.d.ts.map +0 -1
- package/dist/common/config/PackageFilterConfig.js +0 -94
- package/dist/common/config/PackageFilterConfig.js.map +0 -1
- package/dist/common/config/index.d.ts +0 -8
- package/dist/common/config/index.d.ts.map +0 -1
- package/dist/common/config/index.js +0 -8
- package/dist/common/config/index.js.map +0 -1
- package/dist/common/error-handling/ErrorTracker.d.ts +0 -48
- package/dist/common/error-handling/ErrorTracker.d.ts.map +0 -1
- package/dist/common/error-handling/ErrorTracker.js +0 -93
- package/dist/common/error-handling/ErrorTracker.js.map +0 -1
- package/dist/common/error-handling/UserFriendlyErrorHandler.d.ts +0 -74
- package/dist/common/error-handling/UserFriendlyErrorHandler.d.ts.map +0 -1
- package/dist/common/error-handling/UserFriendlyErrorHandler.js +0 -703
- package/dist/common/error-handling/UserFriendlyErrorHandler.js.map +0 -1
- package/dist/common/error-handling/index.d.ts +0 -11
- package/dist/common/error-handling/index.d.ts.map +0 -1
- package/dist/common/error-handling/index.js +0 -9
- package/dist/common/error-handling/index.js.map +0 -1
- package/dist/common/logger/Logger.d.ts +0 -110
- package/dist/common/logger/Logger.d.ts.map +0 -1
- package/dist/common/logger/Logger.js +0 -289
- package/dist/common/logger/Logger.js.map +0 -1
- package/dist/common/logger/index.d.ts +0 -6
- package/dist/common/logger/index.d.ts.map +0 -1
- package/dist/common/logger/index.js +0 -6
- package/dist/common/logger/index.js.map +0 -1
- package/dist/common/types/cli.d.ts +0 -265
- package/dist/common/types/cli.d.ts.map +0 -1
- package/dist/common/types/cli.js +0 -5
- package/dist/common/types/cli.js.map +0 -1
- package/dist/common/types/core.d.ts +0 -270
- package/dist/common/types/core.d.ts.map +0 -1
- package/dist/common/types/core.js +0 -32
- package/dist/common/types/core.js.map +0 -1
- package/dist/common/types/index.d.ts +0 -8
- package/dist/common/types/index.d.ts.map +0 -1
- package/dist/common/types/index.js +0 -8
- package/dist/common/types/index.js.map +0 -1
- package/dist/common/utils/VersionChecker.d.ts +0 -54
- package/dist/common/utils/VersionChecker.d.ts.map +0 -1
- package/dist/common/utils/VersionChecker.js +0 -180
- package/dist/common/utils/VersionChecker.js.map +0 -1
- package/dist/common/utils/async.d.ts +0 -74
- package/dist/common/utils/async.d.ts.map +0 -1
- package/dist/common/utils/async.js +0 -228
- package/dist/common/utils/async.js.map +0 -1
- package/dist/common/utils/format.d.ts +0 -32
- package/dist/common/utils/format.d.ts.map +0 -1
- package/dist/common/utils/format.js +0 -121
- package/dist/common/utils/format.js.map +0 -1
- package/dist/common/utils/git.d.ts +0 -44
- package/dist/common/utils/git.d.ts.map +0 -1
- package/dist/common/utils/git.js +0 -147
- package/dist/common/utils/git.js.map +0 -1
- package/dist/common/utils/index.d.ts +0 -12
- package/dist/common/utils/index.d.ts.map +0 -1
- package/dist/common/utils/index.js +0 -12
- package/dist/common/utils/index.js.map +0 -1
- package/dist/common/utils/string.d.ts +0 -56
- package/dist/common/utils/string.d.ts.map +0 -1
- package/dist/common/utils/string.js +0 -134
- package/dist/common/utils/string.js.map +0 -1
- package/dist/common/utils/validation.d.ts +0 -88
- package/dist/common/utils/validation.d.ts.map +0 -1
- package/dist/common/utils/validation.js +0 -308
- package/dist/common/utils/validation.js.map +0 -1
- package/dist/domain/entities/Catalog.d.ts +0 -117
- package/dist/domain/entities/Catalog.d.ts.map +0 -1
- package/dist/domain/entities/Catalog.js +0 -240
- package/dist/domain/entities/Catalog.js.map +0 -1
- package/dist/domain/entities/Package.d.ts +0 -143
- package/dist/domain/entities/Package.d.ts.map +0 -1
- package/dist/domain/entities/Package.js +0 -272
- package/dist/domain/entities/Package.js.map +0 -1
- package/dist/domain/entities/Workspace.d.ts +0 -95
- package/dist/domain/entities/Workspace.d.ts.map +0 -1
- package/dist/domain/entities/Workspace.js +0 -173
- package/dist/domain/entities/Workspace.js.map +0 -1
- package/dist/domain/repositories/WorkspaceRepository.d.ts +0 -41
- package/dist/domain/repositories/WorkspaceRepository.d.ts.map +0 -1
- package/dist/domain/repositories/WorkspaceRepository.js +0 -8
- package/dist/domain/repositories/WorkspaceRepository.js.map +0 -1
- package/dist/domain/value-objects/CatalogCollection.d.ts +0 -106
- package/dist/domain/value-objects/CatalogCollection.d.ts.map +0 -1
- package/dist/domain/value-objects/CatalogCollection.js +0 -230
- package/dist/domain/value-objects/CatalogCollection.js.map +0 -1
- package/dist/domain/value-objects/PackageCollection.d.ts +0 -122
- package/dist/domain/value-objects/PackageCollection.d.ts.map +0 -1
- package/dist/domain/value-objects/PackageCollection.js +0 -263
- package/dist/domain/value-objects/PackageCollection.js.map +0 -1
- package/dist/domain/value-objects/Version.d.ts +0 -141
- package/dist/domain/value-objects/Version.d.ts.map +0 -1
- package/dist/domain/value-objects/Version.js +0 -268
- package/dist/domain/value-objects/Version.js.map +0 -1
- package/dist/domain/value-objects/WorkspaceConfig.d.ts +0 -144
- package/dist/domain/value-objects/WorkspaceConfig.d.ts.map +0 -1
- package/dist/domain/value-objects/WorkspaceConfig.js +0 -357
- package/dist/domain/value-objects/WorkspaceConfig.js.map +0 -1
- package/dist/domain/value-objects/WorkspaceId.d.ts +0 -51
- package/dist/domain/value-objects/WorkspaceId.d.ts.map +0 -1
- package/dist/domain/value-objects/WorkspaceId.js +0 -104
- package/dist/domain/value-objects/WorkspaceId.js.map +0 -1
- package/dist/domain/value-objects/WorkspacePath.d.ts +0 -75
- package/dist/domain/value-objects/WorkspacePath.d.ts.map +0 -1
- package/dist/domain/value-objects/WorkspacePath.js +0 -128
- package/dist/domain/value-objects/WorkspacePath.js.map +0 -1
- package/dist/index.d.ts +0 -25
- package/dist/index.d.ts.map +0 -1
- package/dist/infrastructure/cache/Cache.d.ts +0 -161
- package/dist/infrastructure/cache/Cache.d.ts.map +0 -1
- package/dist/infrastructure/cache/Cache.js +0 -398
- package/dist/infrastructure/cache/Cache.js.map +0 -1
- package/dist/infrastructure/cache/index.d.ts +0 -6
- package/dist/infrastructure/cache/index.d.ts.map +0 -1
- package/dist/infrastructure/cache/index.js +0 -6
- package/dist/infrastructure/cache/index.js.map +0 -1
- package/dist/infrastructure/external-services/NpmRegistryService.d.ts +0 -145
- package/dist/infrastructure/external-services/NpmRegistryService.d.ts.map +0 -1
- package/dist/infrastructure/external-services/NpmRegistryService.js +0 -466
- package/dist/infrastructure/external-services/NpmRegistryService.js.map +0 -1
- package/dist/infrastructure/file-system/FileSystemService.d.ts +0 -120
- package/dist/infrastructure/file-system/FileSystemService.d.ts.map +0 -1
- package/dist/infrastructure/file-system/FileSystemService.js +0 -663
- package/dist/infrastructure/file-system/FileSystemService.js.map +0 -1
- package/dist/infrastructure/repositories/FileWorkspaceRepository.d.ts +0 -57
- package/dist/infrastructure/repositories/FileWorkspaceRepository.d.ts.map +0 -1
- package/dist/infrastructure/repositories/FileWorkspaceRepository.js +0 -179
- package/dist/infrastructure/repositories/FileWorkspaceRepository.js.map +0 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update Command
|
|
3
|
+
*
|
|
4
|
+
* CLI command to update catalog dependencies.
|
|
5
|
+
* Supports interactive mode, dry-run, and various update strategies.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { CatalogUpdateService, UpdateOptions, UpdatePlan, UpdateTarget } from '@pcu/core';
|
|
9
|
+
import { OutputFormat, OutputFormatter } from '../formatters/outputFormatter.js';
|
|
10
|
+
import { ProgressBar } from '../formatters/progressBar.js';
|
|
11
|
+
import { InteractivePrompts } from '../interactive/interactivePrompts.js';
|
|
12
|
+
import { StyledText, ThemeManager } from '../themes/colorTheme.js';
|
|
13
|
+
import { ConfigLoader } from '@pcu/utils';
|
|
14
|
+
|
|
15
|
+
export interface UpdateCommandOptions {
|
|
16
|
+
workspace?: string;
|
|
17
|
+
catalog?: string;
|
|
18
|
+
format?: OutputFormat;
|
|
19
|
+
target?: UpdateTarget;
|
|
20
|
+
interactive?: boolean;
|
|
21
|
+
dryRun?: boolean;
|
|
22
|
+
force?: boolean;
|
|
23
|
+
prerelease?: boolean;
|
|
24
|
+
include?: string[];
|
|
25
|
+
exclude?: string[];
|
|
26
|
+
createBackup?: boolean;
|
|
27
|
+
verbose?: boolean;
|
|
28
|
+
color?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class UpdateCommand {
|
|
32
|
+
private readonly updateService: CatalogUpdateService;
|
|
33
|
+
|
|
34
|
+
constructor(updateService: CatalogUpdateService) {
|
|
35
|
+
this.updateService = updateService;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Execute the update command
|
|
40
|
+
*/
|
|
41
|
+
async execute(options: UpdateCommandOptions = {}): Promise<void> {
|
|
42
|
+
let progressBar: ProgressBar | undefined;
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
// Initialize theme
|
|
46
|
+
ThemeManager.setTheme('default');
|
|
47
|
+
|
|
48
|
+
// Create progress bar for the update process
|
|
49
|
+
progressBar = new ProgressBar({
|
|
50
|
+
text: '正在规划更新...',
|
|
51
|
+
total: 4, // 4 main steps
|
|
52
|
+
});
|
|
53
|
+
progressBar.start('正在加载工作区配置...');
|
|
54
|
+
|
|
55
|
+
// Load configuration file first
|
|
56
|
+
const config = ConfigLoader.loadConfig(options.workspace || process.cwd());
|
|
57
|
+
|
|
58
|
+
// Use format from CLI options first, then config file, then default
|
|
59
|
+
const effectiveFormat = options.format || config.defaults?.format || 'table';
|
|
60
|
+
|
|
61
|
+
// Create output formatter with effective format
|
|
62
|
+
const formatter = new OutputFormatter(
|
|
63
|
+
effectiveFormat as OutputFormat,
|
|
64
|
+
options.color !== false
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
// Merge CLI options with configuration file settings
|
|
68
|
+
const updateOptions: UpdateOptions = {
|
|
69
|
+
workspacePath: options.workspace,
|
|
70
|
+
catalogName: options.catalog,
|
|
71
|
+
target: options.target || config.defaults?.target,
|
|
72
|
+
includePrerelease: options.prerelease ?? config.defaults?.includePrerelease ?? false,
|
|
73
|
+
// CLI include/exclude options take priority over config file
|
|
74
|
+
include: options.include?.length ? options.include : config.include,
|
|
75
|
+
exclude: options.exclude?.length ? options.exclude : config.exclude,
|
|
76
|
+
interactive: options.interactive ?? config.defaults?.interactive ?? false,
|
|
77
|
+
dryRun: options.dryRun ?? config.defaults?.dryRun ?? false,
|
|
78
|
+
force: options.force ?? false,
|
|
79
|
+
createBackup: options.createBackup ?? config.defaults?.createBackup ?? false,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// Step 1: Planning updates
|
|
83
|
+
progressBar.update('正在检查包版本...', 1, 4);
|
|
84
|
+
const plan = await this.updateService.planUpdates(updateOptions);
|
|
85
|
+
|
|
86
|
+
// Step 2: Check if any updates found
|
|
87
|
+
progressBar.update('正在分析更新...', 2, 4);
|
|
88
|
+
|
|
89
|
+
if (!plan.updates.length) {
|
|
90
|
+
progressBar.succeed('所有依赖包都是最新的');
|
|
91
|
+
console.log(StyledText.iconSuccess('All dependencies are up to date!'));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
console.log(
|
|
96
|
+
StyledText.iconPackage(
|
|
97
|
+
`Found ${plan.totalUpdates} update${plan.totalUpdates === 1 ? '' : 's'} available`
|
|
98
|
+
)
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
// Interactive selection if enabled
|
|
102
|
+
let finalPlan = plan;
|
|
103
|
+
if (options.interactive) {
|
|
104
|
+
finalPlan = await this.interactiveSelection(plan);
|
|
105
|
+
if (!finalPlan.updates.length) {
|
|
106
|
+
progressBar.warn('未选择任何更新');
|
|
107
|
+
console.log(StyledText.iconWarning('No updates selected'));
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Step 3: Apply updates
|
|
113
|
+
progressBar.update('正在准备应用更新...', 3, 4);
|
|
114
|
+
|
|
115
|
+
if (!options.dryRun) {
|
|
116
|
+
// Replace the progress bar with one for applying updates
|
|
117
|
+
progressBar.stop();
|
|
118
|
+
progressBar = new ProgressBar({
|
|
119
|
+
text: 'Applying updates...',
|
|
120
|
+
total: finalPlan.updates.length,
|
|
121
|
+
});
|
|
122
|
+
progressBar.start('正在应用更新...');
|
|
123
|
+
|
|
124
|
+
const result = await this.updateService.executeUpdates(finalPlan, updateOptions);
|
|
125
|
+
progressBar.succeed(`Applied ${finalPlan.updates.length} updates`);
|
|
126
|
+
|
|
127
|
+
console.log(formatter.formatUpdateResult(result));
|
|
128
|
+
} else {
|
|
129
|
+
progressBar.update('正在生成预览...', 4, 4);
|
|
130
|
+
progressBar.succeed('更新预览完成');
|
|
131
|
+
console.log(StyledText.iconInfo('Dry run - no changes made'));
|
|
132
|
+
console.log(JSON.stringify(finalPlan, null, 2));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
console.log(StyledText.iconComplete('Update process completed!'));
|
|
136
|
+
} catch (error) {
|
|
137
|
+
if (progressBar) {
|
|
138
|
+
progressBar.fail('Operation failed');
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (error instanceof Error) {
|
|
142
|
+
console.error(StyledText.iconError(`Error: ${error.message}`));
|
|
143
|
+
} else {
|
|
144
|
+
console.error(StyledText.iconError('Unknown error occurred'));
|
|
145
|
+
}
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Interactive update selection
|
|
152
|
+
*/
|
|
153
|
+
private async interactiveSelection(plan: UpdatePlan): Promise<UpdatePlan> {
|
|
154
|
+
const interactivePrompts = new InteractivePrompts();
|
|
155
|
+
|
|
156
|
+
// Transform PlannedUpdate to the format expected by InteractivePrompts
|
|
157
|
+
const packages = plan.updates.map((update) => ({
|
|
158
|
+
name: update.packageName,
|
|
159
|
+
current: update.currentVersion,
|
|
160
|
+
latest: update.newVersion,
|
|
161
|
+
type: update.updateType,
|
|
162
|
+
}));
|
|
163
|
+
|
|
164
|
+
const selectedPackageNames = await interactivePrompts.selectPackages(packages);
|
|
165
|
+
|
|
166
|
+
// Filter the plan to only include selected packages
|
|
167
|
+
const selectedUpdates = plan.updates.filter((update) =>
|
|
168
|
+
selectedPackageNames.includes(update.packageName)
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
...plan,
|
|
173
|
+
updates: selectedUpdates,
|
|
174
|
+
totalUpdates: selectedUpdates.length,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Validate command options
|
|
180
|
+
*/
|
|
181
|
+
static validateOptions(options: UpdateCommandOptions): string[] {
|
|
182
|
+
const errors: string[] = [];
|
|
183
|
+
|
|
184
|
+
// Validate format
|
|
185
|
+
if (options.format && !['table', 'json', 'yaml', 'minimal'].includes(options.format)) {
|
|
186
|
+
errors.push('Invalid format. Must be one of: table, json, yaml, minimal');
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Validate target
|
|
190
|
+
if (
|
|
191
|
+
options.target &&
|
|
192
|
+
!['latest', 'greatest', 'minor', 'patch', 'newest'].includes(options.target)
|
|
193
|
+
) {
|
|
194
|
+
errors.push('Invalid target. Must be one of: latest, greatest, minor, patch, newest');
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Interactive and dry-run conflict
|
|
198
|
+
if (options.interactive && options.dryRun) {
|
|
199
|
+
errors.push('Cannot use --interactive with --dry-run');
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return errors;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Get command help text
|
|
207
|
+
*/
|
|
208
|
+
static getHelpText(): string {
|
|
209
|
+
return `
|
|
210
|
+
Update catalog dependencies
|
|
211
|
+
|
|
212
|
+
Usage:
|
|
213
|
+
pcu update [options]
|
|
214
|
+
|
|
215
|
+
Options:
|
|
216
|
+
--workspace <path> Workspace directory (default: current directory)
|
|
217
|
+
--catalog <name> Update specific catalog only
|
|
218
|
+
--format <type> Output format: table, json, yaml, minimal (default: table)
|
|
219
|
+
--target <type> Update target: latest, greatest, minor, patch, newest (default: latest)
|
|
220
|
+
-i, --interactive Interactive mode to choose updates
|
|
221
|
+
-d, --dry-run Preview changes without writing files
|
|
222
|
+
--force Force updates even if conflicts exist
|
|
223
|
+
--prerelease Include prerelease versions
|
|
224
|
+
--include <pattern> Include packages matching pattern (can be used multiple times)
|
|
225
|
+
--exclude <pattern> Exclude packages matching pattern (can be used multiple times)
|
|
226
|
+
--create-backup Create backup files before updating
|
|
227
|
+
--verbose Show detailed information
|
|
228
|
+
--no-color Disable colored output
|
|
229
|
+
|
|
230
|
+
Examples:
|
|
231
|
+
pcu update # Update all catalogs
|
|
232
|
+
pcu update --interactive # Interactive update selection
|
|
233
|
+
pcu update --dry-run # Preview updates without applying
|
|
234
|
+
pcu update --catalog react17 # Update specific catalog
|
|
235
|
+
pcu update --target minor # Update to latest minor versions only
|
|
236
|
+
pcu update --force # Force updates despite conflicts
|
|
237
|
+
pcu update --include "react*" # Update only React packages
|
|
238
|
+
|
|
239
|
+
Exit Codes:
|
|
240
|
+
0 Updates completed successfully
|
|
241
|
+
1 Updates failed or were cancelled
|
|
242
|
+
2 Error occurred
|
|
243
|
+
`;
|
|
244
|
+
}
|
|
245
|
+
}
|