Skip to content

Commit a69d45a

Browse files
committed
Add modification of scoped registry
1 parent 3ae886e commit a69d45a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/authutil.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function writeRegistryToFile(
2929
scope = '@' + scope;
3030
}
3131
if (scope) {
32-
scope = scope.toLowerCase();
32+
scope = scope.toLowerCase() + ':';
3333
}
3434

3535
core.debug(`Setting auth in ${fileLocation}`);
@@ -38,17 +38,15 @@ function writeRegistryToFile(
3838
const curContents: string = fs.readFileSync(fileLocation, 'utf8');
3939
curContents.split(os.EOL).forEach((line: string) => {
4040
// Add current contents unless they are setting the registry
41-
if (!line.toLowerCase().startsWith('registry')) {
41+
if (!line.toLowerCase().startsWith(`${scope}registry`)) {
4242
newContents += line + os.EOL;
4343
}
4444
});
4545
}
4646
// Remove http: or https: from front of registry.
4747
const authString: string =
4848
registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}';
49-
const registryString: string = scope
50-
? `${scope}:registry=${registryUrl}`
51-
: `registry=${registryUrl}`;
49+
const registryString: string = `${scope}registry=${registryUrl}`;
5250
const alwaysAuthString: string = `always-auth=${alwaysAuth}`;
5351
newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`;
5452
fs.writeFileSync(fileLocation, newContents);

0 commit comments

Comments
 (0)