Skip to content

Commit

Permalink
docs(config options): rewrite allowedVersions (#29014)
Browse files Browse the repository at this point in the history
  • Loading branch information
HonkingGoose committed May 12, 2024
1 parent 054e53e commit fe45509
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2473,8 +2473,9 @@ For example you have multiple `package.json` and want to use `dependencyDashboar

### allowedVersions

Use this - usually within a packageRule - to limit how far to upgrade a dependency.
For example, if you wish to upgrade to Angular v1.5 but not to `angular` v1.6 or higher, you could define this to be `<= 1.5` or `< 1.6.0`:
You can use `allowedVersions` - usually within a `packageRules` entry - to limit how far to upgrade a dependency.

For example, if you want to upgrade to Angular v1.5 but _not_ to `angular` v1.6 or higher, you could set `allowedVersions` to `<= 1.5` or `< 1.6.0`:

```json
{
Expand All @@ -2487,10 +2488,14 @@ For example, if you wish to upgrade to Angular v1.5 but not to `angular` v1.6 or
}
```

The valid syntax for this will be calculated at runtime because it depends on the versioning scheme, which is itself dynamic.
Renovate calculates the valid syntax for this at runtime, because it depends on the dynamic versioning scheme.

#### Using regular expressions

You can use Regular Expressions in the `allowedVersion` config.
You must _begin_ and _end_ your Regular Expression with the `/` character!

This field also supports Regular Expressions if they begin and end with `/`.
For example, the following will enforce that only 3 or 4-part versions are supported, without any prefixes:
For example, this config only allows 3 or 4-part versions, without any prefixes in the version:

```json
{
Expand All @@ -2503,8 +2508,12 @@ For example, the following will enforce that only 3 or 4-part versions are suppo
}
```

This field also supports a special negated regex syntax for ignoring certain versions.
Use the syntax `!/ /` like the following:
Again: note how the Regular Expression _begins_ and _ends_ with the `/` character.

#### Ignore versions with negated regex syntax

You can use a special negated regex syntax to ignore certain versions.
You must use the `!/ /` syntax, like this:

```json
{
Expand Down

0 comments on commit fe45509

Please sign in to comment.