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
| constauthLine=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
constauthLine=userNpmrcContent.split("\n").find((line)=>{// Dynamically adapt to any registry by looking for :_authToken= patternreturn/^\s*\/\/.*\/:[_-]authToken=/i.test(line);});
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.ioaction/src/index.ts
Lines 62 to 64 in 31ff97e
Suggested solution
we can generalized the Regex and avoid hardcoding