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(pin): avoid pinning deprecated version #4609
Conversation
I ran renovate with this change against djcsdy/wildflower-codec and it did the right thing, so I think this is ready for merge. INFO: PR title changed (repository=djcsdy/wildflower-codec, dependencies=bitflags, branch=renovate/rust-pin-dependencies)
"branchName": "renovate/rust-pin-dependencies",
"oldPrTitle": "chore(deps): pin rust crate bitflags to =1.0.5",
"newPrTitle": "chore(deps): pin rust crate bitflags to =1.0.4" |
I thought about this more and for npm, we should pin it to the same one as before, even if that one is deprecated. At the same time, I want to avoid any manager-specific code in this worker file because it should ideally be captured within lib/manager/*. Somehow we need a way to behave different for Cargo and npm here. |
@@ -379,7 +384,7 @@ function getFromVersion( | |||
config: LookupUpdateConfig, | |||
rangeStrategy: string, | |||
allVersions: string[] | |||
): string { | |||
): string | null { |
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.
Is this change required?
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.
No, but it’s an unambiguous improvement since the function was already capable of returning null
and it’s helpful for the type to document that fact.
At the moment strictNullChecks
is turned off in tsConfig.json
for compatibility with the parts of renovate that are still written in JavaScript, but as you convert more of the code to TypeScript you probably want to work towards turning this option on to get better static type checking.
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.
Also I wanted to make it clear from the type of the function that
getFromVersion(config, rangeStrategy, nonDeprecatedVersions) ||
getFromVersion(config, rangeStrategy, allVersions)
works because the first function call returns null
if there are no matching non-deprecated versions.
The behaviour with this change for Cargo and npm is:
Which part of this behaviour is not what you want for npm? |
@djcsdy thanks for the explanation. I hadn't realised about point (1) above. |
🎉 This PR is included in version 19.60.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #4608 (I think, not tested yet).
Looks like the problem was that renovate didn't take deprecation into account when determining the current version (
fromVersion
) of a dependency.