Skip to content
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

Create 0002-no-caret-prerelease-installs.md #14

Merged
merged 4 commits into from
Jan 10, 2019
Merged

Conversation

hzoo
Copy link
Contributor

@hzoo hzoo commented Jul 6, 2018

Mentioned this to @zkat last month so figured I'd write something at least, (probably want the same in yarn actually if it lands)!

Rendered: https://github.com/hzoo/rfcs-1/blob/patch-2/0002-no-caret-prerelease-installs.md

Example gissues related to this:

There is a lot of confusion with prereleases in general (both from the package author and user side), so this doesn't prevent anyone from using ^ but it at least prevents people from accidentally adding it ^ given the default.

Might even suggest people get warned of keeping the ^ somehow but maybe that's too much.

Copy link
Contributor

@zkat zkat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate this RFC. I think prerelease versions have historically been a huge footgun and this seems to be a direction to go if we want to make it hurt a little less. I'm unclear about how it would interact with other parts of the system, what the escape hatches are, if any, and why you think this wouldn't be better served by a change in how semver specifies these, since that's ultimately the source of this pain. (Not that I think modifying semver is a better solution but I think exploring that idea and including the conclusion in this RFC would help immensely with context)


## Detailed Explanation

`npm install`, when writing to `package.json` (like with `--save` or `--save-dev`), should check with semver and only add the `^` if the version isn't a prerelease. I don't believe it should affect anything else.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do users opt into using ranges for prerelease, if they'd like to? This feature is currently controlled by the --save-prefix config, and this RFC makes no mention of how these changes will interact with that option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't know about that option, wasn't really sure what to put for this section actually!

@iarna
Copy link
Contributor

iarna commented Jul 6, 2018

As a consumer I would be quite surprised if you included breaking changes in a pre-release that wasn't a major version above the current non-prerelease? But you're right, nothing says in that case that you'd be wrong to break from pre-release to pre-release…

Something I'd like to figure out for this:

How many packages have pre-release range specifiers currently matching multiple versions? How many projects are expecting the current behavior?

@hzoo
Copy link
Contributor Author

hzoo commented Jul 6, 2018

TBH, I would be quite surprised if you included breaking changes in a pre-release that wasn't a major version above the current non-prerelease?

Yeah this is mostly in the case of Babel right now where the current latest is 6.x.

We are publishing 7.x as alpha, beta, etc and aren't done making breaking changes (not all of them are intentional but there are definitely some) but yet it doesn't stop anyone from trying to use it in their projects.

How many packages have pre-release range specifiers currently matching multiple versions? How many projects are expecting the current behavior?

Yeah, that's a good question! I think people would like it since you don't have to continually update but that assumes the non-breaking in-between pre-releases. I think many projects use pre-release as an opportunity to do breaking changes though.


Or hmm that's interesting! Maybe specifically for a new major release (so only for a 7.0.0-beta.1 vs. 7.1.0-beta.2)? So not sure if tying it specifically like that would be better then? For a major version, you might plan breaking changes in between while for a minor bump with a beta you might just want to wait a period for regressions?

Although I realize it's probably that we aren't using semver correctly and each breaking change should be a move from beta.1 to cxxx.0 instead of beta.1 to beta.2? I don't find a lot of projects doing this though, and there is some confusion there.

@ljharb
Copy link
Contributor

ljharb commented Jul 7, 2018

fwiw i do generally find it surprising when the prerelease line (alpha/beta/etc) has breaking changes inside the same line.

@hzoo
Copy link
Contributor Author

hzoo commented Jul 7, 2018

Yeah, I guess this is specifically for when doing a major bump and you just want to get some testing out there but clearly not stable yet. I think it's pretty common for breaking changes in alpha/beta, and sometimes RC for some projects.

Like see RxJS, others? I guess I don't see how a package author would do it otherwise if they are releasing and landing different kinds of changes before doing the final release?

Edit: looks like ^ with alpha also matches beta, rc as well so it would auto download it too.

screen shot 2018-07-08 at 11 02 34 pm

iarna
iarna previously requested changes Jul 24, 2018
Copy link
Contributor

@iarna iarna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some discussion @zkat and I are ok with this. This RFC will need an implementation section to land. I believe the implementation will be just the addition of another conditional to https://github.com/npm/cli/blob/latest/lib/install/deps.js#L303

Please note that the implementation section does not need an actual implementation, just a discussion of how it would be done.

@trusktr
Copy link

trusktr commented Aug 8, 2018

Something interesting might be something similar to semver after the beta:

7.0.0-beta.1.0
7.0.0-beta.1.1
7.0.0-beta.1.2
7.0.0-beta.2.0 <-- breaking change
7.0.0-beta.2.1

@zkat
Copy link
Contributor

zkat commented Dec 20, 2018

@hzoo hey Henry, just a heads-up that this is ready to land, but we need a small implementation section in order to ratify it. Let us know when that happens! Thanks for your time and patience :)

@hzoo
Copy link
Contributor Author

hzoo commented Dec 21, 2018

Oops never got around to doing it, should of been easy since @iarna already pointed it out!! Ok something like that @zkat? Thanks for the ping too

@zkat zkat dismissed iarna’s stale review January 10, 2019 21:38

everything's been ratified!

Copy link
Contributor

@zkat zkat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the implementation section, @hzoo! The team just met and decided we're ready to ratify this. Thanks again for sending this RFC our way and I hope the implementation makes you and yours lives easier! 🎉

@zkat zkat merged commit 7f6e9ff into npm:latest Jan 10, 2019
@zkat zkat added the :ratified label Jan 10, 2019
```diff
"devDependencies": {
- "@babel/register": "^7.0.0-beta.52"
+ "@babel/register": "7.0.0-beta.52"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit odd that it says @babel/register here when it's @babel/core in the install command above 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol good point, feel free to PR or I can later

Copy link
Contributor

@SimenB SimenB Jan 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do, simple enough. Just wasn't sure if it was worth a PR

EDIT: #31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants