get-artifactregistry-token 3.4.0 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "get-artifactregistry-token",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "description": "google-artifactregistry-auth is an npm module that allows you to configure npm to interact with npm repositories stored in Artifact Registry.",
5
5
  "main": "./src/main.js",
6
6
  "repository": "GoogleCloudPlatform/artifact-registry-npm-tools",
7
7
  "author": "Google LLC",
8
8
  "license": "Apache-2.0",
9
9
  "dependencies": {
10
+ "dotenv": "^17.2.3",
10
11
  "google-auth-library": "^9.14.0",
11
12
  "js-yaml": "^4.1.0",
12
13
  "yargs": "^17.1.1"
13
14
  },
14
15
  "bin": {
15
- "artifactregistry-login": "./src/main.js"
16
+ "get-artifactregistry-token": "./src/main.js"
16
17
  },
17
18
  "devDependencies": {
18
19
  "mocha": "^6.2.0",
package/src/auth.js CHANGED
@@ -50,6 +50,7 @@ async function setupBase64Credentials() {
50
50
  }
51
51
  }
52
52
 
53
+
53
54
  /**
54
55
  * Automatically choose the right client credentials based on the environment.
55
56
  *
package/src/main.js CHANGED
@@ -13,7 +13,7 @@
13
13
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
  // See the License for the specific language governing permissions and
15
15
  // limitations under the License.
16
-
16
+ require('dotenv').config()
17
17
  const os = require('os');
18
18
  const yargs = require('yargs/yargs')
19
19
  const { hideBin } = require('yargs/helpers')
@@ -22,8 +22,7 @@ describe('#config', function() {
22
22
  {name: 'auth token', config: '//us-west1-npm.pkg.dev/myproj/myrepo/:_authToken=myToken'},
23
23
  {name: 'password', config: '//us-west1-npm.pkg.dev/myproj/myrepo/:_password=myPassword'},
24
24
  {name: 'registry', config: 'registry=https://us-west1-npm.pkg.dev/myproj/myrepo/'},
25
- {name: 'scoped registry', config: '@myscope:registry=https://us-west1-npm.pkg.dev/myproj/myrepo/'},
26
- {name: 'non-@ scoped registry', config: 'better-auth:registry=https://us-west1-npm.pkg.dev/myproj/myrepo/'}
25
+ {name: 'scoped registry', config: '@myscope:registry=https://us-west1-npm.pkg.dev/myproj/myrepo/'}
27
26
  ];
28
27
 
29
28
  tests.forEach(({name, config}) => {
@@ -402,21 +402,6 @@ myregistry.myproperty=myvalue`);
402
402
  });
403
403
 
404
404
 
405
- it('preserves non-@ scoped registry configs', async function(){
406
- fromConfigPath = getConfigPath(`${this.test.title}-from`);
407
- toConfigPath = getConfigPath(`${this.test.title}-to`)
408
- fs.writeFileSync(fromConfigPath, `@myscope:registry=https://us-west1-npm.pkg.dev/my-project/my-repo/
409
- better-auth:registry=https://us-west1-npm.pkg.dev/my-project/my-repo/`);
410
- fs.writeFileSync(toConfigPath, ``);
411
- await update.updateConfigFiles(fromConfigPath, toConfigPath, creds, false);
412
-
413
- const gotFrom = fs.readFileSync(fromConfigPath, 'utf8');
414
- const gotTo = fs.readFileSync(toConfigPath, 'utf8');
415
- assert.equal(gotFrom, `@myscope:registry=https://us-west1-npm.pkg.dev/my-project/my-repo/
416
- better-auth:registry=https://us-west1-npm.pkg.dev/my-project/my-repo/`);
417
- assert.equal(gotTo, `//us-west1-npm.pkg.dev/my-project/my-repo/:_authToken=abcd`);
418
- });
419
-
420
405
  it('rejects if input does not exist', async function() {
421
406
  fromConfigPath = getConfigPath(`${this.test.title}-from`);
422
407
  toConfigPath = getConfigPath(`${this.test.title}-to`)