google-artifactregistry-auth
Advanced tools
Comparing version 3.1.1 to 3.1.2
{ | ||
"name": "google-artifactregistry-auth", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "google-artifactregistry-auth is an npm module that allows you to configure npm to interact with npm repositories stored in Artifact Registry.", | ||
@@ -5,0 +5,0 @@ "main": "./src/main.js", |
@@ -32,7 +32,2 @@ // Copyright 2019 Google LLC | ||
toConfigPath = path.resolve(toConfigPath); | ||
// Backward-compatible scenario. Update auth configs in project npmrc directly. | ||
if (fromConfigPath == toConfigPath) { | ||
updateConfigFile(fromConfigPath, creds); | ||
return; | ||
} | ||
@@ -106,3 +101,7 @@ const fromConfigs = []; | ||
await fs.promises.writeFile(toConfigPath, toConfigs.join(`\n`)); | ||
await fs.promises.writeFile(fromConfigPath, fromConfigs.join(`\n`)); | ||
if(fromConfigPath !== toConfigPath) { | ||
// If the files are the same (and likely the user .npmrc file) only write once with the auth configs | ||
// Otherwise, we'd overwrite this file without adding the credentials | ||
await fs.promises.writeFile(fromConfigPath, fromConfigs.join(`\n`)); | ||
} | ||
} | ||
@@ -109,0 +108,0 @@ |
@@ -280,2 +280,16 @@ /** | ||
it('set multiple tokens in same file', async function(){ | ||
fromConfigPath = getConfigPath(`${this.test.title}-from`); | ||
toConfigPath = fromConfigPath; | ||
fs.writeFileSync(fromConfigPath, `registry=https://us-west1-npm.pkg.dev/my-project/my-repo/ | ||
@cba:registry=https://asia-npm.pkg.dev/my-project/my-other-repo/`); | ||
await update.updateConfigFiles(fromConfigPath, toConfigPath, creds); | ||
const got = fs.readFileSync(fromConfigPath, 'utf8'); | ||
assert.equal(got, `registry=https://us-west1-npm.pkg.dev/my-project/my-repo/ | ||
@cba:registry=https://asia-npm.pkg.dev/my-project/my-other-repo/ | ||
//us-west1-npm.pkg.dev/my-project/my-repo/:_authToken=abcd | ||
//asia-npm.pkg.dev/my-project/my-other-repo/:_authToken=abcd`); | ||
}); | ||
it('use password config if exists', async function(){ | ||
@@ -282,0 +296,0 @@ fromConfigPath = getConfigPath(`${this.test.title}-from`); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55354
807