Open ruscon opened 5 months ago
This sounds like it should be implemented in pnpm
and not corepack
@styfle Perhaps, but I don’t know how corepack works under the hood. Most likely some kind of layer is needed for interaction between corepack and a package manager, so that the package manager itself updates its lock file?
Have you considered setting a packageManager
in your package.json
? That way, Corepack would pick up the correct version when run inside the container. I'm not sure I understand why package.json
couldn't be the "lock file" in this case.
@aduh95 The question is related to how the docker
cache and pnpm fetch
work.
pnpm fetch
and npm ci
can be run without a package.json
file, which helps cache the installation of npm packages inside the docker image even if you make changes to the package.json
file.
I see, pardon my ignorance, I should have read the docs. From what I can see, pnpm docs recommend downloading a specific version of pnpm with cURL globally. The equivalent with corepack would be to run corepack install -g pnpm@8.x
. So IIUC, what you're requesting would be to have a way to skip the command and have pnpm fetch
select the correct version. I don't know enough pnpm internals to tell how easy/hard that would be to implement, but I agree that would require changes on pnpm side – so that package.json
it generates contains the correct "packageManager"
field.
Our current flow: We use
docker
+pnpm fetch
This means we don't cache the
package.json
file before thepnpm fetch
execution. This allows us to worry aboutpackage.json
changes. But corepack will always install the latest version ofpnpm
instead of a specific one.If store the
packageManager
property in a lock file, this will solve the problem.