Commit e85b0d3
authored
fix(packages): no longer match versionless packages (#10056)
### Description
Previously we had matched version constraints on workspace packages that
didn't have versions. This did not match actual package manager
implementations.
To give a concrete example:
```
[0 olszewski@macbookpro] /tmp/pnpm-prune-test $ tree
.
├── node_modules
├── package.json
├── packages
│ ├── a
│ │ ├── node_modules
│ │ │ └── b -> ../../../node_modules/.pnpm/[email protected]/node_modules/b
│ │ └── package.json
│ └── b
│ └── package.json
├── pnpm-lock.yaml
└── pnpm-workspace.yaml
[0 olszewski@macbookpro] /tmp/pnpm-prune-test $ cat packages/a/package.json
{"name": "a", "dependencies": {"b": "2.0.1"}}
[0 olszewski@macbookpro] /tmp/pnpm-prune-test $ cat packages/b/package.json
{"name": "b"}
[0 olszewski@macbookpro] /tmp/pnpm-prune-test $ cat pnpm-lock.yaml
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.: {}
packages/a:
dependencies:
b:
specifier: 2.0.1
version: 2.0.1
packages/b: {}
packages:
/[email protected]:
resolution: {integrity: sha512-JBWAj6f91ocNLbdg1jCGrxHXSWbQDsxgqVmKeO0TellEcq9LCvJ97iWG6p3otCt/v08/hHrWwAB9vNYS9y70IQ==}
engines: {node: '>= 0.8.0'}
dev: false
```
As you can see `a` is using a `b` from the NPM registry and not the
workspace package `b` that does not have a version.
### Testing Instructions
Added red -> green unit test
I spot checked and all of the following would not match a versionless
workspace dependency when provided a constraint:
- npm 8,9,10
- yarn 1, 3, 4
- pnpm 8, 9, 101 parent bee59c1 commit e85b0d3
File tree
1 file changed
+6
-0
lines changed- crates/turborepo-repository/src/package_graph
1 file changed
+6
-0
lines changedLines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
173 | 178 | | |
174 | 179 | | |
175 | 180 | | |
| |||
234 | 239 | | |
235 | 240 | | |
236 | 241 | | |
| 242 | + | |
237 | 243 | | |
238 | 244 | | |
239 | 245 | | |
| |||
0 commit comments