-
Notifications
You must be signed in to change notification settings - Fork 173
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
Use the package manager version specified by the project, but still allow other package manager invocations #195
Comments
Agreed, that is how I expected it to work. This seems like a bug. |
The original name for the env variable was something like That being said, I agree that your use case seems valid, and Corepack should default to make it work, or at least provide a way to make it work. Slightly off-topic, but in PHP land, you can use |
Yep, I also thought that There's probably still time to change it since we're experimental, especially since the current behaviour isn't obvious.
In Yarn you can use Unfortunately afaik only Yarn implements it (we didn't advertise it much, to be fair). |
We've hit this issue too. In our case, a package we rely on has an {
"install": "restore-from-cache || npm run rebuild",
} We want to use Corepack to help engineers and tooling use the right package manager and version to interact with the repo, but checking invocations by packages feels too strict. Ideally, packages would be able to use "run" or "corepack run" instead (#57), but that could take a long time to filter through the ecosystem. We don't want to have our engineers set |
Open an issue on their repo asking them to consider using |
|
Isn't the "right" package manager for a package with scripts referencing npm, npm? |
The right package manager is always the one managing the whole project. Hardcoding one is always a bad idea, because it runs afoul of the settings define for the project (for example |
The script can already ignore any settings set by the outer project by passing NPM_CONFIG_ env vars to another |
There isn't a "correct" solution here if we want to maintain the Options:
Of these, Option 2 seems like it may be a good pragmatic balance. Anything that requires behavior change is likely to prevent adoption. |
@nathanhammond would you like to send a PR? That seems like a reasonable approach to me. |
If I'm reading the suggestion correctly then I disagree, disabling the check defeats one of the "goals" of Corepack.
|
@merceyz I'm not attached to anything and I specifically note:
The reality is that You're proposing we remain ecosystem incompatible which is a fine choice, but ensures that adoption of In general: we collectively wrote the guidelines you cite, and we can always change them to improve the experience of using |
@aduh95 this is well outside the scope of work I should be focusing on right now (you may have seen my team's big announcement yesterday) so I won't have any opportunity to get to this. |
At time of writing, at 0.14.0 there is
COREPACK_ENABLE_STRICT=0
, which disables this check completely and will always use the fallback version of package managers. However, there should be a middle ground, to use the package manager version specified by the project, but does not throw error when other package manager is invoked.Use case example:
With the default configuration of Corepack, I cannot bootstrap the project at all, i.e. I cannot successfully run
pnpm install
. This is because invocation of yarn inside that repo will fail due to "Usage error", i.e. #157)However, with
COREPACK_ENABLE_STRICT=0
, I still cannot bootstrap the project as expected, because nowpnpm install
will use the fallback/global pnpm (7.13.4) instead of the version specified by the repo (6.33.0)Proposal:
When I set
COREPACK_ENABLE_STRICT=0
pnpm
in that project should still use the version specified by the repo (6.33.0) instead of the fallback/global version.yarn
in that project should use the global/fallback versionWhat do you think?
The text was updated successfully, but these errors were encountered: