google-artifactregistry-auth
Advanced tools
Comparing version 3.0.1 to 3.0.2
{ | ||
"name": "google-artifactregistry-auth", | ||
"version": "3.0.1", | ||
"version": "3.0.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", |
@@ -16,3 +16,3 @@ // Copyright 2019 Google LLC | ||
const registryRegex = /(@[a-zA-Z0-9-]+:)?registry=https:(\/\/[a-zA-Z0-9-]+[-]npm[.]pkg[.]dev\/.*\/)/; | ||
const registryRegex = /(@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*:)?registry=https:(\/\/[a-zA-Z0-9-]+[-]npm[.]pkg[.]dev\/.*\/)/; | ||
const authTokenRegex = /(\/\/[a-zA-Z0-9-]+[-]npm[.]pkg[.]dev\/.*\/):_authToken=(.*)/; | ||
@@ -19,0 +19,0 @@ const passwordRegex = /(\/\/[a-zA-Z0-9-]+[-]npm[.]pkg[.]dev\/.*\/):_password=(.*)/; |
@@ -228,2 +228,29 @@ /** | ||
it('add new scoped with dot', async function(){ | ||
fromConfigPath = getConfigPath(`${this.test.title}-from`); | ||
toConfigPath = getConfigPath(`${this.test.title}-to`) | ||
fs.writeFileSync(fromConfigPath, `@my.scope:registry=https://us-west1-npm.pkg.dev/my-project/my-repo/`); | ||
fs.writeFileSync(toConfigPath, ``); | ||
await update.updateConfigFiles(fromConfigPath, toConfigPath, creds); | ||
const gotFrom = fs.readFileSync(fromConfigPath, 'utf8'); | ||
const gotTo = fs.readFileSync(toConfigPath, 'utf8'); | ||
assert.equal(gotFrom, `@my.scope:registry=https://us-west1-npm.pkg.dev/my-project/my-repo/`); | ||
assert.equal(gotTo, `//us-west1-npm.pkg.dev/my-project/my-repo/:_authToken=abcd`); | ||
}); | ||
it('add new scoped starting with tilda', async function(){ | ||
fromConfigPath = getConfigPath(`${this.test.title}-from`); | ||
toConfigPath = getConfigPath(`${this.test.title}-to`) | ||
fs.writeFileSync(fromConfigPath, `@~myscope:registry=https://us-west1-npm.pkg.dev/my-project/my-repo/`); | ||
fs.writeFileSync(toConfigPath, ``); | ||
await update.updateConfigFiles(fromConfigPath, toConfigPath, creds); | ||
const gotFrom = fs.readFileSync(fromConfigPath, 'utf8'); | ||
const gotTo = fs.readFileSync(toConfigPath, 'utf8'); | ||
assert.equal(gotFrom, `@~myscope:registry=https://us-west1-npm.pkg.dev/my-project/my-repo/`); | ||
assert.equal(gotTo, `//us-west1-npm.pkg.dev/my-project/my-repo/:_authToken=abcd`); | ||
}); | ||
it('add new to config file does not exist', async function(){ | ||
@@ -230,0 +257,0 @@ fromConfigPath = getConfigPath(`${this.test.title}-from`); |
54476
789