When `link-workspace-packages` is `true`, local packages should be
preferred even if packages from the registry are already present
in `shrinkwrap.yaml`.
This is another issue with the graph-sequencer producing strange results
when
sorting.
Case that is fixed here:
- Package 'a' depends on 'b' and 'c'
- Package 'd' depends on 'a'
- Package 'e' depends on 'a', 'b' and 'c'
Command that has the wront behavior:
pnpm recursive --filter=...a [command]
**Expected behavior**:
Packages are executed in order ['a', ['d', 'e']] ('d' and 'e' can be
executed
in parallel.)
**Actual behavior**:
Packages are executed in order [['e', 'a', 'd']]
**Fix**:
Remove the unused dependencies 'b' and 'c' from the graph when sorting.
PR #1408
* fix: ignore cycles of length 1 in dependency graph when sorting
Cycles of length 1 in the dependency graph ie., packages that depend on
themselves, confuse the 'graph-sequencer' function that is used to order the
packages topologically.
Sometimes, it makes sense to make packages depend on themselves eg., to install
their exposed scripts in `node_modules/.bin`, so we should either fix the
`graph-sequencer` or apply this patch.
An example for this behavior is:
- Package 'a' depends on 'b' and 'c'
- Package 'b' depends on 'b'
- Package 'c' depends on 'b' and 'c'
Now run:
pnpm recursive --filter=a... [some command]
**Expected behavior**:
- Packages are visited in order [['b'], ['c'], ['a']], where no parallel
execution is possible.
**Actual behavior**:
- Packages are visited in order [['b'], ['a'], ['c']].
This patch fixes that behavior.
* fix: ignore cycles of length 1 in dependency graph when sorting
add a regression test to packages/pnpm/test/monorepo/index.ts
pr #1406
Also, better naming of variables in @pnpm/resolve-dependencies.
This is refactoring of supi to make it easier to do the performance improvements for #1366.
PR #1399
This changes the way node_modules information of importers is
stored. The initial implementation in #1373 used a separate
`.modules.yaml` in every importer's node_modules directory.
Keeping only one `.modules.yaml` makes it easier to get all the
necessary info during recursive installation.
ref #1366