diff --git a/scripts/cache.ts b/scripts/cache.ts index d8917d837b3..2024dd479cc 100644 --- a/scripts/cache.ts +++ b/scripts/cache.ts @@ -2,7 +2,7 @@ import fsp from 'fs/promises'; import { hashElement } from 'folder-hash'; -import { exists } from './common'; +import { exists } from './common.js'; export class Cache { folder: string; diff --git a/scripts/ci/codegen/createGitHubReleases.ts b/scripts/ci/codegen/createGitHubReleases.ts index ba18bf7eb41..2b73735b7e5 100644 --- a/scripts/ci/codegen/createGitHubReleases.ts +++ b/scripts/ci/codegen/createGitHubReleases.ts @@ -1,9 +1,9 @@ -import { ensureGitHubToken, getOctokit, OWNER, run, setVerbose, toAbsolutePath } from '../../common'; -import { isPreRelease } from '../../release/versionsHistory'; -import type { Language } from '../../types'; -import { cloneRepository } from '../utils'; +import { ensureGitHubToken, getOctokit, OWNER, run, setVerbose, toAbsolutePath } from '../../common.js'; +import { isPreRelease } from '../../release/versionsHistory.js'; +import type { Language } from '../../types.js'; +import { cloneRepository } from '../utils.js'; -import { commitStartRelease } from './text'; +import { commitStartRelease } from './text.js'; async function createGitHubRelease(lang: Language): Promise { // **Full Changelog**: diff --git a/scripts/ci/codegen/waitForAllReleases.ts b/scripts/ci/codegen/waitForAllReleases.ts index fc2d6f2bc9a..f0111caf3cb 100644 --- a/scripts/ci/codegen/waitForAllReleases.ts +++ b/scripts/ci/codegen/waitForAllReleases.ts @@ -1,11 +1,11 @@ import type { components } from '@octokit/openapi-types'; -import { exists, getOctokit, run, setVerbose, toAbsolutePath } from '../../common'; -import { getClientsConfigField, getLanguageFolder } from '../../config'; -import { getTargetBranch } from '../../release/common'; -import type { Language } from '../../types'; +import { exists, getOctokit, run, setVerbose, toAbsolutePath } from '../../common.js'; +import { getClientsConfigField, getLanguageFolder } from '../../config.js'; +import { getTargetBranch } from '../../release/common.js'; +import type { Language } from '../../types.js'; -import { commitStartRelease } from './text'; +import { commitStartRelease } from './text.js'; type Run = { language: Language; diff --git a/scripts/cli/index.ts b/scripts/cli/index.ts index b1f7dec0929..65c2b16f7e8 100644 --- a/scripts/cli/index.ts +++ b/scripts/cli/index.ts @@ -6,14 +6,14 @@ import { CI, CLIENTS, LANGUAGES, run, setVerbose, toAbsolutePath } from '../comm import { getLanguageFolder } from '../config.js'; import { ctsGenerateMany } from '../cts/generate.js'; import { runCts } from '../cts/runCts.js'; -import { startTestServer } from '../cts/testServer'; +import { startTestServer } from '../cts/testServer/index.js'; import { docsGenerateMany } from '../docs/generate.js'; import { formatter } from '../formatter.js'; import { generate } from '../generate.js'; import { playground } from '../playground.js'; import { createReleasePR } from '../release/createReleasePR.js'; import { generateVersionsHistory } from '../release/versionsHistory.js'; -import { buildSpecs } from '../specs'; +import { buildSpecs } from '../specs/index.js'; import type { Language } from '../types.js'; import { existsSync } from 'node:fs'; diff --git a/scripts/common.ts b/scripts/common.ts index bf17469231e..28ebc98dd8c 100644 --- a/scripts/common.ts +++ b/scripts/common.ts @@ -9,11 +9,11 @@ import { remove } from 'fs-extra'; import clientsConfig from '../config/clients.config.json' assert { type: 'json' }; import releaseConfig from '../config/release.config.json' assert { type: 'json' }; -import { Cache } from './cache'; -import { getDockerImage } from './config'; -import { generateOpenapitools } from './pre-gen'; +import { Cache } from './cache.js'; +import { getDockerImage } from './config.js'; +import { generateOpenapitools } from './pre-gen/index.js'; import { getGitAuthor } from './release/common.js'; -import { buildSpecs } from './specs'; +import { buildSpecs } from './specs/index.js'; import { createSpinner } from './spinners.js'; import type { Generator, GeneratorMode, Language, RunOptions } from './types.js'; diff --git a/scripts/config.ts b/scripts/config.ts index f3c814d04c0..1a4bda1f16a 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -1,6 +1,6 @@ import clientsConfig from '../config/clients.config.json' assert { type: 'json' }; -import { CI } from './common'; +import { CI } from './common.js'; import type { Language, LanguageConfig } from './types.js'; export function getClientsConfigField( diff --git a/scripts/cts/runCts.ts b/scripts/cts/runCts.ts index ee72387d62c..9caa155ae45 100644 --- a/scripts/cts/runCts.ts +++ b/scripts/cts/runCts.ts @@ -5,9 +5,9 @@ import { getTestOutputFolder } from '../config.js'; import { createSpinner } from '../spinners.js'; import type { Language } from '../types.js'; -import { startTestServer } from './testServer'; import { printBenchmarkReport } from './testServer/benchmark.js'; import { assertChunkWrapperValid } from './testServer/chunkWrapper.js'; +import { startTestServer } from './testServer/index.js'; import { assertValidReplaceAllObjects } from './testServer/replaceAllObjects.js'; import { assertValidTimeouts } from './testServer/timeout.js'; import { assertValidWaitForApiKey } from './testServer/waitFor.js'; diff --git a/scripts/cts/testServer/apiKey.ts b/scripts/cts/testServer/apiKey.ts index 00ea0ed28e1..f2a05f30a16 100644 --- a/scripts/cts/testServer/apiKey.ts +++ b/scripts/cts/testServer/apiKey.ts @@ -3,7 +3,7 @@ import type { Server } from 'http'; import { expect } from 'chai'; import type { Express, Request, Response } from 'express'; -import { setupServer } from '.'; +import { setupServer } from './index.js'; // Checks that the client sends a different API key after the first request. function addRoutes(app: Express): void { diff --git a/scripts/cts/testServer/benchmark.ts b/scripts/cts/testServer/benchmark.ts index 430d94824b7..815d90636db 100644 --- a/scripts/cts/testServer/benchmark.ts +++ b/scripts/cts/testServer/benchmark.ts @@ -6,9 +6,9 @@ import chalk from 'chalk'; import type { Express } from 'express'; import express from 'express'; -import { CI, toAbsolutePath } from '../../common'; +import { CI, toAbsolutePath } from '../../common.js'; -import { setupServer } from '.'; +import { setupServer } from './index.js'; const benchmarkStatus: Record< string, diff --git a/scripts/cts/testServer/chunkWrapper.ts b/scripts/cts/testServer/chunkWrapper.ts index 25640e7a787..b69d36a5c18 100644 --- a/scripts/cts/testServer/chunkWrapper.ts +++ b/scripts/cts/testServer/chunkWrapper.ts @@ -4,7 +4,7 @@ import { expect } from 'chai'; import type { Express } from 'express'; import express from 'express'; -import { setupServer } from '.'; +import { setupServer } from './index.js'; const chunkWrapperState: Record = {}; diff --git a/scripts/cts/testServer/gzip.ts b/scripts/cts/testServer/gzip.ts index bf033bce73c..5ea6d828b6e 100644 --- a/scripts/cts/testServer/gzip.ts +++ b/scripts/cts/testServer/gzip.ts @@ -4,9 +4,9 @@ import zlib from 'node:zlib'; import crc32 from 'crc/crc32'; import type { Express } from 'express'; -import { retryHandler } from './timeout'; +import { retryHandler } from './timeout.js'; -import { setupServer } from '.'; +import { setupServer } from './index.js'; function addRoutes(app: Express): void { app.get('/1/test/retry/:lang', retryHandler(0, 'ok test server response')); diff --git a/scripts/cts/testServer/index.ts b/scripts/cts/testServer/index.ts index 1ffa3bc72b9..5bc595f9f2e 100644 --- a/scripts/cts/testServer/index.ts +++ b/scripts/cts/testServer/index.ts @@ -3,17 +3,17 @@ import type { Server } from 'http'; import type { Express } from 'express'; import express from 'express'; -import { createSpinner } from '../../spinners'; -import type { CTSType } from '../runCts'; +import { createSpinner } from '../../spinners.js'; +import type { CTSType } from '../runCts.js'; -import { apiKeyServer } from './apiKey'; -import { benchmarkServer } from './benchmark'; -import { chunkWrapperServer } from './chunkWrapper'; -import { gzipServer } from './gzip'; -import { replaceAllObjectsServer } from './replaceAllObjects'; -import { timeoutServer } from './timeout'; -import { timeoutServerBis } from './timeoutBis'; -import { waitForApiKeyServer } from './waitFor'; +import { apiKeyServer } from './apiKey.js'; +import { benchmarkServer } from './benchmark.js'; +import { chunkWrapperServer } from './chunkWrapper.js'; +import { gzipServer } from './gzip.js'; +import { replaceAllObjectsServer } from './replaceAllObjects.js'; +import { timeoutServer } from './timeout.js'; +import { timeoutServerBis } from './timeoutBis.js'; +import { waitForApiKeyServer } from './waitFor.js'; export async function startTestServer(suites: Record): Promise<() => Promise> { const toStart: Array> = []; diff --git a/scripts/cts/testServer/replaceAllObjects.ts b/scripts/cts/testServer/replaceAllObjects.ts index 42afbebe4be..33278723e1e 100644 --- a/scripts/cts/testServer/replaceAllObjects.ts +++ b/scripts/cts/testServer/replaceAllObjects.ts @@ -4,7 +4,7 @@ import { expect } from 'chai'; import type { Express } from 'express'; import express from 'express'; -import { setupServer } from '.'; +import { setupServer } from './index.js'; const raoState: Record< string, diff --git a/scripts/cts/testServer/timeout.ts b/scripts/cts/testServer/timeout.ts index 61c710a55ab..1309dd8c7e7 100644 --- a/scripts/cts/testServer/timeout.ts +++ b/scripts/cts/testServer/timeout.ts @@ -3,7 +3,7 @@ import type { Server } from 'http'; import { expect } from 'chai'; import type express from 'express'; -import { setupServer } from '.'; +import { setupServer } from './index.js'; const timeoutState: Record = {}; diff --git a/scripts/cts/testServer/timeoutBis.ts b/scripts/cts/testServer/timeoutBis.ts index 21b494dbde6..d9b6bd8ffc5 100644 --- a/scripts/cts/testServer/timeoutBis.ts +++ b/scripts/cts/testServer/timeoutBis.ts @@ -2,9 +2,9 @@ import type { Server } from 'http'; import type express from 'express'; -import { retryHandler } from './timeout'; +import { retryHandler } from './timeout.js'; -import { setupServer } from '.'; +import { setupServer } from './index.js'; function addRoutes(app: express.Express): void { // this endpoint is also defined in the gzip server but without the timeout diff --git a/scripts/cts/testServer/waitFor.ts b/scripts/cts/testServer/waitFor.ts index 68f68e4b6ed..b4909bb441c 100644 --- a/scripts/cts/testServer/waitFor.ts +++ b/scripts/cts/testServer/waitFor.ts @@ -3,7 +3,7 @@ import type { Server } from 'http'; import { expect } from 'chai'; import type { Express } from 'express'; -import { setupServer } from '.'; +import { setupServer } from './index.js'; const retryCount: Record< string, diff --git a/scripts/generate.ts b/scripts/generate.ts index 04beefe3652..65dc26141cf 100644 --- a/scripts/generate.ts +++ b/scripts/generate.ts @@ -1,7 +1,7 @@ import { callGenerator, setupAndGen } from './common.js'; import { getLanguageFolder } from './config.js'; import { formatter } from './formatter.js'; -import { removeExistingCodegen } from './pre-gen'; +import { removeExistingCodegen } from './pre-gen/index.js'; import type { Generator } from './types.js'; async function preGen(gen: Generator): Promise { diff --git a/scripts/specs/__tests__/snippets.test.ts b/scripts/specs/__tests__/snippets.test.ts index 818b11fdb4b..0f4038c52fc 100644 --- a/scripts/specs/__tests__/snippets.test.ts +++ b/scripts/specs/__tests__/snippets.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; -import { transformCodeSamplesToGuideMethods } from '../snippets'; -import { SnippetSamples } from '../types'; +import { transformCodeSamplesToGuideMethods } from '../snippets.js'; +import { SnippetSamples } from '../types.js'; describe('init', () => { it('parses a multi line import', () => { diff --git a/scripts/specs/types.ts b/scripts/specs/types.ts index ce118331e63..25b0c7a3c7a 100644 --- a/scripts/specs/types.ts +++ b/scripts/specs/types.ts @@ -1,4 +1,4 @@ -import type { Language } from '../types'; +import type { Language } from '../types.js'; export type BaseBuildSpecsOptions = { outputFormat: 'json' | 'yml'; diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 83692f53b9f..f6deb3d7d68 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../config/base.tsconfig.json", "compilerOptions": { - "module": "esnext", + "module": "nodenext", "target": "esnext", "typeRoots": ["../node_modules/@types"], "types": ["node"], diff --git a/scripts/types.ts b/scripts/types.ts index 2b900487548..c5236c59d38 100644 --- a/scripts/types.ts +++ b/scripts/types.ts @@ -1,6 +1,6 @@ import type config from '../config/clients.config.json'; -import type { CodeSamples } from './specs/types'; +import type { CodeSamples } from './specs/types.js'; /** * Config.