nodejs / corepack

Zero-runtime-dependency package acting as bridge between Node projects and their package managers
MIT License
2.31k stars 146 forks source link

Add `corepack pnpm` and `corepack yarn` to `corepack --help` #412

Open KSXGitHub opened 4 months ago

KSXGitHub commented 4 months ago

I didn't know this was possible because corepack --help doesn't mention it.

aduh95 commented 4 months ago

Can you clarify what's missing today? corepack pnpm install should already do what you expect it to do, no?

merceyz commented 4 months ago

Why do you have enable/disable Corepack based on the project? If packageManager isn't specified Corepack will use the global version, whatever that is set to.

KSXGitHub commented 4 months ago

I just assumed it doesn't work because corepack --help doesn't mention it. Now this is more of a documentation issue. I will change the issue title

KSXGitHub commented 4 months ago

Can you clarify what's missing today? corepack pnpm install should already do what you expect it to do, no?

Actually, there's one thing that is missing: PATH.

The scripts in package.json will sometimes invoke pnpm or yarn, but since corepack didn't set PATH, they will invoke the wrong versions. I know this because corepack pnpm exec which pnpm doesn't return the right pnpm.

arcanis commented 4 months ago

I think that's something you should bring up to pnpm - in the case of Yarn it isn't a problem because Yarn already adds itself to the PATH, Corepack or not, precisely for this reason.