Skip to content

Commit c09c380

Browse files
committed
README
1 parent ffeeee4 commit c09c380

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,9 @@ Usage:
444444
ncu --filter [p]
445445
ncu -f [p]
446446

447-
Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
447+
Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. Only included packages will be checked with `--peer`.
448+
449+
`--filter` runs _before_ new versions are fetched, in contrast to `--filterResults` which runs _after_.
448450

449451
The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line.
450452

@@ -467,7 +469,7 @@ filterFunction: (name, semver) => {
467469

468470
Filters out upgrades based on a user provided function.
469471

470-
`filterResults` runs _after_ new versions are fetched, in contrast to `filter` and `filterVersion`, which run _before_. This allows you to filter out upgrades with `filterResults` based on how the version has changed (e.g. a major version change).
472+
`filterResults` runs _after_ new versions are fetched, in contrast to `filter`, `reject`, `filterVersion`, and `rejectVersion`, which run _before_. This allows you to filter out upgrades with `filterResults` based on how the version has changed (e.g. a major version change).
471473

472474
Only available in .ncurc.js or when importing npm-check-updates as a module.
473475

@@ -675,7 +677,9 @@ Usage:
675677
ncu --reject [p]
676678
ncu -x [p]
677679
678-
The inverse of `--filter`. Exclude package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
680+
The inverse of `--filter`. Exclude package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. This will also exclude them from the `--peer` check.
681+
682+
`--reject` runs _before_ new versions are fetched, in contrast to `--filterResults` which runs _after_.
679683
680684
The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line.
681685
@@ -711,7 +715,7 @@ The predicate function is only available in .ncurc.js or when importing npm-chec
711715
(See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
712716
@returns True if the package should be excluded, false if it should be included.
713717
*/
714-
filterVersionFunction: (name, semver) => {
718+
rejectVersionFunction: (name, semver) => {
715719
if (name.startsWith('@myorg/') && parseInt(semver[0]?.major) > 5) {
716720
return true
717721
}

src/cli-options.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ const extendedHelpFilterResults: ExtendedHelp = ({ markdown }) => {
124124
125125
${codeInline('filterResults')} runs _after_ new versions are fetched, in contrast to ${codeInline(
126126
'filter',
127-
)} and ${codeInline('filterVersion')}, which run _before_. This allows you to filter out upgrades with ${codeInline(
127+
)}, ${codeInline('reject')}, ${codeInline('filterVersion')}, and ${codeInline(
128+
'rejectVersion',
129+
)}, which run _before_. This allows you to filter out upgrades with ${codeInline(
128130
'filterResults',
129131
)} based on how the version has changed (e.g. a major version change).
130132
@@ -201,7 +203,16 @@ const extendedHelpInstall: ExtendedHelp = ({ markdown }) => {
201203

202204
/** Extended help for the --filter option. */
203205
const extendedHelpFilterFunction: ExtendedHelp = ({ markdown }) => {
204-
return `Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
206+
/** If markdown, surround inline code with backticks. */
207+
const codeInline = (code: string) => (markdown ? `\`${code}\`` : code)
208+
209+
return `Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. Only included packages will be checked with ${codeInline(
210+
'--peer',
211+
)}.
212+
213+
${codeInline('--filter')} runs _before_ new versions are fetched, in contrast to ${codeInline(
214+
'--filterResults',
215+
)} which runs _after_.
205216
206217
The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line.
207218
@@ -258,7 +269,13 @@ const extendedHelpRejectFunction: ExtendedHelp = ({ markdown }) => {
258269

259270
return `The inverse of ${codeInline(
260271
'--filter',
261-
)}. Exclude package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
272+
)}. Exclude package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. This will also exclude them from the ${codeInline(
273+
'--peer',
274+
)} check.
275+
276+
${codeInline('--reject')} runs _before_ new versions are fetched, in contrast to ${codeInline(
277+
'--filterResults',
278+
)} which runs _after_.
262279
263280
The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line.
264281
@@ -299,7 +316,7 @@ ${codeBlock(
299316
(See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
300317
@returns True if the package should be excluded, false if it should be included.
301318
*/`)}
302-
${chalk.green('filterVersionFunction')}: (name, semver) ${chalk.cyan('=>')} {
319+
${chalk.green('rejectVersionFunction')}: (name, semver) ${chalk.cyan('=>')} {
303320
${chalk.red('if')} (name.startsWith(${chalk.yellow(`'@myorg/'`)}) ${chalk.red(
304321
'&&',
305322
)} parseInt(semver[0]?.major) ${chalk.cyan('>')} ${chalk.cyan(`5`)}) {

0 commit comments

Comments
 (0)