Comments (7)
Nevermind after rereading the thread I got it!
module.exports = {
target: (name) => {
if(['chalk', 'react'].includes(name)) return 'minor';
return 'latest';
},
};
from npm-check-updates.
I'm basically trying to say "here's my list of things I don't want to do large breaking upgrades on yet, upgrade those to the next minor version, and then upgrade everything else to whatever".
from npm-check-updates.
There's basically no documentation about how to actually use
rejectVersion
. A paragraph stating the expected syntax and a couple of examples would help a lot.
Yes, thank you! A glaring omission. I've added the following documentation to the README (though read below for another approach):
rejectVersion
Usage:
ncu --rejectVersion [p]
The inverse of --filterVersion
. Exclude versions matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. This function is an alias for the reject
option function.
/**
@param name The name of the dependency.
@param semver A parsed Semver object of the upgraded version.
(See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
@returns True if the package should be excluded, false if it should be included.
*/
filterVersionFunction: (name, semver) => {
if (name.startsWith('@myorg/') && parseInt(semver[0]?.major) > 5) {
return true
}
return false
}
I'm basically trying to say "here's my list of things I don't want to do large breaking upgrades on yet, upgrade those to the next minor version, and then upgrade everything else to whatever".
For this, I recommend defining a target
predicate function in your .ncurc.js. That allows you to apply the minor
strategy to get the behavior you describe.
/**
@param name The name of the dependency.
@param parsedVersion A parsed Semver object of the upgraded version.
(See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
*/
target: name => name === 'react-router-dom' ? 'minor' : 'latest'
from npm-check-updates.
For the moment, I just went with
target: minor
across the board (and plan to instruct my team to do all major version upgrades by hand, which is probably for the best anyways).
Great! Note there is also target: 'semver'
.
I haven't made the jump from
.npmrc
as a json file to.npmrc.js
yet, but it looks more and more like I probably should.
It's a very simple switch. Just rename the file, add module.exports = { ... }
and you're good to go. The only difference is that it adds support for some of the options like filter
, reject
, and target
that allow custom functions.
This, plus setting up "doctor mode" is going to make our dependency update story quite a bit more smooth!
Yes, doctor
mode has been a big time-saver for me on my other projects! Enjoy.
from npm-check-updates.
Thank you very much for the quick answer back!
For the moment, I just went with target: minor
across the board (and plan to instruct my team to do all major version upgrades by hand, which is probably for the best anyways).
I haven't made the jump from .npmrc
as a json file to .npmrc.js
yet, but it looks more and more like I probably should.
This, plus setting up "doctor mode" is going to make our dependency update story quite a bit more smooth!
from npm-check-updates.
Hey! I too, am having trouble understanding reject
and rejectVersion
usage, specifically in our .ncurc
file.
When we run ncu -i
we want to see the latest version (including major) except for some dep we know we cannot upgrade to the major version. For those, we still want to see if the latest minor version has a new version.
At the moment, we are adding to the reject array those deps we don't want to major bump but that means not checking minor versions.
from npm-check-updates.
There should be a sample config file demonstrating the various capabilities, especially for the .js
and .cjs
options.
from npm-check-updates.
Related Issues (20)
- Error: ENOENT: no such file or directory, open '/etc/ssl/certs/ca-certificates.crt' HOT 6
- Unsupported target "semver" using pnpm HOT 2
- Feature request: Synchronous API HOT 2
- Library won't install anymore HOT 1
- [feature request] add changelog ( --format repo) to "ncu -i --format group" HOT 2
- Is support for importmaps feasible?
- Is support for importmaps feasible? HOT 5
- npm ci fails on Windows HOT 1
- package-lock.json behaves weirdly in npm-check-updates versions >= 16.4.0 HOT 4
- Does not support dist-tag insiders HOT 1
- Very high bandwidth usage in monorepo HOT 24
- Upgrade breaking dependencies HOT 1
- Make `--root` the default in workspaces mode
- Set type: module in package.json
- cli options don't override the default options in .ncurc.js HOT 6
- [[email protected]] pacote has some deprecated modules. @npmcli/move-file has been moved to @npmcli/fs. HOT 1
- Specific Angular Upgrade HOT 3
- Memory leak detected in version inflight-1.0.6 by veracode HOT 1
- Feature: Update GitHub Actions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from npm-check-updates.