Commit 203eec1
committed
fix(@angular/cli): isolate temporary package installations from parent Yarn workspace
When installing a temporary CLI package during update command execution,
the temporary directory is placed within the project tree (e.g. under
node_modules). When using Yarn modern (v2+), Yarn searches upward for
a yarn.lock file to locate the project root. Upon finding the parent
project's yarn.lock, Yarn detects that the temporary directory contains
a package.json but is not a declared workspace member, causing yarn add
to fail with a Usage Error.
To resolve this, an empty yarn.lock file is written to the temporary
directory when the package manager is Yarn modern. This creates a
project boundary that prevents upward workspace traversal and ensures
Yarn treats the directory as an independent project. Additionally, if
the parent project does not define a .yarnrc.yml or .yarnrc.yaml, a
default configuration specifying 'nodeLinker: node-modules' is written
to ensure packages are installed into node_modules rather than PnP.
Fixes #339721 parent ab6d7df commit 203eec1
2 files changed
Lines changed: 62 additions & 0 deletions
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
724 | 724 | | |
725 | 725 | | |
726 | 726 | | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
727 | 733 | | |
728 | 734 | | |
| 735 | + | |
729 | 736 | | |
730 | 737 | | |
731 | 738 | | |
732 | 739 | | |
733 | 740 | | |
734 | 741 | | |
| 742 | + | |
735 | 743 | | |
736 | 744 | | |
737 | 745 | | |
738 | 746 | | |
739 | 747 | | |
740 | 748 | | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
741 | 756 | | |
742 | 757 | | |
743 | 758 | | |
| |||
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
195 | 199 | | |
196 | 200 | | |
197 | 201 | | |
| |||
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
247 | 255 | | |
248 | 256 | | |
249 | 257 | | |
| |||
254 | 262 | | |
255 | 263 | | |
256 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
257 | 304 | | |
258 | 305 | | |
259 | 306 | | |
| |||
0 commit comments