From e8a4bd237e8d40439ff758973a957c7f810e179f Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 4 Mar 2025 13:37:56 +1100 Subject: [PATCH] ci(recaptcha): migrate CI --- .github/config/nodejs-dev.jsonc | 1 + .github/config/nodejs-prod.jsonc | 1 - recaptcha_enterprise/snippets/package.json | 1 + recaptcha_enterprise/snippets/passwordLeakAssessment.js | 7 +++---- recaptcha_enterprise/snippets/tsconfig.json | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/config/nodejs-dev.jsonc b/.github/config/nodejs-dev.jsonc index 088934266a..23dc8a6ce2 100644 --- a/.github/config/nodejs-dev.jsonc +++ b/.github/config/nodejs-dev.jsonc @@ -191,6 +191,7 @@ "mediatranslation", "monitoring/prometheus", "monitoring/snippets", + "recaptcha_enterprise/snippets", "retail", "routeoptimization/snippets", "run/hello-broken", diff --git a/.github/config/nodejs-prod.jsonc b/.github/config/nodejs-prod.jsonc index bee3b1d2ed..5e2a44d513 100644 --- a/.github/config/nodejs-prod.jsonc +++ b/.github/config/nodejs-prod.jsonc @@ -95,7 +95,6 @@ "functions/v2/imagemagick", // (untested) Error: A bucket name is needed to use Cloud Storage. "healthcare/fhir", // Error: Cannot find module 'whatwg-url' "iam/deny", // PERMISSION_DENIED: Permission iam.googleapis.com/denypolicies.create denied on resource cloudresourcemanager.googleapis.com/projects/long-door-651 - "recaptcha_enterprise/snippets", // Cannot use import statement outside a module "run/idp-sql", // (untested) Error: Invalid contents in the credentials file "scheduler", // SyntaxError: Cannot use import statement outside a module "storagetransfer", // CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1 diff --git a/recaptcha_enterprise/snippets/package.json b/recaptcha_enterprise/snippets/package.json index af0218e2b7..c9e10bf1bb 100644 --- a/recaptcha_enterprise/snippets/package.json +++ b/recaptcha_enterprise/snippets/package.json @@ -4,6 +4,7 @@ "main": "quickstart.js", "license": "Apache-2.0", "author": "Google LLC", + "type": "module", "engines": { "node": ">=16.0.0" }, diff --git a/recaptcha_enterprise/snippets/passwordLeakAssessment.js b/recaptcha_enterprise/snippets/passwordLeakAssessment.js index 7d684509d0..a0b52350a2 100644 --- a/recaptcha_enterprise/snippets/passwordLeakAssessment.js +++ b/recaptcha_enterprise/snippets/passwordLeakAssessment.js @@ -29,10 +29,8 @@ const [projectId, username, password] = args; // [START recaptcha_enterprise_password_leak_verification] -const { - RecaptchaEnterpriseServiceClient, -} = require('@google-cloud/recaptcha-enterprise'); -const {PasswordCheckVerification} = require('recaptcha-password-check-helpers'); +import {RecaptchaEnterpriseServiceClient} from '@google-cloud/recaptcha-enterprise'; +import {PasswordCheckVerification} from 'recaptcha-password-check-helpers'; // TODO(developer): Uncomment and set the following variables // Google Cloud Project ID. @@ -168,3 +166,4 @@ checkPasswordLeak(projectId, username, password).catch(err => { process.exitCode = 1; }); // [END recaptcha_enterprise_password_leak_verification] +module.exports = checkPasswordLeak diff --git a/recaptcha_enterprise/snippets/tsconfig.json b/recaptcha_enterprise/snippets/tsconfig.json index 98adaa3d86..4b3e8094dd 100644 --- a/recaptcha_enterprise/snippets/tsconfig.json +++ b/recaptcha_enterprise/snippets/tsconfig.json @@ -4,6 +4,7 @@ "strict": true, "noImplicitAny": false, "esModuleInterop": true, - "moduleResolution": "node" + "moduleResolution": "node", + "module": "ESNext" } }