Commit Graph

10701 Commits

Author SHA1 Message Date
Zoltan Kochan
50ecad2390 refactor: move plugin-commands-patching 2023-01-13 18:36:31 +02:00
Andrew Sprouse
28b47a1569 feat: restore extend-node-path option (#5910)
Co-authored-by: Zoltan Kochan <z@kochan.io>
2023-01-13 18:15:24 +02:00
Zoltan Kochan
bc8df37871 fix: re-add manually removed packages to node_modules when node-linker is set to hoisted (#5921) 2023-01-13 17:07:34 +02:00
await-ovo
2ae1c449d2 feat(plugin-commands-patching): apply existed patch file when re-patch (#5906)
close #5632

Co-authored-by: Zoltan Kochan <z@kochan.io>
2023-01-12 04:19:22 +02:00
bohan
4008a52361 fix(link-bins): ensure permission of bin file when symlinked (#5913)
close #5822
close #5890
2023-01-12 03:43:05 +02:00
Zoltan Kochan
2c615198f9 chore(release): 7.24.3 v7.24.3 2023-01-11 03:11:36 +02:00
Zoltan Kochan
0055af5898 style: fix 2023-01-11 02:19:41 +02:00
Zoltan Kochan
5bac26658f style: fix 2023-01-11 01:22:11 +02:00
Zoltan Kochan
c8d594c7fe fix: update vulnerable dependency 2023-01-11 01:13:58 +02:00
Zoltan Kochan
1e6de89b6b fix(deps): update dependencies 2023-01-11 01:10:11 +02:00
Zoltan Kochan
9d425962f4 fix: lockfile v6 repeat install when use-lockfile-v6 is not set 2023-01-11 01:09:08 +02:00
Zoltan Kochan
5a5512f14c chore: update lockfile 2023-01-10 14:43:41 +02:00
Zoltan Kochan
2982b43be6 chore(release): 7.24.2 v7.24.2 2023-01-10 14:01:06 +02:00
Zoltan Kochan
9a68ebbaea fix: frozen lockfile with lockfile v6 2023-01-10 13:03:06 +02:00
Zoltan Kochan
95d82077ea chore(release): 7.24.1 v7.24.1 2023-01-10 11:49:54 +02:00
Zoltan Kochan
0f6e95872a fix: lockfile v6 should not be corrupted on repeat install (#5905)
* fix: lockfile v6 should not be corrupted on repeat install

* fix: don't add empty specifiers to lockfile v6

* fix: lockfile v6 should be saved to node_modules/.pnpm/lock.yaml

* fix: frozen lockfile with lockfile v6
2023-01-10 11:41:17 +02:00
Zoltan Kochan
bcbcc47530 chore(release): 7.24.0 v7.24.0 2023-01-09 19:25:36 +02:00
Zoltan Kochan
891a8d7633 fix: side effects upload when node-linker is set to hoisted (#5902)
This fixes a bug introduced by #5814

сlose #5823
2023-01-09 19:23:50 +02:00
Zoltan Kochan
3ebce5db7a feat!: lockfile format v6 (#5810) 2023-01-09 14:37:05 +02:00
Zoltan Kochan
f76a39973e fix(config): config set key=value should work (#5899)
ref #5889
2023-01-09 12:43:21 +02:00
Zoltan Kochan
c7b05cd9a4 fix: don't build git-hosted dependencies when scripts are ignored (#5897)
close #5876
2023-01-09 03:59:37 +02:00
Zoltan Kochan
c9d486781e chore: update code owners 2023-01-09 02:52:01 +02:00
await-ovo
8ecbcafdd5 fix(plugin-commands-script-runners): support directory with path delimiter when running local bin (#5874)
close #5846

Co-authored-by: Zoltan Kochan <z@kochan.io>
2023-01-08 18:09:03 +02:00
Zoltan Kochan
044cfe5175 chore(release): 7.23.0 v7.23.0 2023-01-05 15:31:37 +02:00
Zoltan Kochan
1fad508b07 feat: resolve peer dependencies from workspace root (#5882)
partially reverts #4469
2023-01-05 15:13:40 +02:00
await-ovo
5b311d16cb fix: display --include-workspace-root option on recursive command's help info (#5880)
close #5130
2023-01-04 15:22:41 +02:00
Zoltan Kochan
640f4666c7 fix: the help of the run command should list --resume-from 2023-01-04 03:31:06 +02:00
Zoltan Kochan
2895389ae1 chore(release): 7.22.0 v7.22.0 2023-01-03 15:30:16 +02:00
Brandon Cheng
395a33a50c feat: traverse through workspace packages in why and list commands (#5863)
* refactor(dependencies-hierarchy): remove keypath argument from getTree

The `keypath` argument is an internal implementation detail of `getTree`
used to detect cycles in the package graph. Removing this from the call
signature of `getTree` since it exposes an implementation detail.

The start of a `getTree` call always passed in the starting node as the
initial value anyway.

```ts
const getChildrenTree = getTree.bind(null, { ... })
getChildrenTree([relativeId], relativeId)
```

It's simpler for that to happen in the first call to `getTreeHelper`
internally and better ensures the keypath is created correctly. A future
refactor makes construction of the keypath more involved.

* refactor(dependencies-hierarchy): remove refToRelative call in getPkgInfo

This removes an extra `refToRelative` call in `getPkgInfo`. The result
of this call wasn't used within the function and was simply passed back
to the caller.

Callers of `getPkgInfo` were checking the result of `refToRelative`,
from `getPkgInfo`'s return object only to call `refToRelative` again.
Calling `refToRelative` directly simplifies code a bit. We can remove an
unnecessary cast and an if statement.

* refactor(dependencies-hierarchy): create enum for getTree nodes

* feature(dependencies-hierarchy): traverse through workspace packages

This updates `pnpm list` and `pnpm why` to traverse through `link:`
packages by simply. This is done by simply implementing a new TreeNodeId
enum variant.

* test(dependencies-hierarchy): test transitive workspace package listing

* refactor(dependencies-hierarchy): create interface for GetPkgInfoOpts

A future commit adds new fields to `getPkgInfo`'s options. The dedicated
interface makes it easier to describe these new options with a JSDoc.

* fix(dependencies-hierarchy): fix path for link: deps in projects

This was a bug before the changes in this pull request. The bug was not
user facing since `pnpm list --json` doesn't print this computed path.

* fix(dependencies-hierarchy): print version paths rel to starting project

* feat(list): add --only-projects flag

* refactor: change description of --only-projects

Co-authored-by: Zoltan Kochan <z@kochan.io>
2023-01-03 15:28:20 +02:00
Zoltan Kochan
40a4818405 fix: only build git-hosted dependency if it has no main file (#5868)
close #5845
2023-01-03 14:38:20 +02:00
Pascal Jufer
a02f1fea1b feat: expose npm_command env variable to scripts (#5859) 2023-01-03 03:23:23 +02:00
await-ovo
da15828ec5 feat(plugin-commands-script-runners): support --resume-from for pnpm exec command (#5856)
close #4690
2023-01-02 12:08:20 +02:00
Brandon Cheng
37c818d1bd refactor(dependencies-hierarchy): merge isPartiallyVisited and height
The numerical `height` value isn't used if `isPartiallyVisited` is set.
Merging these two fields makes that more clear.

The definition of the `height` field used in getTreeHelper is also
updated to include the parent node in this commit. This makes the field
consistent with the `height` definition in DependenciesCache.
2023-01-02 00:25:39 +02:00
Brandon Cheng
a9304ac78e fix(dependencies-hierarchy): fix some vars only updating on cache miss
The `resultHeight` and `resultIsPartiallyVisited` variables were only
being updated on cache misses by mistake.

This commit updates the `DependenciesCache` to provide these variables
based on previous `getTreeHelper` calls.
2023-01-02 00:25:39 +02:00
Brandon Cheng
9b41f88a65 fix(dependencies-hierarchy): fix off-by-one when passing depth to cache 2023-01-02 00:25:39 +02:00
Brandon Cheng
c33275dad8 test(dependencies-hierarchy): fix height > requestedDepth cache test
Looking over this again, it looks like this never tested the fully
visited cache. The `a` package was never added to the fully visited
cache since the dependencies of its leaf nodes were never enumerated.

Adding a comment to make this more clear and increasing the max depth
of the test case.
2023-01-02 00:25:39 +02:00
Brandon Cheng
09065b8a78 fix(dependencies-hierarchy): fix resultHeight calculation
This previously double incremented `resultHeight`. When writing this,
I was thinking the child node's height was 1 more than the call for its
dependencies. The parent node (the result) would then be more more than
that.

However, `resultHeight`'s definition is based the longest edge in the
dependencies array returned, which doesn't include the parent node. The
additional `+ 1` to account for the parent node should never have been
added.
2023-01-02 00:25:39 +02:00
Brandon Cheng
35fea5ea74 fix(dependencies-hierarchy): initialize resultHeight to null
In a debugger, I noticed a test package with no dependencies return a
height of `0` from getTree. By the comment in `DependencyInfo`, this
should instead be `null` since the dependencies array is empty.

It turns out this is the case when `deps == null`. The `getTree`
function early returns with a `null` height:

```ts
if (deps == null) {
  return { dependencies: [], isPartiallyVisited: false, height: null }
}
```

However, when `deps` is `{}`, `resultHeight` gets initialized to `0`.
The subsequent `.forEach` loop then iterates over the non-empty object.
2023-01-02 00:25:39 +02:00
Zoltan Kochan
ec97a31057 fix: print a better error message on prepare pkg failure (#5847)
ref #5845
2023-01-01 23:28:33 +02:00
Pascal Jufer
08ceaf3fcb chore(deps): replace is-ci by ci-info (#5862) 2023-01-01 20:53:07 +02:00
Zoltan Kochan
ee081825bf docs(license): update year 2023-01-01 04:26:13 +02:00
Zoltan Kochan
83ba90fb83 fix: better error message when the installed package was unpublished (#5854)
close #5849
2022-12-31 15:15:10 +02:00
Brandon Cheng
7eb7056c92 refactor(dependencies-hierarchy): simplify max depth recursion (#5858)
* test(dependencies-hierarchy): start currentDepth at 1 in tests

Calls to `getTree` from the `buildDependenciesHierarchy` function always
start the `currentDepth` at `1` rather than `0`.

Updating `currentDepth` calls in test to also start at `1` for
consistency with production code. This required incrementing the
`maxDepth` argument in a few cases as well.

* refactor(dependencies-hierarchy): simplify max depth recursion
2022-12-31 03:11:00 +02:00
Zoltan Kochan
00dea18c60 chore(deps): update 2022-12-30 22:05:59 +02:00
Brandon Cheng
7853a26e15 fix(dependencies-hierarchy): account for depth in getTree cache (#5817) 2022-12-29 22:21:04 +02:00
Zoltan Kochan
33f95fcc7f chore(release): 7.21.0 v7.21.0 2022-12-28 16:45:22 +02:00
Zoltan Kochan
d71dbf230b fix: only the add command should fail if there is no bin directory in PATH (#5842)
close #5841
2022-12-27 23:23:00 +02:00
Zoltan Kochan
83a627a25c fix(config): the --location=global CLI option should work (#5843)
ref #5841
2022-12-27 19:46:22 +02:00
await-ovo
b3dfa3ba8a feat(plugin-commands-script-runners): add --shell-mode option for pnpm dlx (#5840)
close #5679
2022-12-26 18:58:25 +02:00
Zoltan Kochan
964d5ff278 chore(release): 7.20.0 v7.20.0 2022-12-26 00:59:32 +02:00