Skip to content

Commit 847caa0

Browse files
authored
refactor(deps): opn -> open (#1778)
* refactor(deps): `opn` -> `open` The package has been renamed * chore: Copyright headers * revert: Unrelated change * chore: lint fixes
1 parent fc8dfe9 commit 847caa0

11 files changed

+31
-39
lines changed

samples/oauth2-codeVerifier.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017, Google, Inc.
1+
// Copyright 2017 Google LLC
22
// Licensed under the Apache License, Version 2.0 (the "License");
33
// you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at
@@ -16,7 +16,7 @@
1616
const {OAuth2Client} = require('google-auth-library');
1717
const http = require('http');
1818
const url = require('url');
19-
const opn = require('opn');
19+
const open = require('open');
2020
const destroyer = require('server-destroy');
2121

2222
// Download your OAuth2 configuration from the Google Developer Console.
@@ -95,7 +95,7 @@ async function getAuthenticatedClient() {
9595
})
9696
.listen(3000, () => {
9797
// open the browser to the authorize url to start the workflow
98-
opn(authorizeUrl, {wait: false}).then(cp => cp.unref());
98+
open(authorizeUrl, {wait: false}).then(cp => cp.unref());
9999
});
100100
destroyer(server);
101101
});

samples/oauth2.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017, Google, Inc.
1+
// Copyright 2017 Google LLC
22
// Licensed under the Apache License, Version 2.0 (the "License");
33
// you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at
@@ -16,7 +16,7 @@
1616
const {OAuth2Client} = require('google-auth-library');
1717
const http = require('http');
1818
const url = require('url');
19-
const opn = require('opn');
19+
const open = require('open');
2020
const destroyer = require('server-destroy');
2121

2222
// Download your OAuth2 configuration from the Google
@@ -88,7 +88,7 @@ function getAuthenticatedClient() {
8888
})
8989
.listen(3000, () => {
9090
// open the browser to the authorize url to start the workflow
91-
opn(authorizeUrl, {wait: false}).then(cp => cp.unref());
91+
open(authorizeUrl, {wait: false}).then(cp => cp.unref());
9292
});
9393
destroyer(server);
9494
});

samples/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@googleapis/iam": "^15.0.0",
1818
"google-auth-library": "^9.7.0",
1919
"node-fetch": "^2.3.0",
20-
"opn": "^6.0.0",
20+
"open": "^6.0.0",
2121
"server-destroy": "^1.0.1"
2222
},
2323
"devDependencies": {

samples/verifyIdToken.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017, Google, Inc.
1+
// Copyright 2017 Google LLC
22
// Licensed under the Apache License, Version 2.0 (the "License");
33
// you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at
@@ -16,7 +16,7 @@
1616
const {OAuth2Client} = require('google-auth-library');
1717
const http = require('http');
1818
const url = require('url');
19-
const opn = require('opn');
19+
const open = require('open');
2020
const destroyer = require('server-destroy');
2121

2222
// Download your OAuth2 configuration from the Google
@@ -87,7 +87,7 @@ function getAuthenticatedClient() {
8787
})
8888
.listen(3000, () => {
8989
// open the browser to the authorize url to start the workflow
90-
opn(authorizeUrl, {wait: false}).then(cp => cp.unref());
90+
open(authorizeUrl, {wait: false}).then(cp => cp.unref());
9191
});
9292
destroyer(server);
9393
});

src/auth/computeclient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ export class Compute extends OAuth2Client {
5555
this.scopes = Array.isArray(options.scopes)
5656
? options.scopes
5757
: options.scopes
58-
? [options.scopes]
59-
: [];
58+
? [options.scopes]
59+
: [];
6060
}
6161

