Skip to content

Commit

Permalink
docs: add an example for Yarn 2+ (#11696)
Browse files Browse the repository at this point in the history
  • Loading branch information
ylemkimon committed Sep 17, 2021
1 parent d3c9fd5 commit 022206c
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion docs/usage/getting-started/private-packages.md
Expand Up @@ -261,7 +261,35 @@ The end-result looks like this:

Renovate doesn't support reading `npmRegistries` and `npmScopes` from `.yarnrc.yml`, so `hostRules` (or `npmToken`) and `npmrc` should be configured like above.
Renovate updates `npmRegistries` in `.yarnrc.yml` with resolved `hostRules` before running Yarn.
For Renovate to overwrite existing `npmRegistries` entry, the key should match the `matchHost` without the protocol (`http:` or `https:`) and with the trailing slash.
For Renovate to overwrite existing `npmRegistries` entry, the key should match the `matchHost` minus the protocol (`http:` or `https:`) plus the trailing slash.

For example, the Renovate configuration:

```json
{
"hostRules": [
{
"matchHost": "https://npm.pkg.github.com/",
"hostType": "npm",
"encrypted": {
"token": "<Encrypted PAT Token>"
}
}
]
}
```

will update `.yarnrc.yml` as following:

```yaml
npmRegistries:
//npm.pkg.github.com/:
npmAuthToken: <Decrypted PAT Token>
//npm.pkg.github.com:
# this will not be overwritten and may conflict
https://npm.pkg.github.com/:
# this will not be overwritten and may conflict
```

### nuget

Expand Down

0 comments on commit 022206c

Please sign in to comment.