From 3e6520737650901d2b176fadc8e2e56441a8d4da Mon Sep 17 00:00:00 2001 From: Olivier Lamothe Date: Wed, 18 Oct 2023 17:06:25 -0400 Subject: [PATCH] feat(cli): change node support to only 18-20 (#1335) https://coveord.atlassian.net/browse/CDX-1408 ## Proposed changes I recently changed these files to drop support for 16. However, we want to only support 18-20 ranges (not everything above 18) ## Breaking changes Drop support for older version of node js ## Testing - [X] Unit Tests: - [X] Functionnal Tests: - [ ] Manual Tests: --------- Co-authored-by: Louis Bompart --- .github/actions/e2e-run/action.yml | 4 ++-- .github/workflows/build.yml | 3 ++- .nvmrc | 2 +- packages/cli/core/package.json | 2 +- packages/cli/core/src/commands/ui/create/angular.ts | 4 ++-- packages/cli/core/src/commands/ui/create/react.ts | 4 ++-- packages/cli/core/src/commands/ui/create/vue.ts | 2 +- packages/cli/core/src/lib/atomic/createAtomicProject.ts | 2 +- packages/cli/source/package.json | 2 +- packages/ui/cra-template/package.json | 2 +- scripts/cleaning/delete-api-keys.js | 8 ++------ scripts/cleaning/delete-orgs.js | 7 ++----- 12 files changed, 18 insertions(+), 24 deletions(-) diff --git a/.github/actions/e2e-run/action.yml b/.github/actions/e2e-run/action.yml index e6bdb40ae4..8262b96b08 100644 --- a/.github/actions/e2e-run/action.yml +++ b/.github/actions/e2e-run/action.yml @@ -39,7 +39,7 @@ runs: - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 with: cache: 'npm' - node-version-file: '.nvmrc' + node-version: ${{inputs.node}} - uses: actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b # v4 with: cache: 'pip' @@ -79,5 +79,5 @@ runs: - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3 if: cancelled() || failure() || success() with: - name: ${{inputs.os}}-${{inputs.spec}}-test-artifacts + name: ${{inputs.os}}-${{inputs.node}}-${{inputs.spec}}-test-artifacts path: ./packages/cli-e2e/artifacts diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00f741e4fc..3b00f65158 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -134,6 +134,7 @@ jobs: fail-fast: false matrix: os: ['ubuntu-20.04', 'windows-latest'] + node: ['18', '20'] spec: [ 'angular.specs.ts', @@ -151,7 +152,7 @@ jobs: spec: auth.specs.ci.ts env: # ID of the test run to identify resources to teardown. - TEST_RUN_ID: 'id${{ matrix.os }}-${{ github.sha }}-${{ github.run_attempt }}g' + TEST_RUN_ID: 'id${{ matrix.os }}-${{ matrix.node }}-${{ github.sha }}-${{ github.run_attempt }}g' COVEO_DISABLE_AUTOUPDATE: true CLI_CONFIG_JSON: ${{needs.e2e-setup-login.outputs.cliConfigJson}} steps: diff --git a/.nvmrc b/.nvmrc index 41d9dbcf4d..aad5ebe18d 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.18.1 \ No newline at end of file +20.8.0 \ No newline at end of file diff --git a/packages/cli/core/package.json b/packages/cli/core/package.json index 5107908894..dec581f0c5 100644 --- a/packages/cli/core/package.json +++ b/packages/cli/core/package.json @@ -4,7 +4,7 @@ "author": "Coveo", "description": "Coveo CLI", "engines": { - "node": ">=18.18.1" + "node": "^18.18.1 || ^20.8.1" }, "dependencies": { "@amplitude/analytics-node": "^1.3.3", diff --git a/packages/cli/core/src/commands/ui/create/angular.ts b/packages/cli/core/src/commands/ui/create/angular.ts index c1eb4b5e3e..220fa13fbf 100644 --- a/packages/cli/core/src/commands/ui/create/angular.ts +++ b/packages/cli/core/src/commands/ui/create/angular.ts @@ -29,8 +29,8 @@ export default class Angular extends CLICommand { * Requirements Based on https://angular.io/guide/setup-local * and https://www.npmjs.com/package/@angular/cli package.json engines section. */ - public static requiredNodeVersion = '>=18.18.1'; - public static requiredNpmVersion = '>=9.8.1'; + public static requiredNodeVersion = '^18.18.1 || ^20.8.1'; + public static requiredNpmVersion = '^9.8.1 || ^10.1.0'; public static requiredNgVersion = '^15.0.0'; public static description = diff --git a/packages/cli/core/src/commands/ui/create/react.ts b/packages/cli/core/src/commands/ui/create/react.ts index e9e0ab97e6..09d874d749 100644 --- a/packages/cli/core/src/commands/ui/create/react.ts +++ b/packages/cli/core/src/commands/ui/create/react.ts @@ -35,10 +35,10 @@ export default class React extends CLICommand { public static cliPackage = 'create-react-app@latest'; /** - * "You’ll need to have Node 18.1.1 or later version on your local development machine" + * "You’ll need to have Node 18.18.1 or later version on your local development machine" * https://github.com/facebook/create-react-app#creating-an-app */ - public static requiredNodeVersion = '>=18.1.1'; + public static requiredNodeVersion = '^18.18.1 || ^20.8.1'; public static description = 'Create a Coveo Headless-powered search page with the React web framework. See and .'; diff --git a/packages/cli/core/src/commands/ui/create/vue.ts b/packages/cli/core/src/commands/ui/create/vue.ts index 5ab2510a3d..a45d2bfde7 100644 --- a/packages/cli/core/src/commands/ui/create/vue.ts +++ b/packages/cli/core/src/commands/ui/create/vue.ts @@ -34,7 +34,7 @@ export default class Vue extends CLICommand { * @see https://cli.vuejs.org/guide/installation.html for current requirements. * @see https://github.com/vuejs/vue-cli/blob/dev/CHANGELOG.md for upcoming requirements. */ - public static requiredNodeVersion = '>=18.1.1'; + public static requiredNodeVersion = '^18.18.1 || ^20.8.1'; public static description = 'Create a Coveo Headless-powered search page with the Vue3 and Vite. See and .'; diff --git a/packages/cli/core/src/lib/atomic/createAtomicProject.ts b/packages/cli/core/src/lib/atomic/createAtomicProject.ts index ccd2b5c80d..336a4ce327 100644 --- a/packages/cli/core/src/lib/atomic/createAtomicProject.ts +++ b/packages/cli/core/src/lib/atomic/createAtomicProject.ts @@ -34,7 +34,7 @@ export const atomicAppInitializerPackage = '@coveo/create-atomic'; export const atomicLibInitializerPackage = '@coveo/create-atomic-component-project'; -const supportedNodeVersions = '>=18.1.1'; +const supportedNodeVersions = '^18.18.1 || ^20.8.1'; const transformPackageNameToNpmInitializer = (packageName: string) => packageName.replace('/create-', '/'); diff --git a/packages/cli/source/package.json b/packages/cli/source/package.json index cecb00ffaf..0f656f3c6a 100644 --- a/packages/cli/source/package.json +++ b/packages/cli/source/package.json @@ -74,7 +74,7 @@ "prepublishOnly": "rimraf lib && npm run build && oclif manifest" }, "engines": { - "node": ">=18.18.1" + "node": "^18.18.1 || ^20.8.1" }, "bugs": "https://github.com/coveo/cli/issues", "keywords": [ diff --git a/packages/ui/cra-template/package.json b/packages/ui/cra-template/package.json index d64978dad3..98b49085de 100644 --- a/packages/ui/cra-template/package.json +++ b/packages/ui/cra-template/package.json @@ -20,7 +20,7 @@ }, "license": "Apache-2.0", "engines": { - "node": ">=18.18.1" + "node": "^18.18.1 || ^20.8.1" }, "files": [ "template", diff --git a/scripts/cleaning/delete-api-keys.js b/scripts/cleaning/delete-api-keys.js index bcadb5ea0f..9df0c4b69e 100644 --- a/scripts/cleaning/delete-api-keys.js +++ b/scripts/cleaning/delete-api-keys.js @@ -1,6 +1,3 @@ -require('isomorphic-fetch'); -require('abortcontroller-polyfill'); - const {homedir} = require('os'); const {join} = require('path'); const {config} = require('dotenv'); @@ -9,9 +6,8 @@ config({path: join(homedir(), '.env')}); function wasCreatedByTheCli(testRunId = '') { return (key) => - (key.displayName?.startsWith(`cli-idwindows-latest-${testRunId}`) || - key.displayName?.startsWith(`cli-idubuntu-20-04-${testRunId}`) || - key.displayName?.startsWith(`cli-id${testRunId}`)) && + key.displayName?.startsWith('cli-id') && + key.displayName?.includes(testRunId) && key.description === 'Generated by the Coveo CLI'; } diff --git a/scripts/cleaning/delete-orgs.js b/scripts/cleaning/delete-orgs.js index a18f1ffbf7..a0ce7fe9ac 100644 --- a/scripts/cleaning/delete-orgs.js +++ b/scripts/cleaning/delete-orgs.js @@ -1,6 +1,3 @@ -require('isomorphic-fetch'); -require('abortcontroller-polyfill'); - const {homedir} = require('os'); const {join} = require('path'); const {config} = require('dotenv'); @@ -15,8 +12,8 @@ config({path: join(homedir(), '.env')}); function wasCreatedByTheCli(testRunId = '') { return (key) => testRunId - ? key.displayName?.startsWith(`cli-e2e-idwindows-latest-${testRunId}`) || - key.displayName?.startsWith(`cli-e2e-idubuntu-20-04-${testRunId}`) + ? key.displayName?.startsWith('cli-e2e-id') && + key.displayName?.includes(testRunId) : key.displayName?.match(/cli-e2e.*g/); }