Add types

This commit is contained in:
Danny McCormick 2019-08-06 18:24:15 -04:00 committed by GitHub
parent 6b34be1bc2
commit 6e4a7921f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ export function configAuthentication(registryUrl: string) {
} }
function writeRegistryToFile(registryUrl: string, fileLocation: string) { function writeRegistryToFile(registryUrl: string, fileLocation: string) {
let scope = core.getInput('scope'); let scope: string = core.getInput('scope');
if (!scope && registryUrl.indexOf('npm.pkg.github.com') > -1) { if (!scope && registryUrl.indexOf('npm.pkg.github.com') > -1) {
scope = github.context.repo.owner; scope = github.context.repo.owner;
} }
@ -37,9 +37,9 @@ function writeRegistryToFile(registryUrl: string, fileLocation: string) {
}); });
} }
// Remove http: or https: from front of registry. // Remove http: or https: from front of registry.
const authString = const authString: string =
registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}'; registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}';
const registryString = scope const registryString: string = scope
? `${scope}:registry=${registryUrl}` ? `${scope}:registry=${registryUrl}`
: `registry=${registryUrl}`; : `registry=${registryUrl}`;
newContents += `${authString}${os.EOL}${registryString}`; newContents += `${authString}${os.EOL}${registryString}`;