Skip to content

Commit bcf01c6

Browse files
authored
docs: clarify package.json override value specs (#9505)
## Summary - state explicitly that override values accept standard npm dependency specifiers - add a semver range example for override values - keep the change scoped to the existing `package.json#overrides` docs Closes #9475. ## Validation - `git diff --check`
1 parent 455aa4a commit bcf01c6

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

docs/lib/content/configuring-npm/package-json.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,21 @@ To make sure the package `@npm/foo` is always installed as version `1.0.0` no ma
896896
}
897897
```
898898

899+
Override values can use any specifier that npm accepts for dependencies, including
900+
an exact version, a semver range, a dist-tag, or a replacement specifier such as
901+
`npm:`, `file:`, or a Git URL.
902+
903+
For example, if you only need to enforce a minimum patched release instead of one
904+
exact version, you can use a semver range:
905+
906+
```json
907+
{
908+
"overrides": {
909+
"@npm/foo": "^1.0.0"
910+
}
911+
}
912+
```
913+
899914
The above is a short hand notation, the full object form can be used to allow overriding a package itself as well as a child of the package.
900915
This will cause `@npm/foo` to always be `1.0.0` while also making `@npm/bar` at any depth beyond `@npm/foo` also `1.0.0`:
901916

0 commit comments

Comments
 (0)