From 022206cc3310021ec6bd58c23351d4f16083cdb1 Mon Sep 17 00:00:00 2001
From: ylemkimon <y@ylem.kim>
Date: Fri, 17 Sep 2021 18:05:53 +0900
Subject: [PATCH] docs: add an example for Yarn 2+ (#11696)

---
 .../usage/getting-started/private-packages.md | 30 ++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/docs/usage/getting-started/private-packages.md b/docs/usage/getting-started/private-packages.md
index 02fa5d5225..9007d04028 100644
--- a/docs/usage/getting-started/private-packages.md
+++ b/docs/usage/getting-started/private-packages.md
@@ -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
 
-- 
GitLab