6262
/**

src/transporters.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ export class DefaultTransporter implements Transporter {
6464
if (!uaValue) {
6565
opts.headers['User-Agent'] = DefaultTransporter.USER_AGENT;
6666
} else if (!uaValue.includes(`${PRODUCT_NAME}/`)) {
67-
opts.headers[
68-
'User-Agent'
69-
] = `${uaValue} ${DefaultTransporter.USER_AGENT}`;
67+
opts.headers['User-Agent'] =
68+
`${uaValue} ${DefaultTransporter.USER_AGENT}`;
7069
}
7170
// track google-auth-library-nodejs version:
7271
if (!opts.headers['x-goog-api-client']) {

test/test.downscopedclient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ class TestAuthClient extends AuthClient {
5454
this.credentials.expiry_date = expirationTime;
5555
}
5656

57-
async getRequestHeaders(url?: string): Promise<Headers> {
57+
async getRequestHeaders(): Promise<Headers> {
5858
throw new Error('Not implemented.');
5959
}
6060

61-
request<T>(opts: GaxiosOptions): GaxiosPromise<T> {
61+
request<T>(): GaxiosPromise<T> {
6262
throw new Error('Not implemented.');
6363
}
6464
}

test/test.jwt.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ describe('jwt', () => {
2828
const keypair = require('keypair');
2929
const PEM_PATH = './test/fixtures/private.pem';
3030
const PEM_CONTENTS = fs.readFileSync(PEM_PATH, 'utf8');
31-
const P12_PATH = './test/fixtures/key.p12';
3231

3332
nock.disableNetConnect();
3433

test/test.oauth2common.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,8 @@ describe('OAuthClientAuthHandler', () => {
104104
};
105105
const actualOptions = Object.assign({}, originalOptions);
106106
const expectedOptions = Object.assign({}, originalOptions);
107-
(
108-
expectedOptions.headers as Headers
109-
).Authorization = `Basic ${expectedBase64EncodedCred}`;
107+
(expectedOptions.headers as Headers).Authorization =
108+
`Basic ${expectedBase64EncodedCred}`;
110109

111110
handler.testApplyClientAuthenticationOptions(actualOptions);
112111
assert.deepStrictEqual(expectedOptions, actualOptions);
@@ -127,9 +126,8 @@ describe('OAuthClientAuthHandler', () => {
127126
};
128127
const actualOptions = Object.assign({}, originalOptions);
129128
const expectedOptions = Object.assign({}, originalOptions);
130-
(
131-
expectedOptions.headers as Headers
132-
).Authorization = `Basic ${expectedBase64EncodedCredNoSecret}`;
129+
(expectedOptions.headers as Headers).Authorization =
130+
`Basic ${expectedBase64EncodedCredNoSecret}`;
133131

134132
handler.testApplyClientAuthenticationOptions(actualOptions);
135133
assert.deepStrictEqual(expectedOptions, actualOptions);
@@ -146,9 +144,8 @@ describe('OAuthClientAuthHandler', () => {
146144
};
147145
const actualOptions = Object.assign({}, originalOptions);
148146
const expectedOptions = Object.assign({}, originalOptions);
149-
(
150-
expectedOptions.headers as Headers
151-
).Authorization = `Basic ${expectedBase64EncodedCred}`;
147+
(expectedOptions.headers as Headers).Authorization =
148+
`Basic ${expectedBase64EncodedCred}`;
152149

153150
handler.testApplyClientAuthenticationOptions(actualOptions);
154151
assert.deepStrictEqual(expectedOptions, actualOptions);
@@ -349,9 +346,8 @@ describe('OAuthClientAuthHandler', () => {
349346
};
350347
const actualOptions = Object.assign({}, originalOptions);
351348
const expectedOptions = Object.assign({}, originalOptions);
352-
(
353-
expectedOptions.headers as Headers
354-
).Authorization = `Bearer ${bearerToken}`;
349+
(expectedOptions.headers as Headers).Authorization =
350+
`Bearer ${bearerToken}`;
355351

356352
handler.testApplyClientAuthenticationOptions(actualOptions, bearerToken);
357353
assert.deepStrictEqual(expectedOptions, actualOptions);
@@ -374,9 +370,8 @@ describe('OAuthClientAuthHandler', () => {
374370
const actualOptions = Object.assign({}, originalOptions);
375371
// Expected options should have bearer token in header.
376372
const expectedOptions = Object.assign({}, originalOptions);
377-
(
378-
expectedOptions.headers as Headers
379-
).Authorization = `Bearer ${bearerToken}`;
373+
(expectedOptions.headers as Headers).Authorization =
374+
`Bearer ${bearerToken}`;
380375

381376
handler.testApplyClientAuthenticationOptions(actualOptions, bearerToken);
382377
assert.deepStrictEqual(expectedOptions, actualOptions);
@@ -399,9 +394,8 @@ describe('OAuthClientAuthHandler', () => {
399394
const actualOptions = Object.assign({}, originalOptions);
400395
// Expected options should have bearer token in header.
401396
const expectedOptions = Object.assign({}, originalOptions);
402-
(
403-
expectedOptions.headers as Headers
404-
).Authorization = `Bearer ${bearerToken}`;
397+
(expectedOptions.headers as Headers).Authorization =
398+
`Bearer ${bearerToken}`;
405399

406400
handler.testApplyClientAuthenticationOptions(actualOptions, bearerToken);
407401
assert.deepStrictEqual(expectedOptions, actualOptions);

test/test.pluggableauthclient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
ExecutableError,
1818
PluggableAuthClient,
1919
} from '../src/auth/pluggable-auth-client';
20-
import {BaseExternalAccountClient, IdentityPoolClient} from '../src';
20+
import {BaseExternalAccountClient} from '../src';
2121
import {
2222
assertGaxiosResponsePresent,
2323
getAudience,

test/test.transporters.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ describe('transporters', () => {
155155
assert.strictEqual(res!.status, 200);
156156
done();
157157
},
158-
_error => {
158+
error => {
159159
scope.done();
160-
done('Unexpected promise failure');
160+
done(error);
161161
}
162162
);
163163
});

0 commit comments

Comments
 (0)