You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, there's no standardized way to install dependencies for projects using different package managers without prior knowledge of the specific manager used. This can complicate CI/CD pipelines, development scripts, and workflows for developers working across multiple projects.
It would be nice to be able to write a script that will do npm install / pnpm install / yarn install on arbitrary packages, without having to know in advance what their packageManager field says.
Proposal - a --project parameter added to the install command:
corepack install --project
This would change install to install the project/node_modules rather than the package manager itself. (Or could be a separate command or something).
For a project with "packageManager": "[email protected]" the corepack install --project command would be equivalent to running
corepack enable
pnpm install
(called via a subshell)
Or for a project with "packageManager": "[email protected]" this would be equivalent to
corepack enable
npm install
Similar for yarn, etc.
Benefits
Simplifies shared code for CI/CD pipelines like GitHub Actions
Reduces boilerplate in build scripts
Improves developer experience when working with multiple projects
Other notes:
could/should probably have a fallback behaviour when no packageManager is present, of using npm, or looking for lockfiles, or just erroring
potential follow-on: allow passing extra args after a -- like corepack install --project -- --no-frozend-lockfile (though this would no longer really be generic across package managers I guess)
potential follow-on: similar install-package functionality like corepack add left-pad
Not sure if this has been asked before but I couldn't find it in the issues.
The text was updated successfully, but these errors were encountered:
Worth noting that corepack up does run <pkg-manager> install, so IMO it wouldn't be inconsistent to have a command that would do the same thing without updating the version of the package manager.
I like that. Maybe project itself could be a command, and install/add/remove subcommands, since corepack --project install would now be a pretty different thing from corepack install. corepack project x reads a bit nicer, and makes clear that you're scoping down what you're doing to the project-level.
Currently, there's no standardized way to install dependencies for projects using different package managers without prior knowledge of the specific manager used. This can complicate CI/CD pipelines, development scripts, and workflows for developers working across multiple projects.
It would be nice to be able to write a script that will do
npm install
/pnpm install
/yarn install
on arbitrary packages, without having to know in advance what theirpackageManager
field says.Proposal - a
--project
parameter added to theinstall
command:This would change
install
to install the project/node_modules rather than the package manager itself. (Or could be a separate command or something).For a project with
"packageManager": "[email protected]"
thecorepack install --project
command would be equivalent to running(called via a subshell)
Or for a project with
"packageManager": "[email protected]"
this would be equivalent toSimilar for yarn, etc.
Benefits
Other notes:
packageManager
is present, of usingnpm
, or looking for lockfiles, or just erroring--
likecorepack install --project -- --no-frozend-lockfile
(though this would no longer really be generic across package managers I guess)corepack add left-pad
Not sure if this has been asked before but I couldn't find it in the issues.
The text was updated successfully, but these errors were encountered: