diff --git a/.github/actions/e2e-clean/action.yml b/.github/actions/e2e-clean/action.yml index b70014d570..d59222463c 100644 --- a/.github/actions/e2e-clean/action.yml +++ b/.github/actions/e2e-clean/action.yml @@ -9,7 +9,6 @@ runs: steps: - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3 with: - node-version: 16 cache: 'npm' - run: npm ci shell: bash diff --git a/.github/actions/e2e-run/action.yml b/.github/actions/e2e-run/action.yml index dfee6cfd7b..d598761ff2 100644 --- a/.github/actions/e2e-run/action.yml +++ b/.github/actions/e2e-run/action.yml @@ -34,7 +34,6 @@ runs: git config --global core.eol lf - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3 with: - node-version: ${{inputs.node}} cache: 'npm' - uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # tag=v4 with: diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index 93b5f3755b..4a3e001f4e 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -36,8 +36,6 @@ jobs: # pulls all commits (needed for finding the @coveo/cli version to release) fetch-depth: 0 - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3 - with: - node-version: '16' - name: Setup run: npm i - name: Get tags diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da56cbb9fe..937f580b88 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,9 +34,7 @@ jobs: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3 with: - node-version: 16 cache: 'npm' - - name: Setup repo run: npm ci - name: Check linting @@ -48,7 +46,6 @@ jobs: fail-fast: true matrix: os: ['ubuntu-latest', 'windows-latest'] - node: [16] steps: - name: Setup runner if: ${{matrix.os == 'ubuntu-latest'}} @@ -62,7 +59,6 @@ jobs: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3 with: - node-version: ${{matrix.node}} cache: 'npm' - name: Setup repo run: npm ci @@ -83,7 +79,6 @@ jobs: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3 with: - node-version: ${{matrix.node}} cache: 'npm' - uses: ./.github/actions/e2e-login id: setup @@ -105,7 +100,6 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3 with: - node-version: ${{matrix.node}} cache: 'npm' - uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3 if: ${{matrix.os == 'ubuntu-latest'}} @@ -135,7 +129,6 @@ jobs: fail-fast: false matrix: os: ['ubuntu-latest', 'windows-latest'] - node: [16] spec: [ 'angular.specs.ts', diff --git a/.github/workflows/daily-e2e.yml b/.github/workflows/daily-e2e.yml index 73801dae43..a15b8acea2 100644 --- a/.github/workflows/daily-e2e.yml +++ b/.github/workflows/daily-e2e.yml @@ -40,9 +40,7 @@ jobs: run: git checkout $(git describe --abbrev=0 --tags) - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3 with: - node-version: ${{matrix.node}} cache: 'npm' - - name: Install Coveo CLI run: npm i -g @coveo/cli@latest - uses: ./.github/actions/e2e-login @@ -56,7 +54,7 @@ jobs: fail-fast: false matrix: os: ['ubuntu-latest', 'windows-latest'] - node: [16] + node: [18] spec: [ 'angular.specs.ts', diff --git a/.github/workflows/delete-resources.yml b/.github/workflows/delete-resources.yml index 12021b7bd3..1d45524a05 100644 --- a/.github/workflows/delete-resources.yml +++ b/.github/workflows/delete-resources.yml @@ -20,7 +20,6 @@ jobs: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3 with: - node-version: '16' cache: 'npm' - run: npm ci - name: Resume org diff --git a/.github/workflows/prbot.yml b/.github/workflows/prbot.yml index 51e7b9594b..8a708891d0 100644 --- a/.github/workflows/prbot.yml +++ b/.github/workflows/prbot.yml @@ -12,7 +12,5 @@ jobs: with: fetch-depth: 0 - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3 - with: - node-version: '16' - run: npm i - run: npm run pr:report diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 579d4c7cdd..ab25bcd892 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,8 +22,6 @@ jobs: steps: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3 - with: - node-version: '16' - name: Install dependencies run: | npm ci @@ -56,7 +54,6 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3 with: - node-version: '16' registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: npm ci diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000..25bf17fc5a --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index ae4bc62679..4b8db6eac1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,7 +63,7 @@ "yargs": "17.5.1" }, "engines": { - "node": ">=16", + "node": ">=18", "npm": ">=8.5.4" } }, @@ -9422,7 +9422,6 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dev": true, "dependencies": { "streamsearch": "^1.1.0" }, @@ -48686,7 +48685,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "dev": true, "engines": { "node": ">=10.0.0" } @@ -51888,7 +51886,7 @@ "wait-on": "6.0.1" }, "engines": { - "node": ">=14.16.1" + "node": ">=18" } }, "packages/cli/commons": { @@ -51962,7 +51960,8 @@ "semver": "^7.3.4", "tmp": "^0.2.1", "ts-dedent": "2.2.0", - "tslib": "2.4.0" + "tslib": "2.4.0", + "undici": "5.11.0" }, "bin": { "coveo": "bin/run" @@ -52002,11 +52001,11 @@ "typescript": "4.8.3" }, "engines": { - "node": ">=14.15.1 <18" + "node": "16.x || 18.x" }, "peerDependencies": { "@angular/cli": "^14.0.1", - "@vue/cli": "^4.5.11 || ^5.0.0", + "@vue/cli": "^5.0.8", "create-react-app": "*" }, "peerDependenciesMeta": { @@ -52027,6 +52026,17 @@ "integrity": "sha512-m+6nTEOadJZuTPkKR/SYK3A2d7FZrgElol9UP1Kae90VVU4a6mxnPuLiIW1m4Cq4gZ/nWb9GrdVXJCoCazDAbg==", "dev": true }, + "packages/cli/core/node_modules/undici": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.11.0.tgz", + "integrity": "sha512-oWjWJHzFet0Ow4YZBkyiJwiK5vWqEYoH7BINzJAJOLedZ++JpAlCbUktW2GQ2DS2FpKmxD/JMtWUUWl1BtghGw==", + "dependencies": { + "busboy": "^1.6.0" + }, + "engines": { + "node": ">=12.18" + } + }, "packages/cli/source": { "name": "@coveo/cli-plugin-source", "version": "1.37.2", @@ -52059,7 +52069,7 @@ "typescript": "4.8.3" }, "engines": { - "node": ">=14.15.1 <18" + "node": "16.x || 18.x" } }, "packages/ui/angular": { @@ -52594,7 +52604,7 @@ "react-router-dom": "6.4.0" }, "engines": { - "node": ">=14" + "node": "16.x || 18.x" } }, "packages/ui/cra-template/node_modules/@mui/base": { @@ -55003,7 +55013,8 @@ "ts-node": "10.9.1", "tsconfig-paths": "4.1.0", "tslib": "2.4.0", - "typescript": "4.8.3" + "typescript": "4.8.3", + "undici": "5.11.0" }, "dependencies": { "@types/node": { @@ -55011,6 +55022,14 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.18.tgz", "integrity": "sha512-m+6nTEOadJZuTPkKR/SYK3A2d7FZrgElol9UP1Kae90VVU4a6mxnPuLiIW1m4Cq4gZ/nWb9GrdVXJCoCazDAbg==", "dev": true + }, + "undici": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.11.0.tgz", + "integrity": "sha512-oWjWJHzFet0Ow4YZBkyiJwiK5vWqEYoH7BINzJAJOLedZ++JpAlCbUktW2GQ2DS2FpKmxD/JMtWUUWl1BtghGw==", + "requires": { + "busboy": "^1.6.0" + } } } }, @@ -61683,7 +61702,6 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dev": true, "requires": { "streamsearch": "^1.1.0" } @@ -91446,8 +91464,7 @@ "streamsearch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "dev": true + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==" }, "strict-uri-encode": { "version": "2.0.0", diff --git a/package.json b/package.json index 2e7ed46fcc..2c2c1ec7a4 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "**/*.ts": "eslint --fix" }, "engines": { - "node": ">=16", + "node": ">=18", "npm": ">=8.5.4" }, "engineStrict": true, diff --git a/packages/cli-e2e/__tests__/auth.specs.ci.ts b/packages/cli-e2e/__tests__/auth.specs.ci.ts index 38203df3f3..dc4377110d 100644 --- a/packages/cli-e2e/__tests__/auth.specs.ci.ts +++ b/packages/cli-e2e/__tests__/auth.specs.ci.ts @@ -24,6 +24,7 @@ describe('auth', () => { port: 9222, userDataDir: false, maxConnectionRetries: 240, //equivalent to 2 minutes with the default pollrate of 500ms + logLevel: 'verbose', }); browser = await connectToChromeBrowser(); diff --git a/packages/cli-e2e/__tests__/orgList.specs.ts b/packages/cli-e2e/__tests__/orgList.specs.ts index 9c0298dd3a..015ed180fc 100644 --- a/packages/cli-e2e/__tests__/orgList.specs.ts +++ b/packages/cli-e2e/__tests__/orgList.specs.ts @@ -16,6 +16,18 @@ describe('org:list', () => { const proxyProcessManager = new ProcessManager(); processManagers.push(proxyProcessManager); proxyTerminal = startMitmProxy(proxyProcessManager); + await Promise.race([ + proxyTerminal + .when(/listening/) + .on('stdout') + .do() + .once(), + proxyTerminal + .when(/listening/) + .on('stderr') + .do() + .once(), + ]); await waitForMitmProxy(); }, 2 * 60e3); diff --git a/packages/cli-e2e/__tests__/orgResources.specs.ts b/packages/cli-e2e/__tests__/orgResources.specs.ts index a06291985c..32437792fb 100644 --- a/packages/cli-e2e/__tests__/orgResources.specs.ts +++ b/packages/cli-e2e/__tests__/orgResources.specs.ts @@ -24,6 +24,7 @@ import {getTestOrg} from '../utils/testOrgSetup'; import {readdirSync} from 'fs'; import {cwd} from 'process'; import {EOL} from 'os'; +import retry from 'async-retry'; config({path: getEnvFilePath()}); describe('org:resources', () => { @@ -210,8 +211,10 @@ describe('org:resources', () => { const getResourceFolderContent = (projectPath: string) => readdirSync(join(projectPath, 'resources')); - beforeEach(() => { - rmSync(destinationPath, {recursive: true, force: true}); + beforeEach(async () => { + await retry(() => { + rmSync(destinationPath, {recursive: true, force: true}); + }); ensureDirSync(destinationPath); }); diff --git a/packages/cli-e2e/package.json b/packages/cli-e2e/package.json index b3b9780fac..813cb441fd 100644 --- a/packages/cli-e2e/package.json +++ b/packages/cli-e2e/package.json @@ -33,7 +33,7 @@ "url": "https://github.com/coveo/cli/issues" }, "engines": { - "node": ">=14.16.1" + "node": ">=18" }, "devDependencies": { "@actions/core": "1.9.1", diff --git a/packages/cli-e2e/utils/browser.ts b/packages/cli-e2e/utils/browser.ts index 5b15eef1e6..82be0b8eb6 100644 --- a/packages/cli-e2e/utils/browser.ts +++ b/packages/cli-e2e/utils/browser.ts @@ -1,7 +1,9 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import axios from 'axios'; -import {resolve} from 'path'; - +import {resolve} from 'node:path'; +import {Agent as HttpAgent} from 'node:http'; +import {promises as dnsPromises} from 'node:dns'; +import {URL} from 'node:url'; import puppeteer from 'puppeteer'; import type {Browser, Page} from 'puppeteer'; const CHROME_JSON_DEBUG_URL = 'http://localhost:9222/json/version'; @@ -32,9 +34,13 @@ export async function closeAllPages(browser: Browser) { async function getWsUrl(): Promise { const chromeDebugInfoRaw = ( - await axios.get(CHROME_JSON_DEBUG_URL) + await axios.get(CHROME_JSON_DEBUG_URL, { + httpAgent: new HttpAgent({family: 4}), + }) ).data; - return chromeDebugInfoRaw.webSocketDebuggerUrl; + const wsUrl = new URL(chromeDebugInfoRaw.webSocketDebuggerUrl); + wsUrl.hostname = (await dnsPromises.resolve4(wsUrl.hostname))[0]; + return wsUrl.toString(); } function getChromeDefaultOptions() { @@ -45,7 +51,10 @@ function getChromeDefaultOptions() { */ export async function connectToChromeBrowser(): Promise { const wsURL = await getWsUrl(); - return puppeteer.connect({browserWSEndpoint: wsURL}); + console.error('WS_URL:' + wsURL); + return puppeteer.connect({ + browserWSEndpoint: wsURL, + }); } export async function getNewBrowser(): Promise { diff --git a/packages/cli-e2e/utils/mitmproxy.ts b/packages/cli-e2e/utils/mitmproxy.ts index 93d2f52bc1..7d0090c5c4 100644 --- a/packages/cli-e2e/utils/mitmproxy.ts +++ b/packages/cli-e2e/utils/mitmproxy.ts @@ -11,7 +11,16 @@ export const startMitmProxy = ( const mitmScript = join(__dirname, '..', 'mitmproxy', 'main.py'); const serverTerminal = new Terminal( 'python', - [mitmScript, '-p', '8080'], + [ + '-u', + mitmScript, + '-p', + '8080', + '--listen-host', + 'localhost', + '--flow-detail', + '1', + ], undefined, processManager, terminalDebugName diff --git a/packages/cli-e2e/verdaccio/config.yaml b/packages/cli-e2e/verdaccio/config.yaml index d773600889..6281f42644 100644 --- a/packages/cli-e2e/verdaccio/config.yaml +++ b/packages/cli-e2e/verdaccio/config.yaml @@ -45,4 +45,3 @@ logs: listen: - localhost:4873 # default value - - '[::1]:4873' # ipv6 diff --git a/packages/cli/commons/src/platform/authenticatedClient.ts b/packages/cli/commons/src/platform/authenticatedClient.ts index 1ae9ddfe03..9af2c51286 100644 --- a/packages/cli/commons/src/platform/authenticatedClient.ts +++ b/packages/cli/commons/src/platform/authenticatedClient.ts @@ -1,11 +1,10 @@ -require('isomorphic-fetch'); -require('abortcontroller-polyfill'); - +import {setGlobalDispatcher, ProxyAgent, FormData, fetch} from 'undici'; import PlatformClient from '@coveo/platform-client'; import {Config, Configuration} from '../config/config'; import {castEnvironmentToPlatformClient} from './environment'; -import HttpsProxyAgent from 'https-proxy-agent'; import globalConfig from '../config/globalConfig'; +import {lt} from 'semver'; + export class AuthenticatedClient { public cfg: Config; public constructor() { @@ -34,8 +33,10 @@ export class AuthenticatedClient { const proxyServer = process.env['https_proxy'] || process.env['HTTPS_PROXY']; if (proxyServer) { - const httpsProxyAgent = HttpsProxyAgent(proxyServer); - globalRequestSettings.agent = httpsProxyAgent; + setGlobalDispatcher(new ProxyAgent(proxyServer)); + } + if (lt(process.version, '18.0.0')) { + Object.assign(global, {FormData, fetch}); } return new PlatformClient({ globalRequestSettings, diff --git a/packages/cli/core/package.json b/packages/cli/core/package.json index 252cadabb6..94d856f58b 100644 --- a/packages/cli/core/package.json +++ b/packages/cli/core/package.json @@ -4,7 +4,7 @@ "author": "Coveo", "description": "Coveo CLI", "engines": { - "node": ">=14.15.1 <18" + "node": "16.x || 18.x" }, "dependencies": { "@amplitude/identify": "^1.9.0", @@ -36,7 +36,8 @@ "semver": "^7.3.4", "tmp": "^0.2.1", "ts-dedent": "2.2.0", - "tslib": "2.4.0" + "tslib": "2.4.0", + "undici": "5.11.0" }, "devDependencies": { "@amplitude/types": "1.10.2", @@ -74,7 +75,7 @@ }, "peerDependencies": { "@angular/cli": "^14.0.1", - "@vue/cli": "^4.5.11 || ^5.0.0", + "@vue/cli": "^5.0.8", "create-react-app": "*" }, "peerDependenciesMeta": { diff --git a/packages/cli/core/src/commands/ui/create/atomic.ts b/packages/cli/core/src/commands/ui/create/atomic.ts index fce6bc0dc0..0a8ff24e0b 100644 --- a/packages/cli/core/src/commands/ui/create/atomic.ts +++ b/packages/cli/core/src/commands/ui/create/atomic.ts @@ -25,7 +25,7 @@ import {getPackageVersion} from '../../../lib/utils/misc'; export default class Atomic extends CLICommand { public static cliPackage = '@coveo/create-atomic'; - public static requiredNodeVersion = '>=14.0.0 <17.0.0'; // https://github.com/netlify/cli/issues/3617 + public static requiredNodeVersion = '16.x || 18.x'; public static description = "Create a Coveo Headless-powered search page with Coveo's own Atomic framework. See and ."; public static examples = ['$ coveo ui:create:atomic myapp']; diff --git a/packages/cli/core/src/lib/snapshot/snapshotFactory.spec.ts b/packages/cli/core/src/lib/snapshot/snapshotFactory.spec.ts index 58727e0b9c..f6a6351b57 100644 --- a/packages/cli/core/src/lib/snapshot/snapshotFactory.spec.ts +++ b/packages/cli/core/src/lib/snapshot/snapshotFactory.spec.ts @@ -2,7 +2,7 @@ jest.mock('@coveo/cli-commons/platform/authenticatedClient'); jest.mock('fs'); jest.mock('./snapshot'); jest.mock('./snapshotAccess'); - +jest.mock('node:buffer'); import {ResourceSnapshotType} from '@coveo/platform-client'; import {readFileSync} from 'fs'; import {join} from 'path'; @@ -13,11 +13,13 @@ import {Snapshot} from './snapshot'; import {SnapshotFactory} from './snapshotFactory'; import {Project} from '../project/project'; import {ensureResourcesAccess, ensureSnapshotAccess} from './snapshotAccess'; +import {Blob} from 'node:buffer'; +const mockedBlob = jest.mocked(Blob); const mockedReadFileSync = jest.mocked(readFileSync); const mockedAuthenticatedClient = jest.mocked(AuthenticatedClient); const mockedSnapshot = jest.mocked(Snapshot); -const mockedCreateSnapshotFromBuffer = jest.fn(); +const mockedCreateSnapshotFromFile = jest.fn(); const mockedCreateFromOrganization = jest.fn(); const mockedPushSnapshot = jest.fn(); const mockedDryRunSnapshot = jest.fn(); @@ -47,7 +49,7 @@ const doMockAuthenticatedClient = () => { Promise.resolve({ resourceSnapshot: { get: mockedGetSnapshot, - createFromBuffer: mockedCreateSnapshotFromBuffer, + createFromFile: mockedCreateSnapshotFromFile, createFromOrganization: mockedCreateFromOrganization, push: mockedPushSnapshot, dryRun: mockedDryRunSnapshot, @@ -106,16 +108,14 @@ describe('SnapshotFactory', () => { fancyIt()( '#createSnapshotFromProject should retrieve an authenticated client', () => { - expect(mockedCreateSnapshotFromBuffer).toHaveBeenCalledTimes(1); + expect(mockedCreateSnapshotFromFile).toHaveBeenCalledTimes(1); } ); - fancyIt()( '#createSnapshotFromProject should create a snapshot from Zip with appropriate parameters', () => { - expect(mockedCreateSnapshotFromBuffer).toHaveBeenCalledWith( - Buffer.from('hello there'), - 'ZIP', + expect(mockedCreateSnapshotFromFile).toHaveBeenCalledWith( + mockedBlob.mock.instances[0], { developerNotes: 'cli-created-from-zip', } diff --git a/packages/cli/core/src/lib/snapshot/snapshotFactory.ts b/packages/cli/core/src/lib/snapshot/snapshotFactory.ts index 0bf9290b7b..06f044be2b 100644 --- a/packages/cli/core/src/lib/snapshot/snapshotFactory.ts +++ b/packages/cli/core/src/lib/snapshot/snapshotFactory.ts @@ -1,7 +1,6 @@ import { CreateFromFileOptions, ResourceSnapshotsReportType, - ResourceSnapshotSupportedFileTypes, ResourceSnapshotType, } from '@coveo/platform-client'; import {readFileSync} from 'fs'; @@ -10,6 +9,7 @@ import {SnapshotPullModelResources} from './pullModel/interfaces'; import {Snapshot, WaitUntilDoneOptions} from './snapshot'; import {Project} from '../project/project'; import {ensureResourcesAccess, ensureSnapshotAccess} from './snapshotAccess'; +import {Blob} from 'node:buffer'; export class SnapshotFactory { public static async createSnapshotFromProject( @@ -21,14 +21,15 @@ export class SnapshotFactory { await ensureResourcesAccess(client, project.resourceTypes); const pathToZip = await project.compressResources(); const file = readFileSync(pathToZip); - + const blob = new Blob([file], { + type: 'application/zip', + }); const computedOptions: CreateFromFileOptions = { developerNotes: 'cli-created-from-zip', }; - const model = await client.resourceSnapshot.createFromBuffer( - file, - ResourceSnapshotSupportedFileTypes.ZIP, + const model = await client.resourceSnapshot.createFromFile( + blob, computedOptions ); const snapshot = new Snapshot(model, client); diff --git a/packages/cli/source/package.json b/packages/cli/source/package.json index 4b402ab423..623b3ce2cd 100644 --- a/packages/cli/source/package.json +++ b/packages/cli/source/package.json @@ -72,7 +72,7 @@ "prepublishOnly": "rimraf lib && npm run build && oclif manifest" }, "engines": { - "node": ">=14.15.1 <18" + "node": "16.x || 18.x" }, "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 a5796f1260..d597b438ce 100644 --- a/packages/ui/cra-template/package.json +++ b/packages/ui/cra-template/package.json @@ -19,7 +19,7 @@ }, "license": "Apache-2.0", "engines": { - "node": ">=14" + "node": "16.x || 18.x" }, "files": [ "template", diff --git a/packages/ui/vue/create-headless-vue/index.js b/packages/ui/vue/create-headless-vue/index.js old mode 100644 new mode 100755 diff --git a/renovate.json b/renovate.json index 58df5e8aab..401aaf76da 100644 --- a/renovate.json +++ b/renovate.json @@ -48,9 +48,9 @@ }, { "matchPackageNames": ["@types/node"], - "matchCurrentVersion": "16.x", - "allowedVersions": "16.x", - "description": "CDX-1130" + "matchCurrentVersion": "18.x", + "allowedVersions": "18.x", + "description": "We stay on the LTS" } ], "rangeStrategy": "auto",