From 63d6a93d988f718acac2df507e4139b3b4ccf6b8 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 24 May 2022 11:09:40 -0700 Subject: [PATCH] build!: update library to use Node 12 (#706) * build!: Update library to use Node 12 Co-authored-by: Summer Ji Co-authored-by: Owl Bot --- .github/sync-repo-settings.yaml | 2 +- .github/workflows/ci.yaml | 2 +- .kokoro/continuous/node10/common.cfg | 34 ---------------------- .kokoro/continuous/node10/docs.cfg | 4 --- .kokoro/continuous/node10/lint.cfg | 4 --- .kokoro/continuous/node10/samples-test.cfg | 7 ----- .kokoro/continuous/node10/system-test.cfg | 7 ----- .kokoro/continuous/node10/test.cfg | 9 ------ .kokoro/continuous/node8/common.cfg | 24 --------------- .kokoro/continuous/node8/test.cfg | 0 .kokoro/presubmit/node10/common.cfg | 34 ---------------------- .kokoro/presubmit/node10/docs.cfg | 4 --- .kokoro/presubmit/node10/lint.cfg | 4 --- .kokoro/presubmit/node10/samples-test.cfg | 7 ----- .kokoro/presubmit/node10/system-test.cfg | 7 ----- .kokoro/presubmit/node10/test.cfg | 0 package.json | 10 +++---- samples/package.json | 4 +-- system-test/errors-transport.ts | 2 +- system-test/test-middleware-express.ts | 2 +- test/common.ts | 7 ++++- 21 files changed, 17 insertions(+), 157 deletions(-) delete mode 100644 .kokoro/continuous/node10/common.cfg delete mode 100644 .kokoro/continuous/node10/docs.cfg delete mode 100644 .kokoro/continuous/node10/lint.cfg delete mode 100644 .kokoro/continuous/node10/samples-test.cfg delete mode 100644 .kokoro/continuous/node10/system-test.cfg delete mode 100644 .kokoro/continuous/node10/test.cfg delete mode 100644 .kokoro/continuous/node8/common.cfg delete mode 100644 .kokoro/continuous/node8/test.cfg delete mode 100644 .kokoro/presubmit/node10/common.cfg delete mode 100644 .kokoro/presubmit/node10/docs.cfg delete mode 100644 .kokoro/presubmit/node10/lint.cfg delete mode 100644 .kokoro/presubmit/node10/samples-test.cfg delete mode 100644 .kokoro/presubmit/node10/system-test.cfg delete mode 100644 .kokoro/presubmit/node10/test.cfg diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 1b362683..d1e8b5e6 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -9,9 +9,9 @@ branchProtectionRules: - "ci/kokoro: System test" - docs - lint - - test (10) - test (12) - test (14) + - test (16) - cla/google - windows - OwlBot Post Processor diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 25251dbb..f447b84a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [10, 12, 14] + node: [12, 14, 16] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 diff --git a/.kokoro/continuous/node10/common.cfg b/.kokoro/continuous/node10/common.cfg deleted file mode 100644 index e89347f7..00000000 --- a/.kokoro/continuous/node10/common.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Bring in codecov.io token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-logging-winston/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-logging-winston/.kokoro/test.sh" -} diff --git a/.kokoro/continuous/node10/docs.cfg b/.kokoro/continuous/node10/docs.cfg deleted file mode 100644 index 1806bac6..00000000 --- a/.kokoro/continuous/node10/docs.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-logging-winston/.kokoro/docs.sh" -} diff --git a/.kokoro/continuous/node10/lint.cfg b/.kokoro/continuous/node10/lint.cfg deleted file mode 100644 index ac051fd9..00000000 --- a/.kokoro/continuous/node10/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-logging-winston/.kokoro/lint.sh" -} diff --git a/.kokoro/continuous/node10/samples-test.cfg b/.kokoro/continuous/node10/samples-test.cfg deleted file mode 100644 index 9be4dbea..00000000 --- a/.kokoro/continuous/node10/samples-test.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-logging-winston/.kokoro/samples-test.sh" -} diff --git a/.kokoro/continuous/node10/system-test.cfg b/.kokoro/continuous/node10/system-test.cfg deleted file mode 100644 index acd81b8c..00000000 --- a/.kokoro/continuous/node10/system-test.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-logging-winston/.kokoro/system-test.sh" -} diff --git a/.kokoro/continuous/node10/test.cfg b/.kokoro/continuous/node10/test.cfg deleted file mode 100644 index 609c0cf0..00000000 --- a/.kokoro/continuous/node10/test.cfg +++ /dev/null @@ -1,9 +0,0 @@ -# Bring in codecov.io token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} diff --git a/.kokoro/continuous/node8/common.cfg b/.kokoro/continuous/node8/common.cfg deleted file mode 100644 index 0d471047..00000000 --- a/.kokoro/continuous/node8/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-logging-winston/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-logging-winston/.kokoro/test.sh" -} diff --git a/.kokoro/continuous/node8/test.cfg b/.kokoro/continuous/node8/test.cfg deleted file mode 100644 index e69de29b..00000000 diff --git a/.kokoro/presubmit/node10/common.cfg b/.kokoro/presubmit/node10/common.cfg deleted file mode 100644 index e89347f7..00000000 --- a/.kokoro/presubmit/node10/common.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Bring in codecov.io token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-logging-winston/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-logging-winston/.kokoro/test.sh" -} diff --git a/.kokoro/presubmit/node10/docs.cfg b/.kokoro/presubmit/node10/docs.cfg deleted file mode 100644 index 1806bac6..00000000 --- a/.kokoro/presubmit/node10/docs.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-logging-winston/.kokoro/docs.sh" -} diff --git a/.kokoro/presubmit/node10/lint.cfg b/.kokoro/presubmit/node10/lint.cfg deleted file mode 100644 index ac051fd9..00000000 --- a/.kokoro/presubmit/node10/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-logging-winston/.kokoro/lint.sh" -} diff --git a/.kokoro/presubmit/node10/samples-test.cfg b/.kokoro/presubmit/node10/samples-test.cfg deleted file mode 100644 index 9be4dbea..00000000 --- a/.kokoro/presubmit/node10/samples-test.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-logging-winston/.kokoro/samples-test.sh" -} diff --git a/.kokoro/presubmit/node10/system-test.cfg b/.kokoro/presubmit/node10/system-test.cfg deleted file mode 100644 index acd81b8c..00000000 --- a/.kokoro/presubmit/node10/system-test.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-logging-winston/.kokoro/system-test.sh" -} diff --git a/.kokoro/presubmit/node10/test.cfg b/.kokoro/presubmit/node10/test.cfg deleted file mode 100644 index e69de29b..00000000 diff --git a/package.json b/package.json index 494b381d..2d543d55 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "license": "Apache-2.0", "author": "Google Inc.", "engines": { - "node": ">=10" + "node": ">=12.0.0" }, "repository": "googleapis/nodejs-logging-winston", "main": "./build/src/index.js", @@ -51,7 +51,7 @@ }, "dependencies": { "@google-cloud/logging": "^9.6.9", - "google-auth-library": "^7.0.0", + "google-auth-library": "^8.0.2", "lodash.mapvalues": "^4.6.0", "winston-transport": "^4.3.0" }, @@ -66,12 +66,12 @@ "@types/uuid": "^8.0.0", "c8": "^7.0.0", "codecov": "^3.5.0", - "gts": "^2.0.0", + "gts": "^3.1.0", "linkinator": "^2.0.0", - "mocha": "^8.0.0", + "mocha": "^9.2.2", "post-install-check": "0.0.1", "proxyquire": "^2.1.0", - "typescript": "^3.9.7", + "typescript": "^4.6.4", "uuid": "^8.0.0", "winston": "^3.2.1" }, diff --git a/samples/package.json b/samples/package.json index dbc1e0b6..26363c42 100644 --- a/samples/package.json +++ b/samples/package.json @@ -8,7 +8,7 @@ "author": "Google Inc.", "repository": "googleapis/nodejs-logging-winston", "engines": { - "node": ">=10" + "node": ">=12.0.0" }, "scripts": { "test": "mocha --timeout 600000" @@ -21,4 +21,4 @@ "chai": "^4.2.0", "mocha": "^8.0.0" } -} +} \ No newline at end of file diff --git a/system-test/errors-transport.ts b/system-test/errors-transport.ts index 8ca16e0f..c96a2f0a 100644 --- a/system-test/errors-transport.ts +++ b/system-test/errors-transport.ts @@ -64,7 +64,7 @@ export class ErrorsApiTransport extends common.Service { async request(options: common.DecorateRequestOptions) { return new Promise((resolve, reject) => { super.request(options, (err, _, res) => - err ? reject(err) : resolve(res) + err ? reject(err) : resolve(res as common.ResponseBody) ); }); } diff --git a/system-test/test-middleware-express.ts b/system-test/test-middleware-express.ts index a7be5aea..bfa33920 100644 --- a/system-test/test-middleware-express.ts +++ b/system-test/test-middleware-express.ts @@ -58,7 +58,7 @@ describe(__filename, () => { it('should write request correlated log entries', function () { this.timeout(TEST_TIMEOUT); // eslint-disable-next-line no-async-promise-executor - return new Promise(async resolve => { + return new Promise(async resolve => { const logger = winston.createLogger(); const mw = await elb.makeMiddleware(logger, { logName: LOG_NAME, diff --git a/test/common.ts b/test/common.ts index 592703ce..05973b5b 100644 --- a/test/common.ts +++ b/test/common.ts @@ -22,6 +22,11 @@ import {LoggingCommon} from '../src/common'; declare const global: {[index: string]: {} | null}; +interface Metadata { + value(): void; + labels?: {label2?: string}; +} + describe('logging-common', () => { let fakeLogInstance: Logging; let fakeLoggingOptions_: Options | null; @@ -508,7 +513,7 @@ describe('logging-common', () => { const MESSAGE = 'message'; const PREFIX = 'prefix'; const LABELS = {label1: 'value1'}; - const METADATA = {value: () => {}, labels: {label2: 'value2'}}; + const METADATA: Metadata = {value: () => {}, labels: {label2: 'value2'}}; beforeEach(() => { const opts = Object.assign({}, OPTIONS, {