Commit Graph

51 Commits

Author SHA1 Message Date
Zoltan Kochan
d47c4266db perf: faster repeat install (#8838) 2024-12-08 23:42:33 +01:00
Zoltan Kochan
7d7c51ecd6 feat!: dlx should use exact versions of packages in the cache key (#8811)
close #8722
2024-11-27 09:04:42 +01:00
Zoltan Kochan
7997ed4ae2 fix: running install automatically before run (#8805) 2024-11-25 14:02:17 +01:00
Zoltan Kochan
4dd27a894f feat: add an option to install dependencies before running scripts (#8781) 2024-11-25 09:02:12 +01:00
btea
ef7c10221c fix: pnpm exec should specify command (#8774) 2024-11-17 17:07:32 +01:00
Khải
19d5b51558 feat(exec): check dependencies before running scripts (#8645)
* refactor: break a long line into multiple lines

* feat: cache that tracks workspace structures

* feat: handle hash collisions

* docs(changeset): packages-list-cache

* feat(packages-list-cache): store mtime

* fix(packages-list-cache): JSON5 and YAML manifests

* feat(packages-list-cache): add catalogs

* style: sort fields alphabetically

* fix: actually fix it

* lint: fix

* lint: fix

* test(packages-list-cache): test

* feat(exec): check deps before run scripts

Resolves https://github.com/pnpm/pnpm/issues/8585

* style: fix eslint

* feat: use a single lastValidatedTimestamp

* refactor: rearrange

* perf: don't do pointless comparisons

* perf: optimize non-workspace

* perf: optimize sharedWorkspaceLockfile=false

* perf: remove unnecessary fs reads

* refactor: statManifestFile

* perf: skip comparing manifest to lockfile by stats

* feat: add wantedLockfileDir to error message

* refactor: shorten a function name

* refactor: rename a function

* docs: improve wordings

* feat: export `linkedPackagesAreUpToDate`

* feat: make sure lockfile specs satisfy manifest (wip)

* docs: todo

* fix: projectId

* feat: skip install-related scripts

* fix: type errors

* refactor: use tagged union

* refactor: remove unnecessary type expression

* docs: todo

* feat: add linkedPackagesAreUpToDate (wip)

* refactor: rearrange fields

* refactor: remove a temporary variable

* feat: export `getWorkspacePackagesByDirectory`

* feat: make workspacePackages optional

* feat: complete `linkedPackagesAreUpToDate`

* docs: remove unapplicable todo

* docs: explain why check is skipped

* feat: load allProjects and try again

* refactor: remove unused dependencies

* refactor: remove commented-out code

* refactor: replace `else if` with `return`

* feat: use-case without workspace manifest

* perf: skip unnecessary work

* feat: add a guard

* fix: eslint

* refactor: move code to new package

* refactor: sort dependencies

* test: outline

* refactor: extract assertLockfilesEqual for testing

* test: skip failing tests for now

* fix: eslint

* test: assertLockfilesEqual

* refactor: extract statManifestFile for testing

* test: todo

* test: statManifestFile

* test: shouldRunCheck

* refactor: rename a test file

* test: add

* test: todo

* docs: remove a commented-out code

* test: create groups

* test: todo

* test: add

* test: platform agnostic

* test: remove unnecessary scripts

* test: use `assert.strictEqual` instead

* test: export bin locations

* test: nested `pnpm run`

* test: todo

* test: add `cwd` option to `execPnpmSync`

* test: add

* fix: recursive

* test: add

* test: fix package names

* fix: catalogs comparison

* test: add

* refactor: just use ramda filter

* test: add

* test: mutations

* fix: package.json

* fix: jest

* feat(packages-list): debug logs

* feat: add debug messages

* fix: eslint

* test: check debug messages in other case

* docs: add next step

* test: mtime updates without modification

* docs: correct test description

* test: mtime changes

* test: check should be skipped

* docs: remove fulfilled todos

* fix: remove `.only`

* docs: todo

* docs: correct test names

* test: workspace structure changes

* test: packages list cache

* test: add

* refactor: divide a test file into 2

* docs: consistent wordings

* refactor: clearer error messages

* fix: ignore check in recursive nested scripts

* test: no dependencies

* test: print error messages on failures

* test: improve stdout/stderr in error messages

* docs: consistent wordings

* docs: clarify what did what

* test: nested script

* docs: consistent test descriptions

* docs(changeset): correction

* fix: save catalogs to packages list

* test: catalogs

* test: fix

* test: fix windows

* refactor: remove unused option field

* refactor: prefer `!= null`

* feat: use `node_modules` instead

* refactor: rename a package

* refactor: apply suggestion

* refactor: remove workspaceDir

* refactor: move `shouldRunCheck` to `exec`

* feat: rename config key

* refactor: rename a test dir

* refactor: correct grammar

* refactor: make loadPackagesList sync

* test: multiple lockfiles

* feat: prevent deletion of `node_modules`

* feat: skip checking on filtered install

* fix: accidentally dropping catalogs

* refactor: remove unnecessary `Promise.all`

* refactor: use `virtualStoreDir` from config

* refactor: split `opts` into `ctx` and `opts`

* test: fix

* style: fix eslint

* test: fix windows

* feat(exec): add `verifyDepsBeforeRun` to `exec`

* refactor: sync stat

* feat: stop ignoring filtered install

* test: filtered install

* refactor: rearrange imports

* feat: rename "packages list" to "workspace state"

* test: fix

* fix: workspace state on failed install
2024-11-15 01:01:09 +01:00
Jonathan Hefner
8c3de19fc1 fix(dlx): ENOENT when symlink=false (#8732) (#8733)
Prior to this commit, if `symlink` was set to `false` (such as in an RC
file), `dlx` would throw `ENOENT` because it expected the
`node_modules/the-package` symlink to exist:

  ```console
  $ pnpm config get symlink
  false

  $ rm -rf ~/.cache/pnpm/

  $ pnpm dlx the-package
  Packages: +1
  +
  Progress: resolved 1, reused 1, downloaded 0, added 1, done
   ENOENT  ENOENT: no such file or directory, open '/home/${USER}/.cache/pnpm/dlx/.../
                                                    node_modules/the-package/package.json'
  ```

This commit filters the `symlink` option before installing the package,
allowing the symlink to be created, preventing the error.

Fixes #8732.
2024-11-06 10:43:35 +01:00
btea
934f1836f1 fix: script command regular parameters do not support the v flag (#8711) 2024-11-03 21:32:40 +01:00
Zoltan Kochan
74c6dd3cca fix!: the test command should pass all args to the underlying script (#8619) 2024-10-09 01:36:00 +02:00
Zoltan Kochan
e9985b6f21 feat!: default value of virtual-store-dir-max-length set to 60 on Windows (#8556) 2024-09-23 09:30:45 +02:00
Zoltan Kochan
f10256d088 feat!: use SHA256 for creating cache keys for dlx (#8531) 2024-09-16 02:36:06 +02:00
Khải
9b4f73caaf chore(scripts): typecheck-only (#8395)
* chore(scripts): typecheck-only

* feat: change all configuration

* feat: include pnpm/ and pnpm/test/

* chore(deps): remove unused dependency

* refactor(typescript-only): use find-packages

* refactor(typescript-only): refactor paths

* fix: typescript-only

* fix: update compile-only

* fix: compile pnpm

* fix: windows

* fix: windows

* chore: meta-updater

* refactor(tsconfig): remove explicit composite

* fix: path in windows

* feat: don't depend on cwd

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2024-08-11 08:26:01 +02:00
Khải
5aa98b6d6f fix(dlx/cache): account for customized registries (#8299)
* fix(dlx/cache): account for customized registries

Different registries potentially return different packages for the same
name, so reusing dlx cache for packages from a different registry would
be incorrect.

* style: eslint

* refactor: dlx

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2024-07-13 17:06:14 +02:00
Khải
0ef168b77d feat: per-package node version (#8277)
close #6720
2024-07-13 14:08:57 +02:00
Zoltan Kochan
0406d4ad3d refactor: use a branded type for project root dir paths (#8272) 2024-07-04 13:13:34 +02:00
Zoltan Kochan
dd00eeb18c refactor: normalize dir field names across project objects (#8262) 2024-07-01 11:27:04 +02:00
Brandon Cheng
75a98e12b3 refactor: improve type checking when finding workspace packages (#8214)
---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2024-06-17 17:34:54 +02:00
Zoltan Kochan
13e55b2865 fix: a filtered install should update the lockfile first (#8183)
close #8165
2024-06-12 14:49:39 +02:00
Khải
271386f0a0 feat(exec): default reporterHidePrefix to true (#8176)
close #8174
2024-06-06 11:19:14 +02:00
Khải
bc0618cf19 feat(exec): log prefix (#8151)
close #8065
2024-06-03 01:25:21 +02:00
Brandon Cheng
c7e1b6fae8 chore: configure TypeScript project references for tests (#8128)
* refactor: store link values before converting to references

* fix: use .sort() without localeCompare

https://github.com/pnpm/pnpm/pull/8128#discussion_r1614031566

> Nit, but you probably just want to call sort without a comparison
> function; these are already strings and locale compare is not a good
> comparison for anything but human readable strings since it will
> differ on different people's machines based on their language setting.
> I've hit this too many times before for code gen.

* feat: configure meta-updater to write test/tsconfig.json files

* fix: relative imports for __typings__

* chore: `pnpm run meta-updater`

* fix: explicitly use test/tsconfig.json for ts-jest
2024-05-31 12:48:13 +02:00
Zoltan Kochan
9719a42d0e feat: configurable max length of directories inside node_modules/.pnpm (#7994)
close #7355
2024-04-28 11:07:29 +02:00
Brandon Cheng
bfadc0af12 fix: error when script-shell is configured to a .bat or .cmd file (#7945) 2024-04-18 17:34:15 +02:00
Khải
98566d95bc feat(dlx): cache (#7835)
close #5277

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2024-04-09 03:30:58 +02:00
Khải
984b976672 refactor: replace deprecated jest methods (#7840) 2024-03-29 00:03:58 +01:00
Zoltan Kochan
a5a3b995c1 test: use sync fs operations in tests (#7664) 2024-02-16 19:43:04 +01:00
Nacho Aldama
1a3449e940 feat: support node-options in .npmrc file (#7601)
сlose #7596
2024-02-01 13:21:03 +01:00
Zoltan Kochan
e7481629fe feat!: link-workspace-packages is false by default (#7485) 2024-01-08 11:57:44 +01:00
Brandon Cheng
a2f5f5c990 test: fix file system race conditions in tests by switching to an IPC server (#7472)
* test: create new @pnpm/test-ipc-server private util package

* test: use @pnpm/test-ipc-server for previously refactored tests

* test: use @pnpm/test-ipc-server for tests using json-append

* test: change how --no-bail is passed to avoid passing it to scripts

This test began failing after the conversion to use
`@pnpm/test-echo-server` since the `--no-bail` script was being passed
to scripts.

Changing how --no-bail is configured to fix this test.

* test: use @pnpm/test-ipc-server in exec/lifecycle fixture tests

* test: use @pnpm/test-ipc-server in pkg-manager/headless fixture tests

* test: use @pnpm/test-ipc-server in exec/prepare-package fixture tests

* test: switch pnpm test from json-append to @pnpm.e2e/hello-world-js-bin

* test: fix and re-enable 'rebuild multiple packages in correct order'

The pnpm-workspace.yaml file didn't contain all packages, causing:

```
2023-12-22T02:24:46.2277155Z FAIL test/recursive.ts
2023-12-22T02:24:46.2277881Z   ● rebuild multiple packages in correct order
2023-12-22T02:24:46.2278348Z
2023-12-22T02:24:46.2278734Z     expect(received).toStrictEqual(expected) // deep equality
2023-12-22T02:24:46.2279302Z
2023-12-22T02:24:46.2279517Z     - Expected  - 1
2023-12-22T02:24:46.2279932Z     + Received  + 0
2023-12-22T02:24:46.2280186Z
2023-12-22T02:24:46.2280791Z       Array [
2023-12-22T02:24:46.2281256Z         "project-1",
2023-12-22T02:24:46.2281733Z     -   "project-2",
2023-12-22T02:24:46.2282135Z       ]
2023-12-22T02:24:46.2282334Z
2023-12-22T02:24:46.2282475Z       216 |   }, [])
2023-12-22T02:24:46.2282870Z       217 |
2023-12-22T02:24:46.2283788Z     > 218 |   expect(server1.getMessages()).toStrictEqual(['project-1', 'project-2'])
2023-12-22T02:24:46.2284725Z           |                                 ^
2023-12-22T02:24:46.2285802Z       219 |   expect(server2.getMessages()).toStrictEqual(['project-1', 'project-3'])
2023-12-22T02:24:46.2286683Z       220 | })
2023-12-22T02:24:46.2287049Z       221 |
2023-12-22T02:24:46.2287269Z
2023-12-22T02:24:46.2287588Z       at Object.<anonymous> (test/recursive.ts:218:33)
```
2024-01-01 16:40:03 +01:00
Khải
1474bfd89a fix(run): stop passing flags as fallback command (#7370)
close #7244

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2023-12-06 19:53:32 +01:00
Brandon Cheng
6846e4c756 test: fix flaking --resume-from tests on windows (#7346) 2023-11-27 11:01:31 +01:00
Nacho Aldama
7d65d901ac fix: run dlx in the root of Windows drive (#7264)
close #7263
2023-10-31 23:00:23 +02:00
Nacho Aldama
43ce9e4a6a feat: add support to install different architectures (#7214)
close #5965

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2023-10-24 15:50:40 +03:00
Zoltan Kochan
d6592964f0 refactor: rootProjectManifestDir is a required option 2023-10-24 15:14:33 +03:00
Zoltan Kochan
733d612ad1 test: check spelling with cspell (#7229) 2023-10-20 15:58:27 +03:00
await-ovo
b962c27ae6 fix(plugin-commands-script-runner): allow create scoped package with preferred version (#7055)
close #7053
2023-09-05 18:20:19 +03:00
Khải
c5fbdb55c2 feat: friendlier error message when command not found (#6887)
---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2023-08-04 03:18:34 +03:00
Zoltan Kochan
b454bb07bf fix(dlx): should not print an error stack when dlx fails (#6883)
close #6698
2023-07-30 21:50:48 +03:00
Josh Goldberg ✨
ee429b300b feat: expanded missing command error, including 'did you mean' (#6496)
close #6492

Co-authored-by: Zoltan Kochan <z@kochan.io>
2023-05-15 03:22:26 +03:00
Zoltan Kochan
ee61ca4cb7 style: update eslint (#6236) 2023-03-18 14:57:29 +02:00
await-ovo
7d64d757bb fix: add report summary skipped status when script is missing (#6139) 2023-02-27 18:28:01 +02:00
await-ovo
0377d93678 feat: add --report-summary option for pnpm exec and pnpm run (#6098)
close #6008
2023-02-20 03:36:35 +02:00
Shinobu Hayashi
9ac6940442 feat: support to run multi script commands specified with regex selector (#5871) 2023-02-02 03:27:40 +02:00
Zoltan Kochan
583e3954be fix: remove suppressImplicitAnyIndexErrors from typescript settings (#5991) 2023-01-28 18:19:26 +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
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
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
await-ovo
b77651d14d feat: add pnpm.requiredScripts config (#5802)
close #5569

Co-authored-by: Zoltan Kochan <z@kochan.io>
2022-12-21 00:44:33 +02:00
Zoltan Kochan
aefb9f6f72 test: skip unreliable test on Windows 2022-12-10 16:12:29 +02:00
Zoltan Kochan
9cbe293876 refactor: put all non-public projects to directories that start with __ 2022-11-20 02:40:44 +02:00