pnpm-catalog-updates 1.0.3 → 1.1.0
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 +15 -0
- package/dist/index.js +22031 -10684
- package/dist/index.js.map +1 -1
- package/package.json +7 -2
- package/src/cli/__tests__/commandRegistrar.test.ts +248 -0
- package/src/cli/commandRegistrar.ts +785 -0
- package/src/cli/commands/__tests__/aiCommand.test.ts +161 -0
- package/src/cli/commands/__tests__/analyzeCommand.test.ts +283 -0
- package/src/cli/commands/__tests__/checkCommand.test.ts +435 -0
- package/src/cli/commands/__tests__/graphCommand.test.ts +312 -0
- package/src/cli/commands/__tests__/initCommand.test.ts +317 -0
- package/src/cli/commands/__tests__/rollbackCommand.test.ts +400 -0
- package/src/cli/commands/__tests__/securityCommand.test.ts +467 -0
- package/src/cli/commands/__tests__/themeCommand.test.ts +166 -0
- package/src/cli/commands/__tests__/updateCommand.test.ts +720 -0
- package/src/cli/commands/__tests__/workspaceCommand.test.ts +286 -0
- package/src/cli/commands/aiCommand.ts +163 -0
- package/src/cli/commands/analyzeCommand.ts +219 -0
- package/src/cli/commands/checkCommand.ts +91 -98
- package/src/cli/commands/graphCommand.ts +475 -0
- package/src/cli/commands/initCommand.ts +64 -54
- package/src/cli/commands/rollbackCommand.ts +334 -0
- package/src/cli/commands/securityCommand.ts +165 -100
- package/src/cli/commands/themeCommand.ts +148 -0
- package/src/cli/commands/updateCommand.ts +215 -263
- package/src/cli/commands/workspaceCommand.ts +73 -0
- package/src/cli/constants/cliChoices.ts +93 -0
- package/src/cli/formatters/__tests__/__snapshots__/outputFormatter.test.ts.snap +557 -0
- package/src/cli/formatters/__tests__/ciFormatter.test.ts +526 -0
- package/src/cli/formatters/__tests__/outputFormatter.test.ts +448 -0
- package/src/cli/formatters/__tests__/progressBar.test.ts +709 -0
- package/src/cli/formatters/ciFormatter.ts +964 -0
- package/src/cli/formatters/colorUtils.ts +145 -0
- package/src/cli/formatters/outputFormatter.ts +615 -332
- package/src/cli/formatters/progressBar.ts +43 -52
- package/src/cli/formatters/versionFormatter.ts +132 -0
- package/src/cli/handlers/aiAnalysisHandler.ts +205 -0
- package/src/cli/handlers/changelogHandler.ts +113 -0
- package/src/cli/handlers/index.ts +9 -0
- package/src/cli/handlers/installHandler.ts +130 -0
- package/src/cli/index.ts +175 -726
- package/src/cli/interactive/InteractiveOptionsCollector.ts +387 -0
- package/src/cli/interactive/interactivePrompts.ts +189 -83
- package/src/cli/interactive/optionUtils.ts +89 -0
- package/src/cli/themes/colorTheme.ts +43 -16
- package/src/cli/utils/cliOutput.ts +118 -0
- package/src/cli/utils/commandHelpers.ts +249 -0
- package/src/cli/validators/commandValidator.ts +321 -336
- package/src/cli/validators/index.ts +37 -2
- package/src/cli/options/globalOptions.ts +0 -437
- package/src/cli/options/index.ts +0 -5
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Option Choices
|
|
3
|
+
*
|
|
4
|
+
* Centralized definitions for CLI option values.
|
|
5
|
+
* Used by both Commander.js for validation and Command classes for programmatic validation.
|
|
6
|
+
* This ensures consistency across CLI and API usage.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Valid output format options (including CI/CD formats)
|
|
11
|
+
*/
|
|
12
|
+
export const FORMAT_CHOICES = [
|
|
13
|
+
'table',
|
|
14
|
+
'json',
|
|
15
|
+
'yaml',
|
|
16
|
+
'minimal',
|
|
17
|
+
'github',
|
|
18
|
+
'gitlab',
|
|
19
|
+
'junit',
|
|
20
|
+
'sarif',
|
|
21
|
+
] as const
|
|
22
|
+
export type FormatChoice = (typeof FORMAT_CHOICES)[number]
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* CI/CD specific output formats
|
|
26
|
+
*/
|
|
27
|
+
export const CI_FORMAT_CHOICES = ['github', 'gitlab', 'junit', 'sarif'] as const
|
|
28
|
+
export type CIFormatChoice = (typeof CI_FORMAT_CHOICES)[number]
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Check if format is a CI/CD format
|
|
32
|
+
*/
|
|
33
|
+
export function isCIFormatChoice(value: string): value is CIFormatChoice {
|
|
34
|
+
return CI_FORMAT_CHOICES.includes(value as CIFormatChoice)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Valid update target options
|
|
39
|
+
*/
|
|
40
|
+
export const TARGET_CHOICES = ['latest', 'greatest', 'minor', 'patch', 'newest'] as const
|
|
41
|
+
export type TargetChoice = (typeof TARGET_CHOICES)[number]
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Valid AI provider options
|
|
45
|
+
*/
|
|
46
|
+
export const PROVIDER_CHOICES = ['auto', 'claude', 'gemini', 'codex'] as const
|
|
47
|
+
export type ProviderChoice = (typeof PROVIDER_CHOICES)[number]
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Valid analysis type options
|
|
51
|
+
*/
|
|
52
|
+
export const ANALYSIS_TYPE_CHOICES = ['impact', 'security', 'compatibility', 'recommend'] as const
|
|
53
|
+
export type AnalysisTypeChoice = (typeof ANALYSIS_TYPE_CHOICES)[number]
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Valid severity level options
|
|
57
|
+
*/
|
|
58
|
+
export const SEVERITY_CHOICES = ['low', 'moderate', 'high', 'critical'] as const
|
|
59
|
+
export type SeverityChoice = (typeof SEVERITY_CHOICES)[number]
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* All CLI choices grouped for Commander.js registration
|
|
63
|
+
*/
|
|
64
|
+
export const CLI_CHOICES = {
|
|
65
|
+
format: FORMAT_CHOICES,
|
|
66
|
+
target: TARGET_CHOICES,
|
|
67
|
+
provider: PROVIDER_CHOICES,
|
|
68
|
+
analysisType: ANALYSIS_TYPE_CHOICES,
|
|
69
|
+
severity: SEVERITY_CHOICES,
|
|
70
|
+
} as const
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Validation helper functions
|
|
74
|
+
*/
|
|
75
|
+
export function isValidFormat(value: string): value is FormatChoice {
|
|
76
|
+
return FORMAT_CHOICES.includes(value as FormatChoice)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function isValidTarget(value: string): value is TargetChoice {
|
|
80
|
+
return TARGET_CHOICES.includes(value as TargetChoice)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function isValidProvider(value: string): value is ProviderChoice {
|
|
84
|
+
return PROVIDER_CHOICES.includes(value as ProviderChoice)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function isValidAnalysisType(value: string): value is AnalysisTypeChoice {
|
|
88
|
+
return ANALYSIS_TYPE_CHOICES.includes(value as AnalysisTypeChoice)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function isValidSeverity(value: string): value is SeverityChoice {
|
|
92
|
+
return SEVERITY_CHOICES.includes(value as SeverityChoice)
|
|
93
|
+
}
|
|
@@ -0,0 +1,557 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`OutputFormatter > formatOutdatedReport > should format empty outdated report 1`] = `
|
|
4
|
+
"
|
|
5
|
+
format.workspace: test-workspace
|
|
6
|
+
format.path: /path/to/workspace
|
|
7
|
+
|
|
8
|
+
✅ format.allUpToDate"
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
exports[`OutputFormatter > formatOutdatedReport > should format outdated report as json 1`] = `
|
|
12
|
+
"{
|
|
13
|
+
"workspace": {
|
|
14
|
+
"name": "test-workspace",
|
|
15
|
+
"path": "/path/to/workspace"
|
|
16
|
+
},
|
|
17
|
+
"hasUpdates": true,
|
|
18
|
+
"totalOutdated": 3,
|
|
19
|
+
"catalogs": [
|
|
20
|
+
{
|
|
21
|
+
"catalogName": "default",
|
|
22
|
+
"totalDependencies": 10,
|
|
23
|
+
"outdatedCount": 3,
|
|
24
|
+
"outdatedDependencies": [
|
|
25
|
+
{
|
|
26
|
+
"packageName": "lodash",
|
|
27
|
+
"currentVersion": "^4.17.0",
|
|
28
|
+
"latestVersion": "^4.17.21",
|
|
29
|
+
"updateType": "patch",
|
|
30
|
+
"isSecurityUpdate": false,
|
|
31
|
+
"affectedPackages": [
|
|
32
|
+
"app1",
|
|
33
|
+
"app2"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"packageName": "react",
|
|
38
|
+
"currentVersion": "^17.0.0",
|
|
39
|
+
"latestVersion": "^18.2.0",
|
|
40
|
+
"updateType": "major",
|
|
41
|
+
"isSecurityUpdate": false,
|
|
42
|
+
"affectedPackages": [
|
|
43
|
+
"app1"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"packageName": "axios",
|
|
48
|
+
"currentVersion": "^0.21.0",
|
|
49
|
+
"latestVersion": "^1.6.0",
|
|
50
|
+
"updateType": "major",
|
|
51
|
+
"isSecurityUpdate": true,
|
|
52
|
+
"affectedPackages": [
|
|
53
|
+
"app2",
|
|
54
|
+
"lib1"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}"
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
exports[`OutputFormatter > formatOutdatedReport > should format outdated report as minimal 1`] = `
|
|
64
|
+
"lodash ^4.17.0 → ^4.17.21
|
|
65
|
+
react ^17.0.0 → ^18.2.0
|
|
66
|
+
[SEC] axios ^0.21.0 → ^1.6.0"
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
exports[`OutputFormatter > formatOutdatedReport > should format outdated report as table 1`] = `
|
|
70
|
+
"
|
|
71
|
+
format.workspace: test-workspace
|
|
72
|
+
format.path: /path/to/workspace
|
|
73
|
+
|
|
74
|
+
format.foundOutdated
|
|
75
|
+
|
|
76
|
+
format.catalog: default
|
|
77
|
+
┌─────────────────────────┬───────────────┬───────────────┬────────┬────────────────────┐
|
|
78
|
+
│ table.header.package │ table.header… │ table.header… │ table… │ table.header.pack… │
|
|
79
|
+
├─────────────────────────┼───────────────┼───────────────┼────────┼────────────────────┤
|
|
80
|
+
│ lodash │ ^4.17.0 │ ^4.17.21 │ patch │ common.packagesCo… │
|
|
81
|
+
├─────────────────────────┼───────────────┼───────────────┼────────┼────────────────────┤
|
|
82
|
+
│ react │ ^17.0.0 │ ^18.2.0 │ major │ common.packagesCo… │
|
|
83
|
+
├─────────────────────────┼───────────────┼───────────────┼────────┼────────────────────┤
|
|
84
|
+
│ [SEC] axios │ ^0.21.0 │ ^1.6.0 │ major │ common.packagesCo… │
|
|
85
|
+
└─────────────────────────┴───────────────┴───────────────┴────────┴────────────────────┘
|
|
86
|
+
"
|
|
87
|
+
`;
|
|
88
|
+
|
|
89
|
+
exports[`OutputFormatter > formatOutdatedReport > should format outdated report as yaml 1`] = `
|
|
90
|
+
"workspace:
|
|
91
|
+
name: test-workspace
|
|
92
|
+
path: /path/to/workspace
|
|
93
|
+
hasUpdates: true
|
|
94
|
+
totalOutdated: 3
|
|
95
|
+
catalogs:
|
|
96
|
+
- catalogName: default
|
|
97
|
+
totalDependencies: 10
|
|
98
|
+
outdatedCount: 3
|
|
99
|
+
outdatedDependencies:
|
|
100
|
+
- packageName: lodash
|
|
101
|
+
currentVersion: ^4.17.0
|
|
102
|
+
latestVersion: ^4.17.21
|
|
103
|
+
updateType: patch
|
|
104
|
+
isSecurityUpdate: false
|
|
105
|
+
affectedPackages:
|
|
106
|
+
- app1
|
|
107
|
+
- app2
|
|
108
|
+
- packageName: react
|
|
109
|
+
currentVersion: ^17.0.0
|
|
110
|
+
latestVersion: ^18.2.0
|
|
111
|
+
updateType: major
|
|
112
|
+
isSecurityUpdate: false
|
|
113
|
+
affectedPackages:
|
|
114
|
+
- app1
|
|
115
|
+
- packageName: axios
|
|
116
|
+
currentVersion: ^0.21.0
|
|
117
|
+
latestVersion: ^1.6.0
|
|
118
|
+
updateType: major
|
|
119
|
+
isSecurityUpdate: true
|
|
120
|
+
affectedPackages:
|
|
121
|
+
- app2
|
|
122
|
+
- lib1
|
|
123
|
+
"
|
|
124
|
+
`;
|
|
125
|
+
|
|
126
|
+
exports[`OutputFormatter > formatUpdatePlan > should format update plan as json 1`] = `
|
|
127
|
+
"{
|
|
128
|
+
"workspace": {
|
|
129
|
+
"name": "test-workspace",
|
|
130
|
+
"path": "/path/to/workspace"
|
|
131
|
+
},
|
|
132
|
+
"totalUpdates": 2,
|
|
133
|
+
"hasConflicts": false,
|
|
134
|
+
"conflicts": [],
|
|
135
|
+
"updates": [
|
|
136
|
+
{
|
|
137
|
+
"catalogName": "default",
|
|
138
|
+
"packageName": "lodash",
|
|
139
|
+
"currentVersion": "^4.17.0",
|
|
140
|
+
"newVersion": "^4.17.21",
|
|
141
|
+
"updateType": "patch"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"catalogName": "default",
|
|
145
|
+
"packageName": "express",
|
|
146
|
+
"currentVersion": "^4.17.0",
|
|
147
|
+
"newVersion": "^4.18.2",
|
|
148
|
+
"updateType": "minor"
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}"
|
|
152
|
+
`;
|
|
153
|
+
|
|
154
|
+
exports[`OutputFormatter > formatUpdatePlan > should format update plan as minimal 1`] = `
|
|
155
|
+
"lodash ^4.17.0 → ^4.17.21
|
|
156
|
+
express ^4.17.0 → ^4.18.2"
|
|
157
|
+
`;
|
|
158
|
+
|
|
159
|
+
exports[`OutputFormatter > formatUpdatePlan > should format update plan as table 1`] = `
|
|
160
|
+
"
|
|
161
|
+
format.workspace: test-workspace
|
|
162
|
+
format.path: /path/to/workspace
|
|
163
|
+
|
|
164
|
+
format.plannedUpdates
|
|
165
|
+
|
|
166
|
+
┌───────────────┬──────────────────────────────┬───────────────┬───────────────┬────────┐
|
|
167
|
+
│ table.header… │ table.header.package │ table.header… │ table.header… │ table… │
|
|
168
|
+
├───────────────┼──────────────────────────────┼───────────────┼───────────────┼────────┤
|
|
169
|
+
│ default │ lodash │ ^4.17.0 │ ^4.17.21 │ patch │
|
|
170
|
+
├───────────────┼──────────────────────────────┼───────────────┼───────────────┼────────┤
|
|
171
|
+
│ default │ express │ ^4.17.0 │ ^4.18.2 │ minor │
|
|
172
|
+
└───────────────┴──────────────────────────────┴───────────────┴───────────────┴────────┘
|
|
173
|
+
|
|
174
|
+
format.summary:
|
|
175
|
+
• command.check.minorUpdates
|
|
176
|
+
• command.check.patchUpdates"
|
|
177
|
+
`;
|
|
178
|
+
|
|
179
|
+
exports[`OutputFormatter > formatUpdatePlan > should format update plan as yaml 1`] = `
|
|
180
|
+
"workspace:
|
|
181
|
+
name: test-workspace
|
|
182
|
+
path: /path/to/workspace
|
|
183
|
+
totalUpdates: 2
|
|
184
|
+
hasConflicts: false
|
|
185
|
+
conflicts: []
|
|
186
|
+
updates:
|
|
187
|
+
- catalogName: default
|
|
188
|
+
packageName: lodash
|
|
189
|
+
currentVersion: ^4.17.0
|
|
190
|
+
newVersion: ^4.17.21
|
|
191
|
+
updateType: patch
|
|
192
|
+
- catalogName: default
|
|
193
|
+
packageName: express
|
|
194
|
+
currentVersion: ^4.17.0
|
|
195
|
+
newVersion: ^4.18.2
|
|
196
|
+
updateType: minor
|
|
197
|
+
"
|
|
198
|
+
`;
|
|
199
|
+
|
|
200
|
+
exports[`OutputFormatter > formatUpdatePlan > should format update plan with conflicts 1`] = `
|
|
201
|
+
"
|
|
202
|
+
format.workspace: test-workspace
|
|
203
|
+
format.path: /path/to/workspace
|
|
204
|
+
|
|
205
|
+
format.plannedUpdates
|
|
206
|
+
|
|
207
|
+
┌───────────────┬──────────────────────────────┬───────────────┬───────────────┬────────┐
|
|
208
|
+
│ table.header… │ table.header.package │ table.header… │ table.header… │ table… │
|
|
209
|
+
├───────────────┼──────────────────────────────┼───────────────┼───────────────┼────────┤
|
|
210
|
+
│ default │ lodash │ ^4.17.0 │ ^4.17.21 │ patch │
|
|
211
|
+
└───────────────┴──────────────────────────────┴───────────────┴───────────────┴────────┘
|
|
212
|
+
|
|
213
|
+
⚠️ format.versionConflicts:
|
|
214
|
+
|
|
215
|
+
typescript:
|
|
216
|
+
default: 4.9.0 → 5.0.0
|
|
217
|
+
legacy: 4.5.0 → 4.9.0
|
|
218
|
+
format.recommendation: Consider aligning TypeScript versions across catalogs
|
|
219
|
+
|
|
220
|
+
format.summary:
|
|
221
|
+
• command.check.patchUpdates"
|
|
222
|
+
`;
|
|
223
|
+
|
|
224
|
+
exports[`OutputFormatter > formatUpdatePlan > should handle empty update plan 1`] = `
|
|
225
|
+
"
|
|
226
|
+
format.workspace: test-workspace
|
|
227
|
+
format.path: /path/to/workspace
|
|
228
|
+
|
|
229
|
+
✅ format.noUpdatesPlanned"
|
|
230
|
+
`;
|
|
231
|
+
|
|
232
|
+
exports[`OutputFormatter > formatUpdateResult > should format failed update result 1`] = `
|
|
233
|
+
"
|
|
234
|
+
format.workspace: test-workspace
|
|
235
|
+
❌ format.updateFailed
|
|
236
|
+
|
|
237
|
+
❌ format.errorCount:
|
|
238
|
+
!! default:broken-pkg - Network error while fetching version"
|
|
239
|
+
`;
|
|
240
|
+
|
|
241
|
+
exports[`OutputFormatter > formatUpdateResult > should format update result as json 1`] = `
|
|
242
|
+
"{
|
|
243
|
+
"workspace": {
|
|
244
|
+
"name": "test-workspace",
|
|
245
|
+
"path": "/path/to/workspace"
|
|
246
|
+
},
|
|
247
|
+
"success": true,
|
|
248
|
+
"totalUpdated": 2,
|
|
249
|
+
"totalSkipped": 1,
|
|
250
|
+
"totalErrors": 0,
|
|
251
|
+
"updatedDependencies": [
|
|
252
|
+
{
|
|
253
|
+
"catalogName": "default",
|
|
254
|
+
"packageName": "lodash",
|
|
255
|
+
"fromVersion": "^4.17.0",
|
|
256
|
+
"toVersion": "^4.17.21",
|
|
257
|
+
"updateType": "patch"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"catalogName": "default",
|
|
261
|
+
"packageName": "express",
|
|
262
|
+
"fromVersion": "^4.17.0",
|
|
263
|
+
"toVersion": "^4.18.2",
|
|
264
|
+
"updateType": "minor"
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
"skippedDependencies": [
|
|
268
|
+
{
|
|
269
|
+
"catalogName": "default",
|
|
270
|
+
"packageName": "react",
|
|
271
|
+
"reason": "Major version update requires --force flag"
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
"errors": []
|
|
275
|
+
}"
|
|
276
|
+
`;
|
|
277
|
+
|
|
278
|
+
exports[`OutputFormatter > formatUpdateResult > should format update result as minimal 1`] = `
|
|
279
|
+
"format.updatedCount
|
|
280
|
+
lodash ^4.17.0 → ^4.17.21
|
|
281
|
+
express ^4.17.0 → ^4.18.2"
|
|
282
|
+
`;
|
|
283
|
+
|
|
284
|
+
exports[`OutputFormatter > formatUpdateResult > should format update result as table 1`] = `
|
|
285
|
+
"
|
|
286
|
+
format.workspace: test-workspace
|
|
287
|
+
✅ format.updateCompleted
|
|
288
|
+
|
|
289
|
+
format.updatedCount:
|
|
290
|
+
┌───────────────┬─────────────────────────┬───────────────┬───────────────┬────────┐
|
|
291
|
+
│ table.header… │ table.header.package │ table.header… │ table.header… │ table… │
|
|
292
|
+
├───────────────┼─────────────────────────┼───────────────┼───────────────┼────────┤
|
|
293
|
+
│ default │ lodash │ ^4.17.0 │ ^4.17.21 │ patch │
|
|
294
|
+
├───────────────┼─────────────────────────┼───────────────┼───────────────┼────────┤
|
|
295
|
+
│ default │ express │ ^4.17.0 │ ^4.18.2 │ minor │
|
|
296
|
+
└───────────────┴─────────────────────────┴───────────────┴───────────────┴────────┘
|
|
297
|
+
|
|
298
|
+
⚠️ format.skippedDeps (1):
|
|
299
|
+
default:react - Major version update requires --force flag
|
|
300
|
+
"
|
|
301
|
+
`;
|
|
302
|
+
|
|
303
|
+
exports[`OutputFormatter > formatUpdateResult > should format update result as yaml 1`] = `
|
|
304
|
+
"workspace:
|
|
305
|
+
name: test-workspace
|
|
306
|
+
path: /path/to/workspace
|
|
307
|
+
success: true
|
|
308
|
+
totalUpdated: 2
|
|
309
|
+
totalSkipped: 1
|
|
310
|
+
totalErrors: 0
|
|
311
|
+
updatedDependencies:
|
|
312
|
+
- catalogName: default
|
|
313
|
+
packageName: lodash
|
|
314
|
+
fromVersion: ^4.17.0
|
|
315
|
+
toVersion: ^4.17.21
|
|
316
|
+
updateType: patch
|
|
317
|
+
- catalogName: default
|
|
318
|
+
packageName: express
|
|
319
|
+
fromVersion: ^4.17.0
|
|
320
|
+
toVersion: ^4.18.2
|
|
321
|
+
updateType: minor
|
|
322
|
+
skippedDependencies:
|
|
323
|
+
- catalogName: default
|
|
324
|
+
packageName: react
|
|
325
|
+
reason: Major version update requires --force flag
|
|
326
|
+
errors: []
|
|
327
|
+
"
|
|
328
|
+
`;
|
|
329
|
+
|
|
330
|
+
exports[`OutputFormatter > formatValidationReport > should format invalid validation report 1`] = `
|
|
331
|
+
"
|
|
332
|
+
❌ format.workspaceValidation
|
|
333
|
+
format.status: format.invalid
|
|
334
|
+
|
|
335
|
+
format.workspaceInfo:
|
|
336
|
+
format.path: /path/to/workspace
|
|
337
|
+
format.name: test-workspace
|
|
338
|
+
format.packages: 5
|
|
339
|
+
format.catalogs: 2
|
|
340
|
+
|
|
341
|
+
❌ format.errors:
|
|
342
|
+
• Missing required catalog "default"
|
|
343
|
+
• Invalid version range for package "broken-pkg"
|
|
344
|
+
|
|
345
|
+
⚠️ format.warnings:
|
|
346
|
+
• Consider updating deprecated package "old-package"
|
|
347
|
+
|
|
348
|
+
format.recommendations:
|
|
349
|
+
• Fix the errors above before proceeding"
|
|
350
|
+
`;
|
|
351
|
+
|
|
352
|
+
exports[`OutputFormatter > formatValidationReport > should format valid report as json 1`] = `
|
|
353
|
+
"{
|
|
354
|
+
"workspace": {
|
|
355
|
+
"path": "/path/to/workspace",
|
|
356
|
+
"name": "test-workspace",
|
|
357
|
+
"packageCount": 5,
|
|
358
|
+
"catalogCount": 2
|
|
359
|
+
},
|
|
360
|
+
"isValid": true,
|
|
361
|
+
"errors": [],
|
|
362
|
+
"warnings": [
|
|
363
|
+
"Consider updating deprecated package \\"old-package\\""
|
|
364
|
+
],
|
|
365
|
+
"recommendations": [
|
|
366
|
+
"Add catalog entries for commonly used packages",
|
|
367
|
+
"Consider using stricter version ranges"
|
|
368
|
+
]
|
|
369
|
+
}"
|
|
370
|
+
`;
|
|
371
|
+
|
|
372
|
+
exports[`OutputFormatter > formatValidationReport > should format valid report as minimal 1`] = `"format.valid (0 format.errors, 1 format.warnings)"`;
|
|
373
|
+
|
|
374
|
+
exports[`OutputFormatter > formatValidationReport > should format valid report as table 1`] = `
|
|
375
|
+
"
|
|
376
|
+
✅ format.workspaceValidation
|
|
377
|
+
format.status: format.valid
|
|
378
|
+
|
|
379
|
+
format.workspaceInfo:
|
|
380
|
+
format.path: /path/to/workspace
|
|
381
|
+
format.name: test-workspace
|
|
382
|
+
format.packages: 5
|
|
383
|
+
format.catalogs: 2
|
|
384
|
+
|
|
385
|
+
⚠️ format.warnings:
|
|
386
|
+
• Consider updating deprecated package "old-package"
|
|
387
|
+
|
|
388
|
+
format.recommendations:
|
|
389
|
+
• Add catalog entries for commonly used packages
|
|
390
|
+
• Consider using stricter version ranges"
|
|
391
|
+
`;
|
|
392
|
+
|
|
393
|
+
exports[`OutputFormatter > formatValidationReport > should format valid report as yaml 1`] = `
|
|
394
|
+
"workspace:
|
|
395
|
+
path: /path/to/workspace
|
|
396
|
+
name: test-workspace
|
|
397
|
+
packageCount: 5
|
|
398
|
+
catalogCount: 2
|
|
399
|
+
isValid: true
|
|
400
|
+
errors: []
|
|
401
|
+
warnings:
|
|
402
|
+
- Consider updating deprecated package "old-package"
|
|
403
|
+
recommendations:
|
|
404
|
+
- Add catalog entries for commonly used packages
|
|
405
|
+
- Consider using stricter version ranges
|
|
406
|
+
"
|
|
407
|
+
`;
|
|
408
|
+
|
|
409
|
+
exports[`OutputFormatter > formatWorkspaceInfo > should format workspace info as json 1`] = `
|
|
410
|
+
"{
|
|
411
|
+
"name": "test-workspace",
|
|
412
|
+
"path": "/path/to/workspace",
|
|
413
|
+
"packageCount": 5,
|
|
414
|
+
"catalogCount": 2,
|
|
415
|
+
"catalogNames": [
|
|
416
|
+
"default",
|
|
417
|
+
"legacy"
|
|
418
|
+
],
|
|
419
|
+
"isValid": true
|
|
420
|
+
}"
|
|
421
|
+
`;
|
|
422
|
+
|
|
423
|
+
exports[`OutputFormatter > formatWorkspaceInfo > should format workspace info as minimal 1`] = `
|
|
424
|
+
"test-workspace (/path/to/workspace)
|
|
425
|
+
command.workspace.packages: 5, command.workspace.catalogs: 2
|
|
426
|
+
command.workspace.catalogNames: default, legacy"
|
|
427
|
+
`;
|
|
428
|
+
|
|
429
|
+
exports[`OutputFormatter > formatWorkspaceInfo > should format workspace info as table 1`] = `
|
|
430
|
+
"
|
|
431
|
+
╭────────────────────────────────────────────────────────────────────────────╮
|
|
432
|
+
│ WORKSPACE │
|
|
433
|
+
├────────────────────┬───────────────────────────────────────────────────────┤
|
|
434
|
+
│ Name │ test-workspace │
|
|
435
|
+
├────────────────────┼───────────────────────────────────────────────────────┤
|
|
436
|
+
│ Path │ /path/to/workspace │
|
|
437
|
+
├────────────────────┼───────────────────────────────────────────────────────┤
|
|
438
|
+
│ Status │ ✓ Valid │
|
|
439
|
+
├────────────────────┼───────────────────────────────────────────────────────┤
|
|
440
|
+
│ Packages │ 5 │
|
|
441
|
+
├────────────────────┼───────────────────────────────────────────────────────┤
|
|
442
|
+
│ Catalogs │ 2 │
|
|
443
|
+
├────────────────────┼───────────────────────────────────────────────────────┤
|
|
444
|
+
│ Catalog Names │ default, legacy │
|
|
445
|
+
╰────────────────────┴───────────────────────────────────────────────────────╯
|
|
446
|
+
"
|
|
447
|
+
`;
|
|
448
|
+
|
|
449
|
+
exports[`OutputFormatter > formatWorkspaceInfo > should format workspace info as yaml 1`] = `
|
|
450
|
+
"name: test-workspace
|
|
451
|
+
path: /path/to/workspace
|
|
452
|
+
packageCount: 5
|
|
453
|
+
catalogCount: 2
|
|
454
|
+
catalogNames:
|
|
455
|
+
- default
|
|
456
|
+
- legacy
|
|
457
|
+
isValid: true
|
|
458
|
+
"
|
|
459
|
+
`;
|
|
460
|
+
|
|
461
|
+
exports[`OutputFormatter > formatWorkspaceInfo > should format workspace info without catalog names 1`] = `
|
|
462
|
+
"
|
|
463
|
+
╭────────────────────────────────────────────────────────────────────────────╮
|
|
464
|
+
│ WORKSPACE │
|
|
465
|
+
├────────────────────┬───────────────────────────────────────────────────────┤
|
|
466
|
+
│ Name │ test-workspace │
|
|
467
|
+
├────────────────────┼───────────────────────────────────────────────────────┤
|
|
468
|
+
│ Path │ /path/to/workspace │
|
|
469
|
+
├────────────────────┼───────────────────────────────────────────────────────┤
|
|
470
|
+
│ Status │ ✓ Valid │
|
|
471
|
+
├────────────────────┼───────────────────────────────────────────────────────┤
|
|
472
|
+
│ Packages │ 5 │
|
|
473
|
+
├────────────────────┼───────────────────────────────────────────────────────┤
|
|
474
|
+
│ Catalogs │ 2 │
|
|
475
|
+
╰────────────────────┴───────────────────────────────────────────────────────╯
|
|
476
|
+
"
|
|
477
|
+
`;
|
|
478
|
+
|
|
479
|
+
exports[`OutputFormatter > formatWorkspaceStats > should format workspace stats as json 1`] = `
|
|
480
|
+
"{
|
|
481
|
+
"workspace": {
|
|
482
|
+
"name": "test-workspace",
|
|
483
|
+
"path": "/path/to/workspace"
|
|
484
|
+
},
|
|
485
|
+
"packages": {
|
|
486
|
+
"total": 10,
|
|
487
|
+
"withCatalogReferences": 8
|
|
488
|
+
},
|
|
489
|
+
"catalogs": {
|
|
490
|
+
"total": 2,
|
|
491
|
+
"totalEntries": 25
|
|
492
|
+
},
|
|
493
|
+
"dependencies": {
|
|
494
|
+
"total": 50,
|
|
495
|
+
"catalogReferences": 40,
|
|
496
|
+
"byType": {
|
|
497
|
+
"dependencies": 30,
|
|
498
|
+
"devDependencies": 15,
|
|
499
|
+
"peerDependencies": 3,
|
|
500
|
+
"optionalDependencies": 2
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}"
|
|
504
|
+
`;
|
|
505
|
+
|
|
506
|
+
exports[`OutputFormatter > formatWorkspaceStats > should format workspace stats as minimal 1`] = `"format.packages: 10, format.catalogs: 2, stats.totalDependencies: 50"`;
|
|
507
|
+
|
|
508
|
+
exports[`OutputFormatter > formatWorkspaceStats > should format workspace stats as table 1`] = `
|
|
509
|
+
"
|
|
510
|
+
format.workspaceStatistics
|
|
511
|
+
format.workspace: test-workspace
|
|
512
|
+
|
|
513
|
+
┌──────────────────────────────┬──────────┐
|
|
514
|
+
│ table.header.metric │ table.h… │
|
|
515
|
+
├──────────────────────────────┼──────────┤
|
|
516
|
+
│ stats.totalPackages │ 10 │
|
|
517
|
+
├──────────────────────────────┼──────────┤
|
|
518
|
+
│ stats.packagesWithCatalogRe… │ 8 │
|
|
519
|
+
├──────────────────────────────┼──────────┤
|
|
520
|
+
│ stats.totalCatalogs │ 2 │
|
|
521
|
+
├──────────────────────────────┼──────────┤
|
|
522
|
+
│ stats.catalogEntries │ 25 │
|
|
523
|
+
├──────────────────────────────┼──────────┤
|
|
524
|
+
│ stats.totalDependencies │ 50 │
|
|
525
|
+
├──────────────────────────────┼──────────┤
|
|
526
|
+
│ stats.catalogReferences │ 40 │
|
|
527
|
+
├──────────────────────────────┼──────────┤
|
|
528
|
+
│ stats.dependencies │ 30 │
|
|
529
|
+
├──────────────────────────────┼──────────┤
|
|
530
|
+
│ stats.devDependencies │ 15 │
|
|
531
|
+
├──────────────────────────────┼──────────┤
|
|
532
|
+
│ stats.peerDependencies │ 3 │
|
|
533
|
+
├──────────────────────────────┼──────────┤
|
|
534
|
+
│ stats.optionalDependencies │ 2 │
|
|
535
|
+
└──────────────────────────────┴──────────┘"
|
|
536
|
+
`;
|
|
537
|
+
|
|
538
|
+
exports[`OutputFormatter > formatWorkspaceStats > should format workspace stats as yaml 1`] = `
|
|
539
|
+
"workspace:
|
|
540
|
+
name: test-workspace
|
|
541
|
+
path: /path/to/workspace
|
|
542
|
+
packages:
|
|
543
|
+
total: 10
|
|
544
|
+
withCatalogReferences: 8
|
|
545
|
+
catalogs:
|
|
546
|
+
total: 2
|
|
547
|
+
totalEntries: 25
|
|
548
|
+
dependencies:
|
|
549
|
+
total: 50
|
|
550
|
+
catalogReferences: 40
|
|
551
|
+
byType:
|
|
552
|
+
dependencies: 30
|
|
553
|
+
devDependencies: 15
|
|
554
|
+
peerDependencies: 3
|
|
555
|
+
optionalDependencies: 2
|
|
556
|
+
"
|
|
557
|
+
`;
|