pcu 0.2.6

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.
Files changed (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +478 -0
  3. package/bin/pcu.js +15 -0
  4. package/dist/application/services/CatalogUpdateService.d.ts +190 -0
  5. package/dist/application/services/CatalogUpdateService.d.ts.map +1 -0
  6. package/dist/application/services/CatalogUpdateService.js +521 -0
  7. package/dist/application/services/CatalogUpdateService.js.map +1 -0
  8. package/dist/application/services/WorkspaceService.d.ts +139 -0
  9. package/dist/application/services/WorkspaceService.d.ts.map +1 -0
  10. package/dist/application/services/WorkspaceService.js +340 -0
  11. package/dist/application/services/WorkspaceService.js.map +1 -0
  12. package/dist/cli/commands/CheckCommand.d.ts +41 -0
  13. package/dist/cli/commands/CheckCommand.d.ts.map +1 -0
  14. package/dist/cli/commands/CheckCommand.js +168 -0
  15. package/dist/cli/commands/CheckCommand.js.map +1 -0
  16. package/dist/cli/commands/UpdateCommand.d.ts +69 -0
  17. package/dist/cli/commands/UpdateCommand.d.ts.map +1 -0
  18. package/dist/cli/commands/UpdateCommand.js +361 -0
  19. package/dist/cli/commands/UpdateCommand.js.map +1 -0
  20. package/dist/cli/formatters/OutputFormatter.d.ts +99 -0
  21. package/dist/cli/formatters/OutputFormatter.d.ts.map +1 -0
  22. package/dist/cli/formatters/OutputFormatter.js +551 -0
  23. package/dist/cli/formatters/OutputFormatter.js.map +1 -0
  24. package/dist/cli/index.d.ts +12 -0
  25. package/dist/cli/index.d.ts.map +1 -0
  26. package/dist/cli/index.js +271 -0
  27. package/dist/cli/index.js.map +1 -0
  28. package/dist/cli/options/GlobalOptions.d.ts +117 -0
  29. package/dist/cli/options/GlobalOptions.d.ts.map +1 -0
  30. package/dist/cli/options/GlobalOptions.js +278 -0
  31. package/dist/cli/options/GlobalOptions.js.map +1 -0
  32. package/dist/cli/options/index.d.ts +5 -0
  33. package/dist/cli/options/index.d.ts.map +1 -0
  34. package/dist/cli/options/index.js +5 -0
  35. package/dist/cli/options/index.js.map +1 -0
  36. package/dist/cli/validators/CommandValidator.d.ts +60 -0
  37. package/dist/cli/validators/CommandValidator.d.ts.map +1 -0
  38. package/dist/cli/validators/CommandValidator.js +319 -0
  39. package/dist/cli/validators/CommandValidator.js.map +1 -0
  40. package/dist/cli/validators/index.d.ts +5 -0
  41. package/dist/cli/validators/index.d.ts.map +1 -0
  42. package/dist/cli/validators/index.js +5 -0
  43. package/dist/cli/validators/index.js.map +1 -0
  44. package/dist/common/config/Config.d.ts +142 -0
  45. package/dist/common/config/Config.d.ts.map +1 -0
  46. package/dist/common/config/Config.js +355 -0
  47. package/dist/common/config/Config.js.map +1 -0
  48. package/dist/common/config/index.d.ts +6 -0
  49. package/dist/common/config/index.d.ts.map +1 -0
  50. package/dist/common/config/index.js +6 -0
  51. package/dist/common/config/index.js.map +1 -0
  52. package/dist/common/logger/Logger.d.ts +110 -0
  53. package/dist/common/logger/Logger.d.ts.map +1 -0
  54. package/dist/common/logger/Logger.js +289 -0
  55. package/dist/common/logger/Logger.js.map +1 -0
  56. package/dist/common/logger/index.d.ts +6 -0
  57. package/dist/common/logger/index.d.ts.map +1 -0
  58. package/dist/common/logger/index.js +6 -0
  59. package/dist/common/logger/index.js.map +1 -0
  60. package/dist/common/types/cli.d.ts +265 -0
  61. package/dist/common/types/cli.d.ts.map +1 -0
  62. package/dist/common/types/cli.js +5 -0
  63. package/dist/common/types/cli.js.map +1 -0
  64. package/dist/common/types/core.d.ts +270 -0
  65. package/dist/common/types/core.d.ts.map +1 -0
  66. package/dist/common/types/core.js +32 -0
  67. package/dist/common/types/core.js.map +1 -0
  68. package/dist/common/types/index.d.ts +8 -0
  69. package/dist/common/types/index.d.ts.map +1 -0
  70. package/dist/common/types/index.js +8 -0
  71. package/dist/common/types/index.js.map +1 -0
  72. package/dist/common/utils/async.d.ts +74 -0
  73. package/dist/common/utils/async.d.ts.map +1 -0
  74. package/dist/common/utils/async.js +228 -0
  75. package/dist/common/utils/async.js.map +1 -0
  76. package/dist/common/utils/format.d.ts +32 -0
  77. package/dist/common/utils/format.d.ts.map +1 -0
  78. package/dist/common/utils/format.js +121 -0
  79. package/dist/common/utils/format.js.map +1 -0
  80. package/dist/common/utils/git.d.ts +44 -0
  81. package/dist/common/utils/git.d.ts.map +1 -0
  82. package/dist/common/utils/git.js +147 -0
  83. package/dist/common/utils/git.js.map +1 -0
  84. package/dist/common/utils/index.d.ts +11 -0
  85. package/dist/common/utils/index.d.ts.map +1 -0
  86. package/dist/common/utils/index.js +11 -0
  87. package/dist/common/utils/index.js.map +1 -0
  88. package/dist/common/utils/string.d.ts +56 -0
  89. package/dist/common/utils/string.d.ts.map +1 -0
  90. package/dist/common/utils/string.js +134 -0
  91. package/dist/common/utils/string.js.map +1 -0
  92. package/dist/common/utils/validation.d.ts +88 -0
  93. package/dist/common/utils/validation.d.ts.map +1 -0
  94. package/dist/common/utils/validation.js +281 -0
  95. package/dist/common/utils/validation.js.map +1 -0
  96. package/dist/domain/entities/Catalog.d.ts +117 -0
  97. package/dist/domain/entities/Catalog.d.ts.map +1 -0
  98. package/dist/domain/entities/Catalog.js +240 -0
  99. package/dist/domain/entities/Catalog.js.map +1 -0
  100. package/dist/domain/entities/Package.d.ts +143 -0
  101. package/dist/domain/entities/Package.d.ts.map +1 -0
  102. package/dist/domain/entities/Package.js +272 -0
  103. package/dist/domain/entities/Package.js.map +1 -0
  104. package/dist/domain/entities/Workspace.d.ts +95 -0
  105. package/dist/domain/entities/Workspace.d.ts.map +1 -0
  106. package/dist/domain/entities/Workspace.js +173 -0
  107. package/dist/domain/entities/Workspace.js.map +1 -0
  108. package/dist/domain/repositories/WorkspaceRepository.d.ts +41 -0
  109. package/dist/domain/repositories/WorkspaceRepository.d.ts.map +1 -0
  110. package/dist/domain/repositories/WorkspaceRepository.js +8 -0
  111. package/dist/domain/repositories/WorkspaceRepository.js.map +1 -0
  112. package/dist/domain/value-objects/CatalogCollection.d.ts +106 -0
  113. package/dist/domain/value-objects/CatalogCollection.d.ts.map +1 -0
  114. package/dist/domain/value-objects/CatalogCollection.js +230 -0
  115. package/dist/domain/value-objects/CatalogCollection.js.map +1 -0
  116. package/dist/domain/value-objects/PackageCollection.d.ts +122 -0
  117. package/dist/domain/value-objects/PackageCollection.d.ts.map +1 -0
  118. package/dist/domain/value-objects/PackageCollection.js +263 -0
  119. package/dist/domain/value-objects/PackageCollection.js.map +1 -0
  120. package/dist/domain/value-objects/Version.d.ts +141 -0
  121. package/dist/domain/value-objects/Version.d.ts.map +1 -0
  122. package/dist/domain/value-objects/Version.js +268 -0
  123. package/dist/domain/value-objects/Version.js.map +1 -0
  124. package/dist/domain/value-objects/WorkspaceConfig.d.ts +144 -0
  125. package/dist/domain/value-objects/WorkspaceConfig.d.ts.map +1 -0
  126. package/dist/domain/value-objects/WorkspaceConfig.js +357 -0
  127. package/dist/domain/value-objects/WorkspaceConfig.js.map +1 -0
  128. package/dist/domain/value-objects/WorkspaceId.d.ts +51 -0
  129. package/dist/domain/value-objects/WorkspaceId.d.ts.map +1 -0
  130. package/dist/domain/value-objects/WorkspaceId.js +104 -0
  131. package/dist/domain/value-objects/WorkspaceId.js.map +1 -0
  132. package/dist/domain/value-objects/WorkspacePath.d.ts +75 -0
  133. package/dist/domain/value-objects/WorkspacePath.d.ts.map +1 -0
  134. package/dist/domain/value-objects/WorkspacePath.js +128 -0
  135. package/dist/domain/value-objects/WorkspacePath.js.map +1 -0
  136. package/dist/infrastructure/cache/Cache.d.ts +161 -0
  137. package/dist/infrastructure/cache/Cache.d.ts.map +1 -0
  138. package/dist/infrastructure/cache/Cache.js +398 -0
  139. package/dist/infrastructure/cache/Cache.js.map +1 -0
  140. package/dist/infrastructure/cache/index.d.ts +6 -0
  141. package/dist/infrastructure/cache/index.d.ts.map +1 -0
  142. package/dist/infrastructure/cache/index.js +6 -0
  143. package/dist/infrastructure/cache/index.js.map +1 -0
  144. package/dist/infrastructure/external-services/NpmRegistryService.d.ts +106 -0
  145. package/dist/infrastructure/external-services/NpmRegistryService.d.ts.map +1 -0
  146. package/dist/infrastructure/external-services/NpmRegistryService.js +305 -0
  147. package/dist/infrastructure/external-services/NpmRegistryService.js.map +1 -0
  148. package/dist/infrastructure/file-system/FileSystemService.d.ts +120 -0
  149. package/dist/infrastructure/file-system/FileSystemService.d.ts.map +1 -0
  150. package/dist/infrastructure/file-system/FileSystemService.js +663 -0
  151. package/dist/infrastructure/file-system/FileSystemService.js.map +1 -0
  152. package/dist/infrastructure/repositories/FileWorkspaceRepository.d.ts +57 -0
  153. package/dist/infrastructure/repositories/FileWorkspaceRepository.d.ts.map +1 -0
  154. package/dist/infrastructure/repositories/FileWorkspaceRepository.js +179 -0
  155. package/dist/infrastructure/repositories/FileWorkspaceRepository.js.map +1 -0
  156. package/package.json +127 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 pnpm-catalog-updates
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,478 @@
1
+ # pnpm-catalog-updates
2
+
3
+ A powerful CLI tool to check and update pnpm workspace catalog dependencies,
4
+ inspired by
5
+ [npm-check-updates](https://github.com/raineorshine/npm-check-updates).
6
+
7
+ [![CI](https://github.com/houko/pnpm-catalog-updates/workflows/CI/badge.svg)](https://github.com/houko/pnpm-catalog-updater/actions)
8
+ [![npm version](https://badge.fury.io/js/pnpm-catalog-updates.svg)](https://badge.fury.io/js/pnpm-catalog-updates)
9
+ [![Coverage Status](https://coveralls.io/repos/github/houko/pnpm-catalog-updates/badge.svg?branch=main)](https://coveralls.io/github/houko/pnpm-catalog-updates?branch=main)
10
+
11
+ ## ✨ Features
12
+
13
+ - 🔍 **Smart Detection**: Automatically discovers pnpm workspaces and catalog
14
+ configurations
15
+ - 🎯 **Catalog Focused**: Specialized for pnpm catalog dependency management
16
+ - 🚀 **Interactive Mode**: Choose which dependencies to update with an intuitive
17
+ interface
18
+ - 📊 **Impact Analysis**: Understand which packages will be affected by catalog
19
+ changes
20
+ - 🔒 **Safe Updates**: Dry-run mode and backup options for safe dependency
21
+ updates
22
+ - ⚡ **High Performance**: Parallel API queries and intelligent caching
23
+ - 🛡️ **Security Aware**: Built-in security vulnerability scanning
24
+ - 🔧 **Configurable**: Flexible configuration options and update strategies
25
+
26
+ ## 🚀 Quick Start
27
+
28
+ ### Installation
29
+
30
+ ```bash
31
+ # Global installation
32
+ npm install -g pnpm-catalog-updates
33
+
34
+ # Or use with npx
35
+ npx pnpm-catalog-updates
36
+
37
+ # Or use the short alias
38
+ pcu
39
+ ```
40
+
41
+ ### Basic Usage
42
+
43
+ ```bash
44
+ # Quick check for updates
45
+ pcu -c
46
+
47
+ # Quick update (interactive)
48
+ pcu -u -i
49
+
50
+ # Quick update (dry run)
51
+ pcu -u -d
52
+
53
+ # Get workspace info
54
+ pcu -s
55
+ ```
56
+
57
+ ### Common Commands
58
+
59
+ | Command | Description | Example |
60
+ | -------- | ------------------- | ------------------------- |
61
+ | `pcu -c` | Check for updates | `pcu -c --catalog node18` |
62
+ | `pcu -u` | Update dependencies | `pcu -u -i -b` |
63
+ | `pcu -a` | Analyze impact | `pcu -a default react` |
64
+ | `pcu -s` | Workspace info | `pcu -s --validate` |
65
+ | `pcu -h` | Show help | `pcu -h update` |
66
+
67
+ ## 📖 Complete Usage Guide
68
+
69
+ ### All Commands & Shortcuts
70
+
71
+ | Full Command | Shorthand | Description |
72
+ | --------------- | --------- | ----------------------------------------- |
73
+ | `pcu check` | `pcu -c` | Check for outdated catalog dependencies |
74
+ | `pcu update` | `pcu -u` | Update catalog dependencies |
75
+ | `pcu analyze` | `pcu -a` | Analyze impact of dependency updates |
76
+ | `pcu workspace` | `pcu -s` | Show workspace information and validation |
77
+ | `pcu help` | `pcu -h` | Display help information |
78
+
79
+ ### Commands
80
+
81
+ #### `pcu check` / `pcu -c` / `pcu chk`
82
+
83
+ Check for outdated dependencies in your pnpm workspace catalogs.
84
+
85
+ ```bash
86
+ pcu check [options]
87
+ pcu -c [options]
88
+ pcu chk [options]
89
+
90
+ Options:
91
+ --catalog <name> Check specific catalog only
92
+ -f, --format <type> Output format: table, json, yaml, minimal (default: table)
93
+ - table: Rich table format with colors and details
94
+ - minimal: Simple npm-check-updates style (package → version)
95
+ - json: JSON output for programmatic use
96
+ - yaml: YAML output for configuration files
97
+ -t, --target <type> Update target: latest, greatest, minor, patch, newest (default: latest)
98
+ --prerelease Include prerelease versions
99
+ --include <pattern> Include packages matching pattern
100
+ --exclude <pattern> Exclude packages matching pattern
101
+ -w, --workspace <path> Workspace directory (default: current directory)
102
+ -v, --verbose Show detailed information
103
+ ```
104
+
105
+ #### `pcu update` / `pcu -u`
106
+
107
+ Update catalog dependencies to newer versions.
108
+
109
+ ```bash
110
+ pcu update [options]
111
+ pcu -u [options]
112
+ pcu u [options]
113
+
114
+ Options:
115
+ -i, --interactive Interactive mode to choose updates
116
+ -d, --dry-run Preview changes without writing files
117
+ -t, --target <type> Update target: latest, greatest, minor, patch, newest (default: latest)
118
+ --catalog <name> Update specific catalog only
119
+ --include <pattern> Include packages matching pattern
120
+ --exclude <pattern> Exclude packages matching pattern
121
+ --force Force updates even if risky
122
+ --prerelease Include prerelease versions
123
+ -b, --create-backup Create backup files before updating
124
+ -f, --format <type> Output format: table, json, yaml, minimal (default: table)
125
+ - table: Rich table format with colors and details
126
+ - minimal: Simple npm-check-updates style (package → version)
127
+ - json: JSON output for programmatic use
128
+ - yaml: YAML output for configuration files
129
+ -w, --workspace <path> Workspace directory (default: current directory)
130
+ -v, --verbose Show detailed information
131
+ ```
132
+
133
+ #### `pcu analyze` / `pcu -a`
134
+
135
+ Analyze the impact of updating a specific dependency.
136
+
137
+ ```bash
138
+ pcu analyze <catalog> <package> [version]
139
+ pcu -a <catalog> <package> [version]
140
+ pcu a <catalog> <package> [version]
141
+
142
+ Arguments:
143
+ catalog Catalog name (e.g., 'default', 'react17')
144
+ package Package name (e.g., 'react', '@types/node')
145
+ version New version (optional, defaults to latest)
146
+
147
+ Options:
148
+ -f, --format <type> Output format: table, json, yaml, minimal (default: table)
149
+ -w, --workspace <path> Workspace directory (default: current directory)
150
+ -v, --verbose Show detailed information
151
+
152
+ Examples:
153
+ pcu analyze default react
154
+ pcu a default react 18.3.0
155
+ pcu -a react17 @types/react
156
+ ```
157
+
158
+ #### `pcu workspace` / `pcu -s`
159
+
160
+ Show workspace information and validation.
161
+
162
+ ```bash
163
+ pcu workspace [options]
164
+ pcu -s [options]
165
+ pcu w [options]
166
+
167
+ Options:
168
+ --validate Validate workspace configuration
169
+ -s, --stats Show workspace statistics
170
+ -f, --format <type> Output format: table, json, yaml, minimal (default: table)
171
+ -w, --workspace <path> Workspace directory (default: current directory)
172
+ -v, --verbose Show detailed information
173
+
174
+ Examples:
175
+ pcu workspace # Show basic workspace info
176
+ pcu -s --stats # Show detailed statistics
177
+ pcu w --validate # Validate workspace configuration
178
+ ```
179
+
180
+ #### `pcu help` / `pcu -h`
181
+
182
+ Display help information.
183
+
184
+ ```bash
185
+ pcu help [command]
186
+ pcu -h [command]
187
+
188
+ Examples:
189
+ pcu help # Show general help
190
+ pcu help update # Show help for update command
191
+ pcu -h check # Show help for check command
192
+ ```
193
+
194
+ ### Global Options
195
+
196
+ These options work with all commands:
197
+
198
+ ```bash
199
+ -w, --workspace <path> Workspace directory path
200
+ -v, --verbose Enable verbose logging
201
+ --no-color Disable colored output
202
+ -V, --version Output the version number
203
+ -h, --help Display help for command
204
+ ```
205
+
206
+ ### Common Usage Patterns
207
+
208
+ ```bash
209
+ # Quick check for updates
210
+ pcu -c
211
+
212
+ # Check with simple output (like npm-check-updates)
213
+ pcu -c --format minimal
214
+
215
+ # Interactive update with backup
216
+ pcu -u -i -b
217
+
218
+ # Update only minor and patch versions
219
+ pcu -u --target minor
220
+
221
+ # Check specific catalog
222
+ pcu -c --catalog node18
223
+
224
+ # Update excluding certain packages
225
+ pcu -u --exclude "eslint*"
226
+
227
+ # Dry run with verbose output
228
+ pcu -u -d -v
229
+
230
+ # Update with simple output format
231
+ pcu -u --format minimal
232
+
233
+ # Analyze impact before updating
234
+ pcu -a default react
235
+ pcu -u --catalog default --include react
236
+
237
+ # Validate workspace configuration
238
+ pcu -s --validate
239
+ ```
240
+
241
+ ### Configuration
242
+
243
+ Create a `.pcurc.json` file in your project root:
244
+
245
+ ```json
246
+ {
247
+ "defaults": {
248
+ "target": "latest",
249
+ "timeout": 30000,
250
+ "parallel": 5
251
+ },
252
+ "workspace": {
253
+ "autoDiscover": true,
254
+ "catalogMode": "strict"
255
+ },
256
+ "update": {
257
+ "interactive": true,
258
+ "dryRunFirst": true,
259
+ "skipPrereleases": false
260
+ },
261
+ "output": {
262
+ "format": "table",
263
+ "color": true,
264
+ "verbose": false
265
+ }
266
+ }
267
+ ```
268
+
269
+ ## 📁 Project Structure
270
+
271
+ This project follows Domain-Driven Design (DDD) principles:
272
+
273
+ ```
274
+ src/
275
+ ├── cli/ # CLI interface layer
276
+ │ ├── commands/ # Command handlers
277
+ │ ├── options/ # Option parsers
278
+ │ ├── formatters/ # Output formatters
279
+ │ └── validators/ # Input validation
280
+ ├── application/ # Application services
281
+ │ ├── services/ # Application services
282
+ │ ├── handlers/ # Command handlers
283
+ │ └── mappers/ # Data mappers
284
+ ├── domain/ # Domain model
285
+ │ ├── entities/ # Domain entities
286
+ │ ├── value-objects/ # Value objects
287
+ │ ├── aggregates/ # Aggregate roots
288
+ │ ├── services/ # Domain services
289
+ │ └── repositories/ # Repository interfaces
290
+ ├── infrastructure/ # Infrastructure layer
291
+ │ ├── repositories/ # Repository implementations
292
+ │ ├── external-services/ # External service clients
293
+ │ └── file-system/ # File system operations
294
+ ├── adapters/ # Adapter layer
295
+ │ ├── registry/ # Package registry adapters
296
+ │ └── package-managers/ # Package manager adapters
297
+ └── common/ # Common utilities
298
+ ├── types/ # Type definitions
299
+ ├── utils/ # Utility functions
300
+ ├── config/ # Configuration
301
+ └── logger/ # Logging
302
+ ```
303
+
304
+ ## 🧪 Development
305
+
306
+ ### Prerequisites
307
+
308
+ - Node.js >= 18.0.0
309
+ - pnpm >= 8.15.0
310
+
311
+ ### Setup
312
+
313
+ ```bash
314
+ # Clone the repository
315
+ git clone https://github.com/houko/pnpm-catalog-updates.git
316
+ cd pnpm-catalog-updates
317
+
318
+ # Install dependencies
319
+ pnpm install
320
+
321
+ # Build the project
322
+ pnpm build
323
+
324
+ # Run tests
325
+ pnpm test
326
+
327
+ # Run in development mode
328
+ pnpm dev --help
329
+ ```
330
+
331
+ ### Scripts
332
+
333
+ ```bash
334
+ # Development
335
+ pnpm dev # Run in development mode
336
+ pnpm build # Build the project
337
+ pnpm build:watch # Build in watch mode
338
+
339
+ # Testing
340
+ pnpm test # Run unit tests
341
+ pnpm test:watch # Run tests in watch mode
342
+ pnpm test:coverage # Run tests with coverage
343
+ pnpm test:e2e # Run E2E tests
344
+
345
+ # Code Quality
346
+ pnpm lint # Lint code
347
+ pnpm lint:fix # Fix linting issues
348
+ pnpm format # Format code
349
+ pnpm typecheck # Type checking
350
+
351
+ # Utilities
352
+ pnpm clean # Clean build artifacts
353
+ ```
354
+
355
+ ### Testing
356
+
357
+ The project uses a comprehensive testing strategy:
358
+
359
+ - **Unit Tests**: Test individual components in isolation
360
+ - **Integration Tests**: Test component interactions
361
+ - **E2E Tests**: Test the complete CLI workflow
362
+
363
+ ```bash
364
+ # Run all tests
365
+ pnpm test
366
+
367
+ # Run tests with coverage
368
+ pnpm test:coverage
369
+
370
+ # Run E2E tests
371
+ pnpm test:e2e
372
+
373
+ # Run tests in watch mode
374
+ pnpm test:watch
375
+ ```
376
+
377
+ ## 📊 Examples
378
+
379
+ ### Basic Workspace
380
+
381
+ ```yaml
382
+ # pnpm-workspace.yaml
383
+ packages:
384
+ - 'packages/*'
385
+
386
+ catalog:
387
+ react: ^18.2.0
388
+ lodash: ^4.17.21
389
+ typescript: ^5.0.0
390
+ ```
391
+
392
+ ### Multi-Catalog Setup
393
+
394
+ ```yaml
395
+ # pnpm-workspace.yaml
396
+ packages:
397
+ - "apps/*"
398
+ - "packages/*"
399
+
400
+ catalog:
401
+ # Default catalog
402
+ react: ^18.2.0
403
+ typescript: ^5.0.0
404
+
405
+ catalogs:
406
+ # Legacy versions
407
+ react17:
408
+ react: ^17.0.2
409
+ @types/react: ^17.0.62
410
+
411
+ # Latest versions
412
+ latest:
413
+ react: ^18.2.0
414
+ typescript: ^5.2.0
415
+ ```
416
+
417
+ ### Usage in package.json
418
+
419
+ ```json
420
+ {
421
+ "dependencies": {
422
+ "react": "catalog:",
423
+ "lodash": "catalog:",
424
+ "legacy-lib": "catalog:react17"
425
+ }
426
+ }
427
+ ```
428
+
429
+ ## 🤝 Contributing
430
+
431
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md)
432
+ for details.
433
+
434
+ ### Development Workflow
435
+
436
+ 1. Fork the repository
437
+ 2. Create a feature branch: `git checkout -b feature/amazing-feature`
438
+ 3. Make your changes
439
+ 4. Add tests for your changes
440
+ 5. Ensure all tests pass: `pnpm test`
441
+ 6. Lint your code: `pnpm lint:fix`
442
+ 7. Commit your changes: `git commit -m 'feat: add amazing feature'`
443
+ 8. Push to the branch: `git push origin feature/amazing-feature`
444
+ 9. Open a Pull Request
445
+
446
+ ### Commit Message Convention
447
+
448
+ We use [Conventional Commits](https://conventionalcommits.org/):
449
+
450
+ - `feat`: A new feature
451
+ - `fix`: A bug fix
452
+ - `docs`: Documentation only changes
453
+ - `style`: Changes that do not affect the meaning of the code
454
+ - `refactor`: A code change that neither fixes a bug nor adds a feature
455
+ - `test`: Adding missing tests or correcting existing tests
456
+ - `chore`: Changes to the build process or auxiliary tools
457
+
458
+ ## 📄 License
459
+
460
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
461
+ for details.
462
+
463
+ ## 🙏 Acknowledgments
464
+
465
+ - Inspired by
466
+ [npm-check-updates](https://github.com/raineorshine/npm-check-updates)
467
+ - Built with love for the pnpm community
468
+ - Thanks to all contributors and users
469
+
470
+ ## 📞 Support
471
+
472
+ - 📖 [Documentation](https://github.com/houko/pnpm-catalog-updates#readme)
473
+ - 🐛 [Issue Tracker](https://github.com/houko/pnpm-catalog-updates/issues)
474
+ - 💬 [Discussions](https://github.com/houko/pnpm-catalog-updates/discussions)
475
+
476
+ ---
477
+
478
+ Made with ❤️ for the pnpm community
package/bin/pcu.js ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { fileURLToPath } from 'url';
4
+ import path from 'path';
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+
9
+ // Import and run the CLI
10
+ const { main } = await import(path.join(__dirname, '..', 'dist', 'cli', 'index.js'));
11
+
12
+ main().catch((error) => {
13
+ console.error('❌ Error:', error.message);
14
+ process.exit(1);
15
+ });
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Catalog Update Service
3
+ *
4
+ * Core application service that handles catalog dependency updates.
5
+ * Orchestrates domain objects and infrastructure services to provide
6
+ * high-level use cases for checking and updating catalog dependencies.
7
+ */
8
+ import { WorkspaceRepository } from '../../domain/repositories/WorkspaceRepository.js';
9
+ import { NpmRegistryService } from '../../infrastructure/external-services/NpmRegistryService.js';
10
+ export interface CheckOptions {
11
+ workspacePath?: string | undefined;
12
+ catalogName?: string | undefined;
13
+ target?: UpdateTarget | undefined;
14
+ includePrerelease?: boolean | undefined;
15
+ exclude?: string[] | undefined;
16
+ include?: string[] | undefined;
17
+ }
18
+ export interface UpdateOptions extends CheckOptions {
19
+ interactive?: boolean;
20
+ dryRun?: boolean;
21
+ force?: boolean;
22
+ createBackup?: boolean;
23
+ }
24
+ export interface OutdatedReport {
25
+ workspace: {
26
+ path: string;
27
+ name: string;
28
+ };
29
+ catalogs: CatalogUpdateInfo[];
30
+ totalOutdated: number;
31
+ hasUpdates: boolean;
32
+ }
33
+ export interface CatalogUpdateInfo {
34
+ catalogName: string;
35
+ outdatedDependencies: OutdatedDependencyInfo[];
36
+ totalPackages: number;
37
+ outdatedCount: number;
38
+ }
39
+ export interface OutdatedDependencyInfo {
40
+ packageName: string;
41
+ currentVersion: string;
42
+ latestVersion: string;
43
+ wantedVersion: string;
44
+ updateType: 'major' | 'minor' | 'patch';
45
+ isSecurityUpdate: boolean;
46
+ affectedPackages: string[];
47
+ }
48
+ export interface UpdatePlan {
49
+ workspace: {
50
+ path: string;
51
+ name: string;
52
+ };
53
+ updates: PlannedUpdate[];
54
+ conflicts: VersionConflict[];
55
+ totalUpdates: number;
56
+ hasConflicts: boolean;
57
+ }
58
+ export interface PlannedUpdate {
59
+ catalogName: string;
60
+ packageName: string;
61
+ currentVersion: string;
62
+ newVersion: string;
63
+ updateType: 'major' | 'minor' | 'patch';
64
+ reason: string;
65
+ affectedPackages: string[];
66
+ }
67
+ export interface VersionConflict {
68
+ packageName: string;
69
+ catalogs: Array<{
70
+ catalogName: string;
71
+ currentVersion: string;
72
+ proposedVersion: string;
73
+ }>;
74
+ recommendation: string;
75
+ }
76
+ export interface UpdateResult {
77
+ success: boolean;
78
+ workspace: {
79
+ path: string;
80
+ name: string;
81
+ };
82
+ updatedDependencies: UpdatedDependency[];
83
+ skippedDependencies: SkippedDependency[];
84
+ errors: UpdateError[];
85
+ totalUpdated: number;
86
+ totalSkipped: number;
87
+ totalErrors: number;
88
+ }
89
+ export interface UpdatedDependency {
90
+ catalogName: string;
91
+ packageName: string;
92
+ fromVersion: string;
93
+ toVersion: string;
94
+ updateType: 'major' | 'minor' | 'patch';
95
+ }
96
+ export interface SkippedDependency {
97
+ catalogName: string;
98
+ packageName: string;
99
+ currentVersion: string;
100
+ reason: string;
101
+ }
102
+ export interface UpdateError {
103
+ catalogName: string;
104
+ packageName: string;
105
+ error: string;
106
+ fatal: boolean;
107
+ }
108
+ export interface ImpactAnalysis {
109
+ packageName: string;
110
+ catalogName: string;
111
+ currentVersion: string;
112
+ proposedVersion: string;
113
+ updateType: 'major' | 'minor' | 'patch';
114
+ affectedPackages: PackageImpact[];
115
+ riskLevel: 'low' | 'medium' | 'high';
116
+ securityImpact: SecurityImpact;
117
+ recommendations: string[];
118
+ }
119
+ export interface PackageImpact {
120
+ packageName: string;
121
+ packagePath: string;
122
+ dependencyType: 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies';
123
+ isBreakingChange: boolean;
124
+ compatibilityRisk: 'low' | 'medium' | 'high';
125
+ }
126
+ export interface SecurityImpact {
127
+ hasVulnerabilities: boolean;
128
+ fixedVulnerabilities: number;
129
+ newVulnerabilities: number;
130
+ severityChange: 'better' | 'worse' | 'same';
131
+ }
132
+ export type UpdateTarget = 'latest' | 'greatest' | 'minor' | 'patch' | 'newest';
133
+ export declare class CatalogUpdateService {
134
+ private readonly workspaceRepository;
135
+ private readonly registryService;
136
+ constructor(workspaceRepository: WorkspaceRepository, registryService: NpmRegistryService);
137
+ /**
138
+ * Check for outdated catalog dependencies
139
+ */
140
+ checkOutdatedDependencies(options?: CheckOptions): Promise<OutdatedReport>;
141
+ /**
142
+ * Plan catalog dependency updates
143
+ */
144
+ planUpdates(options: UpdateOptions): Promise<UpdatePlan>;
145
+ /**
146
+ * Execute catalog dependency updates
147
+ */
148
+ executeUpdates(plan: UpdatePlan, options: UpdateOptions): Promise<UpdateResult>;
149
+ /**
150
+ * Analyze the impact of updating a specific dependency
151
+ */
152
+ analyzeImpact(catalogName: string, packageName: string, newVersion: string, workspacePath?: string): Promise<ImpactAnalysis>;
153
+ /**
154
+ * Check if a specific package should be updated based on filters
155
+ */
156
+ private shouldCheckPackage;
157
+ /**
158
+ * Check if package matches a pattern (simple glob-like matching)
159
+ */
160
+ private matchesPattern;
161
+ /**
162
+ * Check if a package needs updating
163
+ */
164
+ private checkPackageUpdate;
165
+ /**
166
+ * Get version constrained by update type
167
+ */
168
+ private getConstrainedVersion;
169
+ /**
170
+ * Generate update reason description
171
+ */
172
+ private getUpdateReason;
173
+ /**
174
+ * Analyze security impact of version change
175
+ */
176
+ private analyzeSecurityImpact;
177
+ /**
178
+ * Assess compatibility risk for update type
179
+ */
180
+ private assessCompatibilityRisk;
181
+ /**
182
+ * Assess overall risk level
183
+ */
184
+ private assessOverallRisk;
185
+ /**
186
+ * Generate recommendations based on analysis
187
+ */
188
+ private generateRecommendations;
189
+ }
190
+ //# sourceMappingURL=CatalogUpdateService.d.ts.map