Skip to content

Commit

Permalink
chore!: migrate to Node 18 (#496)
Browse files Browse the repository at this point in the history
* build: configure release builds using multi-scm

Source-Link: googleapis/synthtool@8200f93
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:22e41dd7cd82683fa338b647abcc3a29ddb1b17e800b089adc0bec0a3175312c

* chore!: upgrade to node 18

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Update .OwlBot.lock.yaml

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* run lint

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Sofia Leon <sofialeon@google.com>
Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com>
  • Loading branch information
4 people authored Dec 11, 2024
1 parent 6ec11f2 commit 7ece46d
Show file tree
Hide file tree
Showing 28 changed files with 64 additions and 61 deletions.
4 changes: 2 additions & 2 deletions .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest
digest: sha256:609822e3c09b7a1bd90b99655904609f162cc15acb4704f1edf778284c36f429
# created: 2024-10-01T19:34:30.797530443Z
digest: sha256:0d39e59663287ae929c1d4ccf8ebf7cef9946826c9b86eda7e85d8d752dbb584
# created: 2024-10-30T16:51:59.982020867Z
1 change: 1 addition & 0 deletions .github/release-trigger.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
enabled: true
multiScmName: node-gtoken
4 changes: 2 additions & 2 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ branchProtectionRules:
- "ci/kokoro: Samples test"
- "ci/kokoro: System test"
- lint
- test (14)
- test (16)
- test (18)
- test (20)
- test (22)
- cla/google
- windows
- OwlBot Post Processor
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [14, 16, 18, 20]
node: [18, 20, 22]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: node --version
Expand All @@ -29,30 +29,30 @@ jobs:
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
- run: npm install --engine-strict
- run: npm test
env:
MOCHA_THROW_DEPRECATION: false
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
- run: npm install
- run: npm run lint
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
- run: npm install
- run: npm run docs
- uses: JustinBeckwith/linkinator-action@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ package-lock.json
__pycache__
.coverage
docs/
.DS_Store
2 changes: 1 addition & 1 deletion .kokoro/common.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion .kokoro/release/docs-devsite.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/release/docs.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/release/docs.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/release/publish.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions .kokoro/samples-test.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/system-test.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/test.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/test.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/trampoline_v2.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 14 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"engines": {
"node": ">=14.0.0"
"node": ">=18"
},
"repository": "google/node-gtoken",
"scripts": {
Expand All @@ -21,7 +21,6 @@
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"docs": "jsdoc -c .jsdoc.js",
"predocs-test": "npm run docs",
"predocs-test": "npm run docs",
"prelint": "cd samples; npm link ../; npm install",
"precompile": "gts clean"
},
Expand All @@ -39,25 +38,25 @@
},
"license": "MIT",
"dependencies": {
"gaxios": "^6.0.0",
"gaxios": "^6.7.1",
"jws": "^4.0.0"
},
"devDependencies": {
"@babel/plugin-proposal-private-methods": "^7.18.6",
"cheerio": "1.0.0-rc.12",
"@types/jws": "^3.1.0",
"@types/mocha": "^9.0.0",
"@types/node": "^20.0.0",
"c8": "^9.0.0",
"gts": "^5.0.0",
"jsdoc": "^4.0.0",
"@types/jws": "^3.2.10",
"@types/mocha": "^10.0.9",
"@types/node": "^22.9.0",
"c8": "^10.1.2",
"cheerio": "^1.0.0",
"gts": "^6.0.2",
"jsdoc": "^4.0.4",
"jsdoc-fresh": "^3.0.0",
"jsdoc-region-tag": "^3.0.0",
"linkinator": "^3.0.0",
"mocha": "^9.2.2",
"nock": "^13.0.0",
"pdfmake": "0.2.12",
"typescript": "^5.1.6"
"linkinator": "^6.1.2",
"mocha": "^10.8.2",
"nock": "^13.5.6",
"pdfmake": "^0.2.15",
"typescript": "^5.6.3"
},
"files": [
"build/src",
Expand Down
4 changes: 2 additions & 2 deletions samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"license": "MIT",
"author": "Google LLC",
"engines": {
"node": ">=12.0.0"
"node": ">=18"
},
"files": [
"*.js",
Expand All @@ -20,4 +20,4 @@
"devDependencies": {
"mocha": "^8.0.0"
}
}
}
16 changes: 8 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const readFile = fs.readFile
// if running in the web-browser, fs.readFile may not have been shimmed.
throw new ErrorWithCode(
'use key rather than keyFile.',
'MISSING_CREDENTIALS'
'MISSING_CREDENTIALS',
);
};

Expand Down Expand Up @@ -66,7 +66,7 @@ export interface GetTokenOptions {
class ErrorWithCode extends Error {
constructor(
message: string,
public code: string
public code: string,
) {
super(message);
}
Expand Down Expand Up @@ -149,7 +149,7 @@ export class GoogleToken {
getToken(callback: GetTokenCallback, opts?: GetTokenOptions): void;
getToken(
callback?: GetTokenCallback | GetTokenOptions,
opts = {} as GetTokenOptions
opts = {} as GetTokenOptions,
): void | Promise<TokenData> {
if (typeof callback === 'object') {
opts = callback as GetTokenOptions;
Expand All @@ -159,7 +159,7 @@ export class GoogleToken {
{
forceRefresh: false,
},
opts
opts,
);

if (callback) {
Expand Down Expand Up @@ -187,7 +187,7 @@ export class GoogleToken {
if (!privateKey || !clientEmail) {
throw new ErrorWithCode(
'private_key and client_email are required.',
'MISSING_CREDENTIALS'
'MISSING_CREDENTIALS',
);
}
return {privateKey, clientEmail};
Expand All @@ -203,14 +203,14 @@ export class GoogleToken {
throw new ErrorWithCode(
'*.p12 certificates are not supported after v6.1.2. ' +
'Consider utilizing *.json format or converting *.p12 to *.pem using the OpenSSL CLI.',
'UNKNOWN_CERTIFICATE_TYPE'
'UNKNOWN_CERTIFICATE_TYPE',
);
}
default:
throw new ErrorWithCode(
'Unknown certificate type. Type is determined based on file extension. ' +
'Current supported extensions are *.json, and *.pem.',
'UNKNOWN_CERTIFICATE_TYPE'
'UNKNOWN_CERTIFICATE_TYPE',
);
}
}
Expand Down Expand Up @@ -325,7 +325,7 @@ export class GoogleToken {
iat,
sub: this.sub,
},
additionalClaims
additionalClaims,
);
const signedJWT = jws.sign({
header: {alg: 'RS256'},
Expand Down
Loading

0 comments on commit 7ece46d

Please sign in to comment.