From a4964cf370a3096ca787c716af123933ee4a5407 Mon Sep 17 00:00:00 2001 From: Edward Romero Date: Tue, 23 Jun 2020 20:51:56 -0400 Subject: [PATCH] commit new build to include the both registries change --- dist/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 4bcfb181..a6042b58 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4730,6 +4730,7 @@ function getAuthToken(authUrl, authUser, authPass) { const startIndex = body.indexOf('_auth') + 8; const endIndex = body.indexOf('\n'); const authToken = body.substring(startIndex, endIndex); + console.log(authToken); return authToken; }); } @@ -4769,11 +4770,18 @@ function writeRegistryToFile(registryUrl, fileLocation, alwaysAuth) { } // Remove http: or https: from front of registry. const authString = `${registryUrl.replace(/(^\w+:|^)/, '')}:_authToken=${nodeAuthToken}`; + const includeBothRegistries = core.getInput('include-both-registries'); const registryString = scope ? `${scope}:registry=${registryUrl}` : `registry=${registryUrl}`; const alwaysAuthString = `always-auth=${alwaysAuth}`; - newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`; + if (scope && includeBothRegistries) { + const registryStringNoScope = `registry=${registryUrl}`; + newContents += `${authString}${os.EOL}${registryString}${os.EOL}${registryStringNoScope}${os.EOL}${alwaysAuthString}`; + } + else { + newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`; + } fs.writeFileSync(fileLocation, newContents); core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation); // Export empty node_auth_token so npm doesn't complain about not being able to find it