mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Fixed authToken detection in the user .npmrc (allow for leading whitespace) (#116)
* fix: adjust regex to include leading whitespaces * tweak regexp Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
This commit is contained in:
co-authored by
Mateusz Burzyński
parent
8090f2a918
commit
21240c3cd1
Vendored
+19
-159
File diff suppressed because one or more lines are too long
+1
-1
@@ -48,7 +48,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
|||||||
const userNpmrcContent = await fs.readFile(userNpmrcPath, "utf8");
|
const userNpmrcContent = await fs.readFile(userNpmrcPath, "utf8");
|
||||||
const authLine = userNpmrcContent.split("\n").find((line) => {
|
const authLine = userNpmrcContent.split("\n").find((line) => {
|
||||||
// check based on https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105
|
// check based on https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105
|
||||||
return /^\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line);
|
return /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line);
|
||||||
});
|
});
|
||||||
if (authLine) {
|
if (authLine) {
|
||||||
console.log(
|
console.log(
|
||||||
|
|||||||
Reference in New Issue
Block a user