-
Notifications
You must be signed in to change notification settings - Fork 342
Open
Description
After spending lot of time, I looked into the code & found that, the regex pattern is always matching for only registries pointing to npm. In my case we have a custom artifactory the URL that looks like //art01.spotifycloud.io
Lines 62 to 64 in 31ff97e
| const authLine = userNpmrcContent.split("\n").find((line) => { | |
| // check based on https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105 | |
| return /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line); |
Suggested solution
we can generalized the Regex and avoid hardcoding
const authLine = userNpmrcContent.split("\n").find((line) => {
// Dynamically adapt to any registry by looking for :_authToken= pattern
return /^\s*\/\/.*\/:[_-]authToken=/i.test(line);
});mazipan-wego
Metadata
Metadata
Assignees
Labels
No labels