-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
fix(resolution): use registry latest if it satisfies requested semver range #4804
fix(resolution): use registry latest if it satisfies requested semver range #4804
Conversation
… range Fixes yarnpkg#3560 **Summary** Mimic behavior in NPM; use the `latest` version in registry if it satisfies the semver range requests. Otherwise fallback to `semver.maxSatisfying()` **Test Plan** Added unit test to verify behavior.
This change will increase the build size from 9.94 MB to 9.94 MB, an increase of 554 bytes (0%)
|
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.
LGTM
__tests__/commands/add.js
Outdated
@@ -986,3 +986,42 @@ test.concurrent('preserves unaffected bin links after adding to workspace packag | |||
expect(await fs.exists(`${config.cwd}/packages/workspace-2/node_modules/.bin/workspace-1`)).toEqual(true); | |||
}); | |||
}); | |||
|
|||
test.concurrent('installs "latest" instead of maxSatisfying if it satisfies requested pattern', (): Promise<void> => { | |||
/* eslint-disable */ |
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.
Can you just disable the relevant warning with /* eslint-disable rule-name */
instead of a blanket disable statement in case the enable part goes away?
Or ideally, we wouldn't need this at all since you can use https://git.io/ to get short GitHub URLs ;)
…one (#4797) * fix(info): Use version from `latest` dist-tag instead of the highest one Fixes #3947. By default, package `version` was set by sorting all the versions and getting the highest one. Now it's provided via package `latest` dist-tag. * Fix linter issues by shortening the test description * Manually mock request * Add scenario comment from #4804
… range (yarnpkg#4804) * fix(resolution): use registry latest if it satisfies requested semver range Fixes yarnpkg#3560 **Summary** Mimic behavior in NPM; use the `latest` version in registry if it satisfies the semver range requests. Otherwise fallback to `semver.maxSatisfying()` **Test Plan** Added unit test to verify behavior. * fix eslint line len, additional field check
…one (yarnpkg#4797) * fix(info): Use version from `latest` dist-tag instead of the highest one Fixes yarnpkg#3947. By default, package `version` was set by sorting all the versions and getting the highest one. Now it's provided via package `latest` dist-tag. * Fix linter issues by shortening the test description * Manually mock request * Add scenario comment from yarnpkg#4804
Summary
Fixes #3560.
Related PR: #4797.
Mimic behavior in NPM; use the
latest
version in registry if itsatisfies the semver range requests.
Otherwise fallback to
semver.maxSatisfying()
NPM source that specifies this behavior is: https://github.com/npm/npm/blob/d46015256941ddfff1463338e3e2f8f77624a1ff/lib/utils/pick-manifest-from-registry-metadata.js#L10-L14
I believe this is OK directly in the NPM resolver, as other resolvers may not have a "latest" tag or dist-tags in general (for example, I don't believe git-resolver has this metadata to check).
Test Plan
Added unit test to verify behavior.