Skip to content

Commit

Permalink
README: Clarify filters and how dependency updates are determined
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine authored Jul 31, 2024
1 parent 11abcba commit 2655e98
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,34 +89,44 @@ Combine with `--format group` for a truly _luxe_ experience:

## Filter packages

Filter packages using the `--filter` option or adding additional cli arguments. You can exclude specific packages with the `--reject` option or prefixing a filter with `!`. Supports strings, wildcards, globs, comma-or-space-delimited lists, and regular expressions:
Filter packages using the `--filter` option or adding additional cli arguments:

```sh
# upgrade only mocha
ncu mocha
ncu -f mocha
ncu --filter mocha

# upgrade only chalk, mocha, and react
ncu chalk mocha react
ncu chalk, mocha, react
ncu -f "chalk mocha react"
```

Filter with wildcards or regex:

```sh
# upgrade packages that start with "react-"
ncu react-*
ncu "/^react-.*$/"
```

Exclude specific packages with the `--reject` option or prefixing a filter with `!`. Supports strings, wildcards, globs, comma-or-space-delimited lists, and regex:

```sh
# upgrade everything except nodemon
ncu \!nodemon
ncu -x nodemon
ncu --reject nodemon

# upgrade only chalk, mocha, and react
ncu chalk mocha react
ncu chalk, mocha, react
ncu -f "chalk mocha react"

# upgrade packages that do not start with "react-".
ncu \!react-*
ncu '/^(?!react-).*$/' # mac/linux
ncu "/^(?!react-).*$/" # windows
```

Advanced filters: [filter](https://github.com/raineorshine/npm-check-updates#filter), [filterResults](https://github.com/raineorshine/npm-check-updates#filterresults), [filterVersion](https://github.com/raineorshine/npm-check-updates#filterversion)

## How dependency updates are determined

- Direct dependencies are updated to the latest stable version:
Expand All @@ -134,18 +144,21 @@ ncu "/^(?!react-).*$/" # windows
- `*``*`
- Prerelease versions are ignored by default.
- Use `--pre` to include prerelease versions (e.g. `alpha`, `beta`, `build1235`)
- With `--target minor`, only update patch and minor:
- `0.1.0``0.2.1`
- With `--target patch`, only update patch:
- `0.1.0``0.1.2`
- With `--target @next`, update to the version published on the `next` tag:
- `0.1.0` -> `0.1.1-next.1`
- Choose what level to upgrade to:
- With `--target semver`, update according to your specified [semver](https://semver.org/) version ranges:
- `^1.1.0``^1.9.99`
- With `--target minor`, strictly update the patch and minor versions (including major version zero):
- `0.1.0``0.2.1`
- With `--target patch`, strictly update the patch version (including major version zero):
- `0.1.0``0.1.2`
- With `--target @next`, update to the version published on the `next` tag:
- `0.1.0` -> `0.1.1-next.1`

## Options

Options are merged with the following precedence:

1. CLI
1. Command line options
2. Local [Config File](#config-file)
3. Project Config File
4. User Config File
Expand Down

0 comments on commit 2655e98

Please sign in to comment.