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

Support packageManager field in package.json and provide the requested version automatically #871

Open
dominikg opened this issue Oct 22, 2022 · 10 comments
Labels

Comments

@dominikg
Copy link

Is your feature request related to a problem? Please describe:
After updating pnpm and the engine restriction in a repository, it may no longer be compatible with webcontainers version of pnpm
see #861

Describe the solution you'd like:
Support the packageManager field in package.json similarly to corepack.

Describe alternatives you've considered:
Use a more relaxed engine constraint and live with the fact that webcontainers use a different version of pnpm

Additional context:
https://nodejs.org/api/packages.html#packagemanager
https://nodejs.org/api/corepack.html

Running corepack inside webcontainer might not be feasible, but you can do it without by simply parsing packageManager and fetching the version from npm registry as well:
https://github.com/sveltejs/vite-plugin-svelte/blob/74fd16db25d0be6c624e3d7e77b170ff7afb34ed/.github/workflows/ci.yml#L46-L48

request extracted from this comment: #861 (comment)

@d3lm d3lm added the tracked label Mar 10, 2023
@d3lm
Copy link

d3lm commented Mar 10, 2023

Thanks for the report!

Yea this is currently a limitations as we only support one version of pnpm right now. I'd be ideal if we supported the packageManager field indeed. I ll take this with me and discuss this with the team.

@d3lm
Copy link

d3lm commented Mar 10, 2023

My suggestion for the time being would be to not use strict engine checks.

@dominikg
Copy link
Author

vite-plugin-svelte stopped bumping the engine constraint with renovate, so for that repo it isn't time sensitive right now. However with the upcomping pnpm 8 and it's breaking changes, it would be great if webcontainers detected and supported it to avoid inconsistencies between locally used pnpm@8 and pnpm@7 inside webcontainers.

at the very least you would have to bump pnpm@7 to 7.24 or later so that it can understand the new lockfile format v6, otherwise projects that switched to the new format might be incompatible.

@dominikg
Copy link
Author

fyi,
pnpm@8 has been released today https://github.com/pnpm/pnpm/releases/tag/v8.0.0

projects using pnpm8 are going to use lockfile format v6 by default which is not supported by the current pnpm version deployed on stackblitz webcontainers

~/projects/vitejs-vite-njsrpa 1m 9s
❯ pnpm -v
7.13.6

@d3lm
Copy link

d3lm commented Mar 28, 2023

Thanks for putting this on our radar. I have seen the changes in pnpm and we definitely need to update to the latest version so both versions of the lock file are supported and that newer projects don't break.

@dominikg
Copy link
Author

If you can't support 8 right away, going up to 7.24 might help to support the new lockfile format at least.

@d3lm
Copy link

d3lm commented Mar 29, 2023

Yep, I think we may be able to support 8. The problem will still be the exact version from the packageManager field when using strict engine checks.

@Shinigami92
Copy link

@d3lm what is the progress of pnpm v7.24 / v8 bump?
Vite is now waiting on this to bump its pnpm to v8.
So as soon as Stackblitz's Webcontainer supports it, we will merge the PR in Vite.

@d3lm
Copy link

d3lm commented Apr 12, 2023

@Shinigami92 Thanks for the info. The plan is to update soon-ish and I will let you know once it's on prod.

@d3lm
Copy link

d3lm commented Apr 12, 2023

Hey all, just wanted to give an update and say that pnpm 8.2.0 is now rolled out to production. We don't support the packageManager yet but at least pnpm is upgraded and it should now support both lockfile versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants