New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(private-packages): add a note about Yarn 2+ #11692
Conversation
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rarkins Are we sure about this behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't double check it but assumed @ylemkimon checked the source :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've verified, this won't work for npm datasource. The hostrule won't applied, as it's not a url or a hostname.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're talking about different things here.
Lines 49 to 55 in 62a540c
export function validateUrl(url?: string, httpOnly = true): boolean { | |
if (!url) { | |
return false; | |
} | |
try { | |
const { protocol } = new URL(url); | |
return httpOnly ? !!protocol.startsWith('http') : !!protocol; |
renovate/lib/manager/npm/post-update/rules.ts
Lines 20 to 21 in 62a540c
let uri = hostRule.matchHost; | |
uri = validateUrl(uri) ? uri.replace(/^https?:/, '') : `//${uri}/`; |
I meant following Renovate configuration:
{
"hostRules": [
{
"matchHost": "https://npm.pkg.github.com/",
"hostType": "npm",
"encrypted": {
"token": "<Encrypted PAT token>"
}
}
]
}
will update .yarnrc.yml
as following:
npmRegistries:
//npm.pkg.github.com/:
npmAuthToken: <Decrypted PAT token>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So without
needs to be with
https?
prefix. I think the sample should be added too.
@ylemkimon can you create a new PR for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened #11696.
🎉 This PR is included in version 27.5.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Changes:
Added a note about private packages in Yarn 2 to documentation.
Context:
Renovate doesn't support reading
npmRegistries
andnpmScopes
from.yarnrc.yml
, leading to confusion on how to configure Renovate on Yarn with private packages.Documentation (please check one with an [x])
How I've tested my work (please tick one)
I have verified these changes via: