-
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
Allow packageManager to be specified by name alone #300
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows omitting the version from the package.json
packageManager
field as well which it shouldn't do.
And for |
Hmm... I thought that was enforced in |
@arcanis I left that out of scope on purpose. I can't figure out the intended behavior so I punted. At the very least it seems like But here's what it is right now:
Heck, even https://www.npmjs.com/package/yarn and https://yarnpkg.com/package?q=yarn&name=yarn don't acknowledge any version of yarn exists past 2.4.3, so how should a user know what a valid version specifier is? Yarn is a wonderful project but the critical user story of "how should I install it, and what version should I use?" is a dumpster fire. I am of the opinion that the yarn cli needs to provide its own backwards compatibility affordances, not require other tools to implement special rules. |
Yeah, I think it's fine to keep it as a follow-up. I have another idea to make this process a little less magic, I'll handle that.
Because you're looking at the npm package, and Yarn hasn't been distributed on npm for the past couple of years. So yeah, the version you're seeing there is outdated. The proper list of versions is here: https://repo.yarnpkg.com/tags |
That's awesome documentation and makes a lot of sense! The npm page and yarn page are the de facto storefront for a javascript package, and even if they aren't the place releases happen, they need guidance in the readmes (even if those instructions start with "Don't install this version and don't install with npm" and a link to the recommendations for how to get started with yarn). The npm page has also been confusing because the "berry" dist-tag implies that "berry" is the name for major version 2, but the active development repo is also called "berry" and has releases for major versions 2, 3, and 4. I have definitely been turned off (perhaps unfairly) from trying yarn in the past by these sorts of issues! |
@merceyz Why not? Please see my latest commit, which is how I feel it should work, somewhat like |
Note that |
That command would set the |
That's my understanding too - I feel like I don't understand your point. I'm picturing the user specifying a value loosely with
What's the use case you're envisioning here which, after this PR, would create a non-reproducible build? |
@merceyz updated the tests. I think this clarifies how I expect this to work, basically like EDIT: I'm having second thoughts about this. Maybe the right thing to do is to allow a specifier. A reproducible build will always rely on developer choices. Like committing the lockfile or pnp files, using a particular version of the node runtime, using deterministic build steps, and setting package manager options like |
`corepack use` makes it easy to lock down a specific version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why shouldn't we trust them? It might be more important to the user to have bug fixes than to have reproducibility, especially for nascent package managers like bun.
The current model is to favour good practices, in particular reproducibility. It's a major point of Corepack, otherwise you can just npm install whatever package manager you want and that's it, no need for Corepack.
I agree with @merceyz on this - adding support for loose specifiers is fine on the CLI commands (because they only matter at the time the commands are run), but allowing them in the packageManager
field is a different story that should be evaluated in its own PR (and I'll push back on it for the reasons described above).
Good practice is, when reproducibility is key, to track the full version with hash, which is exactly what Even without this restriction, corepack is necessary because:
That's going to wind up with those CLI commands in build scripts and commit hooks. The whole idea behind a human-editable @arcanis and @merceyz, would you be happy with instead reifying the version on |
Not sure what you mean by that - as far as I can tell from the tests you link, this still lets you write a range in the Essentially, I believe this PR is conflating two different things (ranges in the CLI, and ranges in the project definition), and I'm against using the merits of the first request (which has consensus) to land the second (which hasn't). |
Yes. In that revision of the PR, this lets you write a range in the
Yes, in fixing the first, I realized how arbitrary and unwieldy the second one is and what it would take to fix. The feedback on #18 and #95 seems clear consensus that having something So @arcanis and @merceyz, what do you think the developer's EXPECTATION is if they have written an imprecise version (or none at all) into package.json? |
name
asname@*
when specifying package manager forcorepack use
et al. Fixes Corepack use should allow omitting version #298.package.json#packageManager
.corepack use
makes it easy to specify an exact version, but disallowing version specifiers is more confusing than helpful. Fixes Support for semver ranges? #95.