Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: specify pnpm version in package.json #1016

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mikavilpas
Copy link
Contributor

Problem

It's possible to use a different version of pnpm than the one that is used in CI. This can lead to inconsistencies between the local development environment and the CI environment.

Solution

Specify the version of pnpm that is used in the engines field of package.json.

This results in an error message similar to the following when a different version of pnpm is used:

$ corepack prepare pnpm@latest --activate
$ pnpm i
 ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)

Your pnpm version is incompatible with "/Users/mikavilpas/git/openapi-ts".

Expected version: 8.15.7
Got: 9.9.0

This is happening because the package's manifest has an engines.pnpm field specified.
To fix this issue, install the required pnpm version globally.

To install the latest version of pnpm, run "pnpm i -g pnpm".
To check your pnpm version, run "pnpm -v".

$ corepack prepare [email protected] --activate

Problem
=

It's possible to use a different version of pnpm than the one that is
used in CI. This can lead to inconsistencies between the local
development environment and the CI environment.

Solution
=

Specify the version of pnpm that is used in the `engines` field of
`package.json`.

This results in an error message similar to the following when a
different version of pnpm is used:

```sh
$ corepack prepare pnpm@latest --activate
$ pnpm i
 ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)

Your pnpm version is incompatible with "/Users/mikavilpas/git/openapi-ts".

Expected version: 8.15.7
Got: 9.9.0

This is happening because the package's manifest has an engines.pnpm field specified.
To fix this issue, install the required pnpm version globally.

To install the latest version of pnpm, run "pnpm i -g pnpm".
To check your pnpm version, run "pnpm -v".

$ corepack prepare [email protected] --activate
```
Copy link

stackblitz bot commented Sep 5, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

changeset-bot bot commented Sep 5, 2024

⚠️ No Changeset found

Latest commit: f5a3339

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Sep 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hey-api-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 5, 2024 11:51am

@mikavilpas
Copy link
Contributor Author

Note that it may make sense to also upgrade the version in these places instead as there seem to be some errors

.github/workflows/ci.yml|27 col 20| version: 8.15.7
.github/workflows/release.yml|26 col 20| version: 8.15.7
.github/workflows/coverage.yml|26 col 20| version: 8.15.7

@mikavilpas
Copy link
Contributor Author

I forgot to attach the docs. They can be found here https://pnpm.io/package_json

pnpm-lock.yaml Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there changes in the lock file? Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be happening if my environment is somehow different... Are you using pnpm version 8.15.7 or something else?

I also get this extra output so maybe my environment is missing some step 🤔

Details

  ~/git/openapi-ts   specify-pnpm-version $✘   v20.10.0  󱑎 14:45 
$ pnpm i
Scope: all 11 workspace projects
 WARN  7 deprecated subdependencies found: @humanwhocodes/[email protected], @humanwhocodes/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Already up to date
Progress: resolved 1572, reused 1491, downloaded 0, added 0, done
. prepare$ husky
└─ Done in 238ms
.../openapi-ts-tanstack-svelte-query prepare$ svelte-kit sync
└─ Done in 667ms
 WARN  Issues with peer dependencies found
.
├─┬ @typescript-eslint/eslint-plugin 7.15.0
│ ├── ✕ unmet peer eslint@^8.56.0: found 9.6.0
│ └─┬ @typescript-eslint/type-utils 7.15.0
│   ├── ✕ unmet peer eslint@^8.56.0: found 9.6.0
│   └─┬ @typescript-eslint/utils 7.15.0
│     └── ✕ unmet peer eslint@^8.56.0: found 9.6.0
├─┬ eslint-plugin-typescript-sort-keys 3.2.0
│ ├── ✕ unmet peer eslint@"^7 || ^8": found 9.6.0
│ └─┬ @typescript-eslint/experimental-utils 5.62.0
│   ├── ✕ unmet peer eslint@"^6.0.0 || ^7.0.0 || ^8.0.0": found 9.6.0
│   └─┬ @typescript-eslint/utils 5.62.0
│     └── ✕ unmet peer eslint@"^6.0.0 || ^7.0.0 || ^8.0.0": found 9.6.0
├─┬ eslint-plugin-vue 9.23.0
│ └── ✕ unmet peer eslint@"^6.2.0 || ^7.0.0 || ^8.0.0": found 9.6.0
└─┬ typescript-eslint 7.15.0
  ├── ✕ unmet peer eslint@^8.56.0: found 9.6.0
  ├─┬ @typescript-eslint/eslint-plugin 7.15.0
  │ └── ✕ unmet peer eslint@^8.56.0: found 9.6.0
  └─┬ @typescript-eslint/parser 7.15.0
    └── ✕ unmet peer eslint@^8.56.0: found 9.6.0

examples/openapi-ts-axios
├─┬ @typescript-eslint/eslint-plugin 7.15.0
│ ├── ✕ unmet peer eslint@^8.56.0: found 9.6.0
│ └─┬ @typescript-eslint/type-utils 7.15.0
│   ├── ✕ unmet peer eslint@^8.56.0: found 9.6.0
│   └─┬ @typescript-eslint/utils 7.15.0
│     └── ✕ unmet peer eslint@^8.56.0: found 9.6.0
├─┬ @typescript-eslint/parser 7.15.0
│ └── ✕ unmet peer eslint@^8.56.0: found 9.6.0
└─┬ eslint-plugin-react-hooks 4.6.2
  └── ✕ unmet peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0": found 9.6.0

examples/openapi-ts-fetch
├─┬ @typescript-eslint/eslint-plugin 7.15.0
│ ├── ✕ unmet peer eslint@^8.56.0: found 9.6.0
│ └─┬ @typescript-eslint/type-utils 7.15.0
│   ├── ✕ unmet peer eslint@^8.56.0: found 9.6.0
│   └─┬ @typescript-eslint/utils 7.15.0
│     └── ✕ unmet peer eslint@^8.56.0: found 9.6.0
├─┬ @typescript-eslint/parser 7.15.0
│ └── ✕ unmet peer eslint@^8.56.0: found 9.6.0
└─┬ eslint-plugin-react-hooks 4.6.2
  └── ✕ unmet peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0": found 9.6.0

examples/openapi-ts-tanstack-react-query
├─┬ @typescript-eslint/eslint-plugin 7.15.0
│ ├── ✕ unmet peer eslint@^8.56.0: found 9.6.0
│ └─┬ @typescript-eslint/type-utils 7.15.0
│   ├── ✕ unmet peer eslint@^8.56.0: found 9.6.0
│   └─┬ @typescript-eslint/utils 7.15.0
│     └── ✕ unmet peer eslint@^8.56.0: found 9.6.0
├─┬ @typescript-eslint/parser 7.15.0
│ └── ✕ unmet peer eslint@^8.56.0: found 9.6.0
└─┬ eslint-plugin-react-hooks 4.6.2
  └── ✕ unmet peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0": found 9.6.0

examples/openapi-ts-tanstack-vue-query
└─┬ @vue/eslint-config-typescript 13.0.0
  ├── ✕ unmet peer eslint@^8.56.0: found 9.6.0
  ├─┬ @typescript-eslint/eslint-plugin 7.15.0
  │ ├── ✕ unmet peer eslint@^8.56.0: found 9.6.0
  │ └─┬ @typescript-eslint/type-utils 7.15.0
  │   ├── ✕ unmet peer eslint@^8.56.0: found 9.6.0
  │   └─┬ @typescript-eslint/utils 7.15.0
  │     └── ✕ unmet peer eslint@^8.56.0: found 9.6.0
  └─┬ @typescript-eslint/parser 7.15.0
    └── ✕ unmet peer eslint@^8.56.0: found 9.6.0

packages/openapi-ts
├─┬ @angular-devkit/build-angular 17.3.7
│ ├── ✕ unmet peer typescript@">=5.2 <5.5": found 5.5.3
│ └─┬ @ngtools/webpack 17.3.7
│   └── ✕ unmet peer typescript@">=5.2 <5.5": found 5.5.3
└─┬ @angular/compiler-cli 17.3.9
  └── ✕ unmet peer typescript@">=5.2 <5.5": found 5.5.3

Done in 3.8s

package.json Outdated
@@ -31,7 +31,8 @@
"typecheck": "pnpm --recursive typecheck"
},
"engines": {
"node": "^18.0.0 || >=20.0.0"
"node": "^18.0.0 || >=20.0.0",
"pnpm": "8.15.7"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this should also be a range?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to >=8 <9 which should allow for some leeway.

@mrlubos
Copy link
Member

mrlubos commented Sep 5, 2024

Note that it may make sense to also upgrade the version in these places instead as there seem to be some errors

.github/workflows/ci.yml|27 col 20| version: 8.15.7

.github/workflows/release.yml|26 col 20| version: 8.15.7

.github/workflows/coverage.yml|26 col 20| version: 8.15.7

Yeah we definitely want the build to pass. Here's the error message in case you can't see it

Using package.json#engines.pnpm without corepack and package.json#packageManager could lead to failed builds with ERR_PNPM_UNSUPPORTED_ENGINE. Learn more: https://vercel.com/docs/errors/error-list#pnpm-engine-unsupported
 ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)

Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.19%. Comparing base (386da70) to head (49b1cbf).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1016   +/-   ##
=======================================
  Coverage   76.19%   76.19%           
=======================================
  Files          89       89           
  Lines       10973    10973           
  Branches     1113     1113           
=======================================
  Hits         8361     8361           
  Misses       2605     2605           
  Partials        7        7           
Flag Coverage Δ
unittests 76.19% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

pkg-pr-new bot commented Sep 5, 2024

Open in Stackblitz

pnpm add https://pkg.pr.new/@hey-api/client-axios@1016
pnpm add https://pkg.pr.new/@hey-api/client-fetch@1016
pnpm add https://pkg.pr.new/@hey-api/openapi-ts@1016

commit: 49b1cbf

Following the instructions in
https://vercel.com/docs/errors/error-list#pnpm-engine-unsupported

It should fix the error:

```text
Using package.json#engines.pnpm without corepack and package.json#packageManager could lead to failed builds with ERR_PNPM_UNSUPPORTED_ENGINE. Learn more: https://vercel.com/docs/errors/error-list#pnpm-engine-unsupported
 ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)
```
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants