Skip to content

Conversation

@vmx
Copy link
Member

@vmx vmx commented Apr 29, 2019

In npm caret (^) and tilde (~) have the same meaning for versions
1.0.0 < x <= 0.1.0. Hence we can allow carat to be used for such
versions.

If you run npm install <some-packages> it automatically uses
caret for such versions. Hence you would need to manually update
your package.json to make it pass out linting. With this change
that's no longer needed.

Fixes #346.

@vmx vmx requested a review from achingbrain April 29, 2019 16:02
@ghost ghost assigned vmx Apr 29, 2019
@ghost ghost added the status/in-progress In progress label Apr 29, 2019
@vmx vmx force-pushed the less-strict-version-linting branch from d4ec946 to ad268ef Compare April 29, 2019 16:02
@vmx vmx changed the title fix: allow development version to use caret fix: allow development versions to use caret Apr 29, 2019
Copy link
Member

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

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

LGTM - just a minor suggestion

@hugomrdias
Copy link
Member

why not just remove all that logic and default to what npm does ?

@vmx
Copy link
Member Author

vmx commented May 2, 2019

@hugomrdias I guess because npm would ping specific version (and not ranges) for 0.0.x versions. If you use ~ instead you would also get other versions and e.g. #357 wouldn't have been needed if bundle-size would automatically use 0.0.3 instead of 0.0.1 of brotli-size.

In npm caret (^) and tilde (~) have the same meaning for versions
1.0.0 < x <= 0.1.0. Hence we can allow carat to be used for such
versions.

If you run `npm install <some-packages>` it automatically uses
caret for such versions. Hence you would need to manually update
your package.json to make it pass out linting. With this change
that's no longer needed.

Fixes #346.
@vmx vmx force-pushed the less-strict-version-linting branch from 22f35b6 to 7ec4b52 Compare May 2, 2019 21:26
@hugomrdias
Copy link
Member

Npm uses ^ as the default save-prefix which does basically the same as the logic we have now

@vmx
Copy link
Member Author

vmx commented May 2, 2019

Nope:

$ echo '{}' > package.json
$ npm install brotli-size

$ cat package.json
{
  "dependencies": {
    "brotli-size": "0.0.3"
  }
}

@hugomrdias
Copy link
Member

hugomrdias commented May 2, 2019

Sneaky bastards 🙃 but that actually doesn't seem that bad, packages in 0.0.x are kinda random with semver

@hugomrdias hugomrdias merged commit 4a50e11 into master May 3, 2019
@hugomrdias hugomrdias deleted the less-strict-version-linting branch May 3, 2019 09:10
@ghost ghost removed the status/in-progress In progress label May 3, 2019
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.

Use ^ for pre-1.0.0 deps

4 participants