corepack icon indicating copy to clipboard operation
corepack copied to clipboard

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

Open KSXGitHub opened this issue 1 year ago • 5 comments

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

KSXGitHub avatar Feb 28 '24 17:02 KSXGitHub

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

aduh95 avatar Feb 28 '24 21:02 aduh95

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.

merceyz avatar Feb 28 '24 22:02 merceyz

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 avatar Feb 29 '24 06:02 KSXGitHub

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.

KSXGitHub avatar Feb 29 '24 06:02 KSXGitHub

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.

arcanis avatar Feb 29 '24 06:02 arcanis