Commit 087cc8d
Backoffice NPM: use looser peerDependencies version ranges for plugin compatibility (#21644)
* feat(backoffice): use looser version ranges for peerDependencies
Convert hoisted dependencies to peerDependencies with more permissive version
ranges that allow plugin developers to use different versions without npm conflicts.
Version range strategy:
- Pre-release (0.x.y): >=X.Y.Z <1.0.0
Example: @hey-api/openapi-ts 0.85.0 → >=0.85.0 <1.0.0
Allows plugins to use 0.85.0, 0.91.1, 0.99.99 without conflicts
- Stable (major.x.y where major ≥1): major.x.x
Example: lit ^3.3.1 → 3.x.x
Allows any patch/minor within the major version
This allows plugin developers to:
- Use @hey-api/openapi-ts 0.91.1 while backoffice uses 0.85.0
- Install compatible deduplicated versions when available
- Override versions when needed for their specific use case
Types remain available from peerDependencies (automatically installed by npm 7+).
When @hey-api reaches 1.0.0, the range will automatically become ^1.0.0.
https://claude.ai/code/session_01CBpcwXYZjzexKkM9Cf57Kb
* refactor(backoffice): use semver package for version parsing in cleanse script
Replace regex-based version parsing with the semver package used by npm itself.
This ensures version parsing is consistent with npm's own semver handling and is
more robust for edge cases.
Also update the version range logic to be more explicit and correct:
- Pre-release (0.x.y): >=X.Y.Z <1.0.0
- Stable (1+.x.y): >=X.Y.Z <NEXT_MAJOR.0.0
This ensures plugin developers use at least the tested version and prevents
accidental downgrades to incompatible minor versions.
https://claude.ai/code/session_01CBpcwXYZjzexKkM9Cf57Kb
* chore: formats file
* chore: lockfile
* fix(backoffice): use semver.minVersion to parse version ranges
Fix parsing of version ranges like ^0.85.0 by using semver.minVersion() instead
of semver.parse(). The parse() function only handles exact versions, while
minVersion() extracts the minimum version from a range.
Example transformations:
- ^0.85.0 → 0.85.0 → >=0.85.0 <1.0.0
- ^3.3.1 → 3.3.1 → >=3.3.1 <4.0.0
https://claude.ai/code/session_01CBpcwXYZjzexKkM9Cf57Kb
* refactor(backoffice): keep caret ranges for stable package versions
Optimize the version range conversion logic:
- Stable versions (major ≥ 1) with caret (e.g., ^3.3.1): Keep as-is
The caret already implements the desired range: >=3.3.1 <4.0.0
- Pre-release versions (0.x.y): Convert to explicit range
^0.85.0 → >=0.85.0 <1.0.0 (caret only allows 0.85.z, not 0.91.z)
- Exact versions (e.g., 3.16.0): Convert to range
3.16.0 → >=3.16.0 <4.0.0
This simplifies the published package.json while maintaining the same semantics
and is more explicit about the intent.
Examples of published peerDependencies:
- lit: ^3.3.1 (unchanged, already has correct range)
- rxjs: ^7.8.2 (unchanged)
- @hey-api/openapi-ts: >=0.85.0 <1.0.0 (converted from ^0.85.0)
- @tiptap/core: >=3.16.0 <4.0.0 (converted from 3.16.0)
https://claude.ai/code/session_01CBpcwXYZjzexKkM9Cf57Kb
* refactor(backoffice): use caret for stable exact versions
Simplify stable exact versions (e.g., 3.16.0) by adding a caret prefix (^3.16.0)
instead of explicit range (>=3.16.0 <4.0.0). Both are semantically identical for
stable versions but caret is more concise and conventional.
Updated version range logic:
- Stable with caret (^3.3.1): Keep as-is
- Pre-release with caret (^0.85.0): Convert to >=0.85.0 <1.0.0
- Stable exact version (3.16.0): Convert to ^3.16.0
Examples of published peerDependencies:
- lit: ^3.3.1
- rxjs: ^7.8.2
- @hey-api/openapi-ts: >=0.85.0 <1.0.0
- @tiptap/core: ^3.16.0 (now with caret)
https://claude.ai/code/session_01CBpcwXYZjzexKkM9Cf57Kb
* refactor(backoffice): ensure all pre-release versions get explicit range
Reorganize version conversion logic for clarity:
1. All pre-release (0.x.y) versions → explicit range: >=X.Y.Z <1.0.0
- Examples: ^0.85.0 → >=0.85.0 <1.0.0, 0.85.0 → >=0.85.0 <1.0.0
2. Stable versions with caret (^3.3.1) → keep as-is
3. Stable versions exact (3.16.0) → add caret: ^3.16.0
This ensures pre-release version constraints are properly loosened for plugins
while maintaining stability guarantees.
https://claude.ai/code/session_01CBpcwXYZjzexKkM9Cf57Kb
* treat all modifiers the same
* docs: add backoffice npm package structure documentation
Add comprehensive section to CLAUDE.md explaining:
- Backoffice npm package architecture and plugin model
- Dependency hoisting strategy and version range logic
- How pre-release versions are handled vs stable versions
- Importmap as single source of truth for runtime
- Plugin development implications and expectations
Clarifies that while npm versions constrain types, the actual runtime comes
from importmap, and plugin developers should declare explicit dependencies
rather than relying on transitive deps.
https://claude.ai/code/session_01CBpcwXYZjzexKkM9Cf57Kb
* docs: add npm package publishing guide to backoffice CLAUDE.md
Add comprehensive section explaining:
- Why backoffice uses peerDependencies (importmap provides runtime)
- Dependency hoisting strategy and version range conversion logic
- How pre-release versions are handled differently from stable versions
- Example published peerDependencies showing final output
- Plugin developer guide with dos and don'ts
- Key files involved in the publishing process
Provides clear guidance for plugin developers on version compatibility
and explains the importmap-as-single-source-of-truth architecture.
https://claude.ai/code/session_01CBpcwXYZjzexKkM9Cf57Kb
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 0045691 commit 087cc8d
File tree
5 files changed
+227
-76
lines changed- src/Umbraco.Web.UI.Client
- devops/publish
5 files changed
+227
-76
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
316 | 375 | | |
317 | 376 | | |
318 | 377 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
95 | 178 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | | - | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | | - | |
14 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
15 | 44 | | |
16 | 45 | | |
17 | 46 | | |
18 | 47 | | |
19 | | - | |
| 48 | + | |
20 | 49 | | |
21 | 50 | | |
22 | 51 | | |
23 | 52 | | |
24 | | - | |
| 53 | + | |
25 | 54 | | |
26 | 55 | | |
27 | 56 | | |
| |||
36 | 65 | | |
37 | 66 | | |
38 | 67 | | |
39 | | - | |
40 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
41 | 80 | | |
42 | 81 | | |
43 | | - | |
| 82 | + | |
44 | 83 | | |
45 | 84 | | |
46 | 85 | | |
| |||
0 commit comments