Skip to content

Commit

Permalink
Add dist
Browse files Browse the repository at this point in the history
  • Loading branch information
dsame committed Dec 5, 2022
1 parent e77eaac commit 069a4f8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72945,24 +72945,22 @@ function writeRegistryToFile(registryUrl, fileLocation, alwaysAuth) {
scope = '@' + scope;
}
if (scope) {
scope = scope.toLowerCase();
scope = scope.toLowerCase() + ':';
}
core.debug(`Setting auth in ${fileLocation}`);
let newContents = '';
if (fs.existsSync(fileLocation)) {
const curContents = fs.readFileSync(fileLocation, 'utf8');
curContents.split(os.EOL).forEach((line) => {
// Add current contents unless they are setting the registry
if (!line.toLowerCase().startsWith('registry')) {
if (!line.toLowerCase().startsWith(`${scope}registry`)) {
newContents += line + os.EOL;
}
});
}
// Remove http: or https: from front of registry.
const authString = registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}';
const registryString = scope
? `${scope}:registry=${registryUrl}`
: `registry=${registryUrl}`;
const registryString = `${scope}registry=${registryUrl}`;
const alwaysAuthString = `always-auth=${alwaysAuth}`;
newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`;
fs.writeFileSync(fileLocation, newContents);
Expand Down

0 comments on commit 069a4f8

Please sign in to comment.