You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the latest version of npm-check-updates
I am using node >= 10.17
Steps to Reproduce
The current --target options lack a way to say "upgrade to the latest values allowed by my package.json" (following semver range syntax). This would basically be the equivalent of rm -rf node_modules && npm install and then finding the versions that were installed to put them back in package.json.
This isn't simply a matter of using --target patch because I often have mixed requirements in package.json where I want to allow only patch updates to some packages, but want minor updates on others.
I thought this was an issue with how --minimal works (since I interpreted that as "the update the minimal amount" instead of "update a minimal number of packages"), but found #746 saying this is expected behavior. So instead of a bug, this is a feature request.
Thanks for the suggestion! This is a great idea. For most users I would suggest using npm update as designed to achieve this behavior with semver. However, you are not the first to want greater control over the version numbers in the package.json.
The proposed addition would be a welcome contribution, it's just in need of a contributor. For historical discussion, see #581.
As of v12.5.0, you can specify a custom target function in your .ncurc.js file, or when importing npm-check-updates as a module:
/** Custom target. @param dependencyName The name of the dependency. @param parsedVersion A parsed Semver object from semver-utils. (See https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring) @returns One of the valid target values (specified in the table above).*/
target: (dependencyName,[{ semver, version, operator, major, minor, patch, release, build }])=>{if(major==='0')return'minor'return'latest'}
You can hack together your own semver-like target logic, but the intention is to eventually add a --semver option that handles this for you.
npm-check-updates
node >= 10.17
Steps to Reproduce
The current
--target
options lack a way to say "upgrade to the latest values allowed by my package.json" (following semver range syntax). This would basically be the equivalent ofrm -rf node_modules && npm install
and then finding the versions that were installed to put them back inpackage.json
.This isn't simply a matter of using
--target patch
because I often have mixed requirements in package.json where I want to allow onlypatch
updates to some packages, but wantminor
updates on others.I thought this was an issue with how
--minimal
works (since I interpreted that as "the update the minimal amount" instead of "update a minimal number of packages"), but found #746 saying this is expected behavior. So instead of a bug, this is a feature request.Current Behavior
package1
~1.0.0
→~1.2.0
package2
^1.0.0
→^2.0.0
package3
1.0.0
→1.1.0
Expected Behavior
package1
~1.0.0
→~1.0.1
package2
^1.0.0
→^1.2.0
package3
1.0.0
→1.0.0
The text was updated successfully, but these errors were encountered: