-
Notifications
You must be signed in to change notification settings - Fork 20
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
Don't coerce version strings to semver, quote package names #126
Conversation
// Take each version in the range and find the maxSatisfying | ||
const rangeSplit = version | ||
.split(" ") | ||
.map(v => coerce(v)) |
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.
it does seem important to still check range validity here? altho then i suppose dist-tags like “next” wouldn’t work.
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.
If the range is invalid wouldn't that be a bug in the other package? Do you know how NPM handles invalid ranges here?
Based on the package.json docs on the NPM website, simply taking the last element of the range should work.
Related PR: #4
Thanks for reviewing so fast and sorry for the messy diff — I think my prettier extension settings have changed since I first started writing this package. Force-pushed without the formatting so it's hopefully easier to read.
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.
Yeah i think it makes the most sense to just let the package manager handle it.
3d3ee0b
to
fa0b30e
Compare
Sure, @uebriges and I can test today with |
Yep, looks good! 🚀 $ git clone https://github.com/nathanhleung/install-peerdeps.git
$ cd install-peerdeps
$ git checkout nathanhleung-version-fix
$ yarn
$ yarn build && node . --yarn --dev eslint-config-react-app --dry-run
yarn run v1.22.5
$ npm run clean
> install-peerdeps@3.0.1 clean
> rimraf lib
$ babel src --out-dir lib --ignore *.test.js
Successfully compiled 9 files with Babel (1444ms).
✨ Done in 3.34s.
install-peerdeps v3.0.1
This command would have been run to install eslint-config-react-app@latest:
yarn add eslint-config-react-app@6.0.0 @typescript-eslint/eslint-plugin@^4.0.0 @typescript-eslint/parser@^4.0.0 babel-eslint@^10.0.0 eslint@^7.5.0 eslint-plugin-flowtype@^5.2.0 eslint-plugin-import@^2.22.0 eslint-plugin-jest@^24.0.0 eslint-plugin-jsx-a11y@^6.3.1 eslint-plugin-react@^7.20.3 eslint-plugin-react-hooks@^4.0.8 eslint-plugin-testing-library@^3.9.0 --dev |
Perfect, thanks! |
@karlhorky I just published and it looks like I'm getting an error. Can you try running |
Reverted the change that added quotes around the package name for now and published a new version, 3.0.3 that is working on my end. However, the version that wasn't working for me is still up as version 3.0.2. |
Ah sorry! 🙈 I saw that you were using We'll try to do the full workflow with |
|
|
Ran on Windows 10 too: same result.
|
Thanks for testing all this for me! Reopening #64. |
Ah seems like this solution for version ranges doesn't work after all (installing the You can see this with this example dependency:
|
Hi @valeriirivne, thanks for the report. For now, can you try copying the npm install command that was outputted? (copy the log line that starts with |
Hi, @nathanhleung , do you mean the output after I run the command npm install? |
I think Nathan means the line in the first screenshot you posted, the line that starts with |
Sorry, npx install-peerdeps --dev eslint-config-wesbos. I took it from here https://github.com/wesbos/eslint-config-wesbos --- "Local / Per Project Install". I do exactly like is written there, but this bug doesn't allow me to load that dependency. Can somebody help me how can I solve that issue? Thanks |
@valeriirivne are you perhaps using npm 7, and perhaps you have a peer dep incompatibility? |
@ljharb yes, npm7. Please, give a hint, how can I solve that issue and install this dependenicies? Thank you |
It’s not related to this project - it means you already have a version of eslint, or one of those eslint plugins, that’s installed or required as a peer dep by another package, and they’re incompatible. upgrade to npm v7.5.4, and try installing the deps manually with npm, and it might give you more info. |
@ljharb Thanks for reply. I will try like you said. |
install-peerdeps
uses thesemver
package to coerce peerdep versions specified inpackage.json
to specific, "valid"/literal versions of the formx.y.z
to generate the peer dependency install command. However, this coercion means that a version specified as^7
inpeerDependencies
is coerced to7.0.0
, which might not necessarily exist.Instead, we should just use the version directly specified in
package.json
. Resolves #71.Also started quoting package names to resolve #64
Previous Behavior
New Behavior
@karlhorky could you test this branch?
@ljharb should this change be classified as a bugfix (bump semver patch version)? it changes prior behavior but should result in more flexibility rather than less (i.e. the install command will install
@^7
etc rather than@7.0.0
)