From 94eaa027954f00064701ddc9820c563d85e2571f Mon Sep 17 00:00:00 2001 From: Romain Lenzotti Date: Sat, 18 Jan 2025 09:57:07 +0100 Subject: [PATCH] fix: use node: to prefix native nodejs module --- packages/cli-core/readme.md | 2 +- packages/cli-core/src/CliCore.ts | 3 ++- .../supports/YarnBerryManager.ts | 3 ++- .../src/services/CliDockerComposeYaml.ts | 3 ++- packages/cli-core/src/services/CliFs.ts | 5 +++-- .../cli-core/src/services/CliHttpClient.ts | 5 +++-- .../cli-core/src/services/CliHttpLogClient.ts | 3 ++- packages/cli-core/src/services/CliLoadFile.ts | 3 ++- .../cli-core/src/services/CliProxyAgent.ts | 3 ++- .../cli-core/src/services/NpmRegistryClient.ts | 3 ++- .../src/services/ProjectPackageJson.spec.ts | 3 ++- .../src/services/ProjectPackageJson.ts | 3 ++- packages/cli-core/src/services/Renderer.ts | 3 ++- .../cli-core/src/utils/getTemplateDirectory.ts | 3 ++- .../cli-core/src/utils/streamToObservable.ts | 3 ++- .../src/commands/GenerateHttpClientCmd.ts | 3 ++- .../src/commands/GenerateSwaggerCmd.ts | 3 ++- .../src/services/CliMongoose.ts | 3 ++- .../init.integration.spec.ts.snap | 4 ++-- .../src/services/CliPrisma.spec.ts | 3 ++- .../init.integration.spec.ts.snap | 4 ++-- .../init.integration.spec.ts.snap | 2 +- packages/cli-testing/src/FakeCliFs.ts | 5 +++-- packages/cli/scripts/index.esm.js | 2 +- .../cli/src/commands/generate/GenerateCmd.ts | 13 +++---------- packages/cli/src/commands/init/InitCmd.ts | 3 ++- packages/cli/src/constants/index.ts | 3 ++- packages/cli/src/pipes/ClassNamePipe.ts | 3 ++- packages/cli/src/pipes/OutputFilePathPipe.ts | 3 ++- .../cli/src/runtimes/supports/BabelRuntime.ts | 3 ++- .../src/runtimes/supports/WebpackRuntime.ts | 3 ++- packages/cli/templates/generate/server.hbs | 2 +- .../cli/templates/init/src/config/index.ts.hbs | 2 +- .../init.integration.spec.ts.snap | 18 +++++++++--------- .../integrations/init/init.integration.spec.ts | 3 ++- 35 files changed, 76 insertions(+), 57 deletions(-) diff --git a/packages/cli-core/readme.md b/packages/cli-core/readme.md index ad8240a3d..5d982838a 100644 --- a/packages/cli-core/readme.md +++ b/packages/cli-core/readme.md @@ -153,7 +153,7 @@ Create a new file according to your project name (example: `name.ts`) and add th ```typescript #!/usr/bin/env node import {AddCmd, CliCore} from "@tsed/cli-core"; -import {resolve} from "path"; +import {resolve} from "node:path"; const pkg = require("../../package.json"); const TEMPLATE_DIR = resolve(__dirname, "..", "..", "templates"); diff --git a/packages/cli-core/src/CliCore.ts b/packages/cli-core/src/CliCore.ts index e2bc44605..e9e502108 100644 --- a/packages/cli-core/src/CliCore.ts +++ b/packages/cli-core/src/CliCore.ts @@ -1,8 +1,9 @@ +import {join, resolve} from "node:path"; + import {Type} from "@tsed/core"; import {inject, InjectorService, Module} from "@tsed/di"; import chalk from "chalk"; import {Command} from "commander"; -import {join, resolve} from "path"; import semver from "semver"; import updateNotifier from "update-notifier"; diff --git a/packages/cli-core/src/packageManagers/supports/YarnBerryManager.ts b/packages/cli-core/src/packageManagers/supports/YarnBerryManager.ts index 488ced72f..d02ee66e2 100644 --- a/packages/cli-core/src/packageManagers/supports/YarnBerryManager.ts +++ b/packages/cli-core/src/packageManagers/supports/YarnBerryManager.ts @@ -1,5 +1,6 @@ +import {join} from "node:path"; + import {inject, Injectable} from "@tsed/di"; -import {join} from "path"; import {Observable} from "rxjs"; import {CliFs} from "../../services/CliFs.js"; diff --git a/packages/cli-core/src/services/CliDockerComposeYaml.ts b/packages/cli-core/src/services/CliDockerComposeYaml.ts index ef533f009..2a19e9eb4 100644 --- a/packages/cli-core/src/services/CliDockerComposeYaml.ts +++ b/packages/cli-core/src/services/CliDockerComposeYaml.ts @@ -1,7 +1,8 @@ +import {join} from "node:path"; + import {setValue} from "@tsed/core"; import {inject, Injectable} from "@tsed/di"; import {snakeCase} from "change-case"; -import {join} from "path"; import {CliFs} from "./CliFs.js"; import {CliYaml} from "./CliYaml.js"; diff --git a/packages/cli-core/src/services/CliFs.ts b/packages/cli-core/src/services/CliFs.ts index 0166728b1..b9a022930 100644 --- a/packages/cli-core/src/services/CliFs.ts +++ b/packages/cli-core/src/services/CliFs.ts @@ -1,8 +1,9 @@ +import type {PathLike, WriteFileOptions} from "node:fs"; +import {join} from "node:path"; + import {Injectable} from "@tsed/di"; import {normalizePath} from "@tsed/normalize-path"; -import type {PathLike, WriteFileOptions} from "fs"; import Fs, {type EnsureDirOptions} from "fs-extra"; -import {join} from "path"; @Injectable() export class CliFs { diff --git a/packages/cli-core/src/services/CliHttpClient.ts b/packages/cli-core/src/services/CliHttpClient.ts index 8c7f4bc64..00069b563 100644 --- a/packages/cli-core/src/services/CliHttpClient.ts +++ b/packages/cli-core/src/services/CliHttpClient.ts @@ -1,8 +1,9 @@ +import {stringify} from "node:querystring"; +import {URL} from "node:url"; + import {cleanObject} from "@tsed/core"; import {inject, Injectable} from "@tsed/di"; import axios, {type AxiosRequestConfig, type Method} from "axios"; -import {stringify} from "querystring"; -import {URL} from "url"; import {CliHttpLogClient} from "./CliHttpLogClient.js"; import {CliProxyAgent} from "./CliProxyAgent.js"; diff --git a/packages/cli-core/src/services/CliHttpLogClient.ts b/packages/cli-core/src/services/CliHttpLogClient.ts index d67789e2f..76ff9b14b 100644 --- a/packages/cli-core/src/services/CliHttpLogClient.ts +++ b/packages/cli-core/src/services/CliHttpLogClient.ts @@ -1,7 +1,8 @@ +import querystring from "node:querystring"; + import {getValue} from "@tsed/core"; import {inject, Opts} from "@tsed/di"; import {Logger} from "@tsed/logger"; -import querystring from "querystring"; import {logToCurl} from "../utils/logToCurl.js"; diff --git a/packages/cli-core/src/services/CliLoadFile.ts b/packages/cli-core/src/services/CliLoadFile.ts index 932d66a32..46ce30dad 100644 --- a/packages/cli-core/src/services/CliLoadFile.ts +++ b/packages/cli-core/src/services/CliLoadFile.ts @@ -1,6 +1,7 @@ +import {extname} from "node:path"; + import {inject, Injectable} from "@tsed/di"; import {default as Ajv, type Schema} from "ajv"; -import {extname} from "path"; import {CliFs} from "./CliFs.js"; import {CliYaml} from "./CliYaml.js"; diff --git a/packages/cli-core/src/services/CliProxyAgent.ts b/packages/cli-core/src/services/CliProxyAgent.ts index 4282e4a63..601d23b5a 100644 --- a/packages/cli-core/src/services/CliProxyAgent.ts +++ b/packages/cli-core/src/services/CliProxyAgent.ts @@ -1,7 +1,8 @@ +import {URL} from "node:url"; + import {Configuration, Inject, inject, Injectable, refValue} from "@tsed/di"; import {camelCase} from "change-case"; import tunnel from "tunnel"; -import {URL} from "url"; import {coerce} from "../utils/coerce.js"; import {CliExeca} from "./CliExeca.js"; diff --git a/packages/cli-core/src/services/NpmRegistryClient.ts b/packages/cli-core/src/services/NpmRegistryClient.ts index 6c9f29b28..2617b9063 100644 --- a/packages/cli-core/src/services/NpmRegistryClient.ts +++ b/packages/cli-core/src/services/NpmRegistryClient.ts @@ -1,6 +1,7 @@ +import url from "node:url"; + import {inject, Injectable} from "@tsed/di"; import registry_url from "registry-url"; -import url from "url"; import type {PackageInfo} from "../interfaces/PackageJson.js"; import {CliHttpClient} from "./CliHttpClient.js"; diff --git a/packages/cli-core/src/services/ProjectPackageJson.spec.ts b/packages/cli-core/src/services/ProjectPackageJson.spec.ts index 41a8334a4..00469e2d1 100644 --- a/packages/cli-core/src/services/ProjectPackageJson.spec.ts +++ b/packages/cli-core/src/services/ProjectPackageJson.spec.ts @@ -1,6 +1,7 @@ +import {join, resolve} from "node:path"; + // @ts-ignore import {CliPlatformTest} from "@tsed/cli-testing"; -import {join, resolve} from "path"; import {CliExeca} from "./CliExeca.js"; import {CliFs} from "./CliFs.js"; diff --git a/packages/cli-core/src/services/ProjectPackageJson.ts b/packages/cli-core/src/services/ProjectPackageJson.ts index ed7e352c3..35143c905 100644 --- a/packages/cli-core/src/services/ProjectPackageJson.ts +++ b/packages/cli-core/src/services/ProjectPackageJson.ts @@ -1,6 +1,7 @@ +import {dirname, join} from "node:path"; + import {getValue, setValue} from "@tsed/core"; import {configuration, constant, inject, Injectable} from "@tsed/di"; -import {dirname, join} from "path"; import {readPackageUpSync} from "read-pkg-up"; import type {PackageJson} from "../interfaces/PackageJson.js"; diff --git a/packages/cli-core/src/services/Renderer.ts b/packages/cli-core/src/services/Renderer.ts index 98625c15c..de01150cf 100644 --- a/packages/cli-core/src/services/Renderer.ts +++ b/packages/cli-core/src/services/Renderer.ts @@ -1,5 +1,7 @@ import "../utils/hbs/index.js"; +import {basename, dirname, join, relative} from "node:path"; + import {isString} from "@tsed/core"; import {constant, inject, Injectable} from "@tsed/di"; import {normalizePath} from "@tsed/normalize-path"; @@ -7,7 +9,6 @@ import Consolidate from "consolidate"; import fs from "fs-extra"; import {globby} from "globby"; import handlebars from "handlebars"; -import {basename, dirname, join, relative} from "path"; import {Observable} from "rxjs"; import {insertAfter} from "../utils/renderer/insertAfter.js"; diff --git a/packages/cli-core/src/utils/getTemplateDirectory.ts b/packages/cli-core/src/utils/getTemplateDirectory.ts index 5b45024ba..6f23044bf 100644 --- a/packages/cli-core/src/utils/getTemplateDirectory.ts +++ b/packages/cli-core/src/utils/getTemplateDirectory.ts @@ -1,4 +1,5 @@ -import {dirname, join} from "path"; +import {dirname, join} from "node:path"; + import {readPackageUpSync} from "read-pkg-up"; export function getTemplateDirectory(cwd: string) { diff --git a/packages/cli-core/src/utils/streamToObservable.ts b/packages/cli-core/src/utils/streamToObservable.ts index 9bc7dccd2..9ee8559bf 100644 --- a/packages/cli-core/src/utils/streamToObservable.ts +++ b/packages/cli-core/src/utils/streamToObservable.ts @@ -1,5 +1,6 @@ +import type {Stream} from "node:stream"; + import {Observable} from "rxjs"; -import type {Stream} from "stream"; function or(option: false | any, alternate: string, required?: boolean) { const result = option === false ? false : option || alternate; diff --git a/packages/cli-generate-http-client/src/commands/GenerateHttpClientCmd.ts b/packages/cli-generate-http-client/src/commands/GenerateHttpClientCmd.ts index 569484751..46522d26c 100644 --- a/packages/cli-generate-http-client/src/commands/GenerateHttpClientCmd.ts +++ b/packages/cli-generate-http-client/src/commands/GenerateHttpClientCmd.ts @@ -1,8 +1,9 @@ +import path, {join, resolve} from "node:path"; + import {CliFs, Command, type CommandProvider, constant, inject, Type} from "@tsed/cli-core"; import {isString} from "@tsed/core"; import {InjectorService} from "@tsed/di"; import {camelCase} from "change-case"; -import path, {join, resolve} from "path"; import {generateApi, type Hooks, type RawRouteInfo, type RouteNameInfo} from "swagger-typescript-api"; export interface GenerateHttpClientCtx { diff --git a/packages/cli-generate-swagger/src/commands/GenerateSwaggerCmd.ts b/packages/cli-generate-swagger/src/commands/GenerateSwaggerCmd.ts index 1e36c0c95..ae7f57539 100644 --- a/packages/cli-generate-swagger/src/commands/GenerateSwaggerCmd.ts +++ b/packages/cli-generate-swagger/src/commands/GenerateSwaggerCmd.ts @@ -1,5 +1,6 @@ +import path, {join, resolve} from "node:path"; + import {CliFs, CliYaml, Command, type CommandProvider, Constant, constant, Inject, inject, InjectorService, Type} from "@tsed/cli-core"; -import path, {join, resolve} from "path"; export interface GenerateSwaggerCtx { output: string; diff --git a/packages/cli-plugin-mongoose/src/services/CliMongoose.ts b/packages/cli-plugin-mongoose/src/services/CliMongoose.ts index 6cb77a6a8..714ea560b 100644 --- a/packages/cli-plugin-mongoose/src/services/CliMongoose.ts +++ b/packages/cli-plugin-mongoose/src/services/CliMongoose.ts @@ -1,6 +1,7 @@ +import {basename, join} from "node:path"; + import {inject, Injectable, ProjectPackageJson, SrcRendererService} from "@tsed/cli-core"; import {camelCase, constantCase, kebabCase} from "change-case"; -import {basename, join} from "path"; import {TEMPLATE_DIR} from "../utils/templateDir.js"; diff --git a/packages/cli-plugin-oidc-provider/test/init/__snapshots__/init.integration.spec.ts.snap b/packages/cli-plugin-oidc-provider/test/init/__snapshots__/init.integration.spec.ts.snap index 80b4a7984..8c167b0b5 100644 --- a/packages/cli-plugin-oidc-provider/test/init/__snapshots__/init.integration.spec.ts.snap +++ b/packages/cli-plugin-oidc-provider/test/init/__snapshots__/init.integration.spec.ts.snap @@ -61,7 +61,7 @@ exports[`Init OIDC Provider project > should generate a project with oidc 1`] = `; exports[`Init OIDC Provider project > should generate a project with oidc 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request @@ -173,7 +173,7 @@ exports[`Init OIDC Provider project > should generate a project with oidc and sw `; exports[`Init OIDC Provider project > should generate a project with oidc and swagger 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request diff --git a/packages/cli-plugin-prisma/src/services/CliPrisma.spec.ts b/packages/cli-plugin-prisma/src/services/CliPrisma.spec.ts index 147afac0b..c67f78761 100644 --- a/packages/cli-plugin-prisma/src/services/CliPrisma.spec.ts +++ b/packages/cli-plugin-prisma/src/services/CliPrisma.spec.ts @@ -1,7 +1,8 @@ +import {join} from "node:path"; + import {CliFs, normalizePath} from "@tsed/cli-core"; // @ts-ignore import {CliPlatformTest} from "@tsed/cli-testing"; -import {join} from "path"; import {CliPrisma} from "./CliPrisma.js"; diff --git a/packages/cli-plugin-typegraphql/test/init/__snapshots__/init.integration.spec.ts.snap b/packages/cli-plugin-typegraphql/test/init/__snapshots__/init.integration.spec.ts.snap index 98f75e251..663b9f4f6 100644 --- a/packages/cli-plugin-typegraphql/test/init/__snapshots__/init.integration.spec.ts.snap +++ b/packages/cli-plugin-typegraphql/test/init/__snapshots__/init.integration.spec.ts.snap @@ -1,7 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Init TypeGraphQL project > should generate a project with typegraphql 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request @@ -52,7 +52,7 @@ export class Server { `; exports[`Init TypeGraphQL project > should generate a project with typegraphql 3`] = ` -"import {readFileSync} from "fs"; +"import {readFileSync} from "node:fs"; import {envs} from "./envs/index.js"; import loggerConfig from "./logger/index.js"; const pkg = JSON.parse(readFileSync("./package.json", {encoding: "utf8"})); diff --git a/packages/cli-plugin-typeorm/test/integrations/init/__snapshots__/init.integration.spec.ts.snap b/packages/cli-plugin-typeorm/test/integrations/init/__snapshots__/init.integration.spec.ts.snap index f97b1f7b5..201adf52e 100644 --- a/packages/cli-plugin-typeorm/test/integrations/init/__snapshots__/init.integration.spec.ts.snap +++ b/packages/cli-plugin-typeorm/test/integrations/init/__snapshots__/init.integration.spec.ts.snap @@ -1,7 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`TypeORM: Init cmd > should generate a project with the right options 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request diff --git a/packages/cli-testing/src/FakeCliFs.ts b/packages/cli-testing/src/FakeCliFs.ts index b0735e229..d4aa978d4 100644 --- a/packages/cli-testing/src/FakeCliFs.ts +++ b/packages/cli-testing/src/FakeCliFs.ts @@ -1,6 +1,7 @@ +import type {PathLike} from "node:fs"; +import * as fs from "node:fs"; + import {isString} from "@tsed/core"; -import type {PathLike} from "fs"; -import * as fs from "fs"; import type {EnsureDirOptions, WriteFileOptions} from "fs-extra"; import {normalizePath} from "./normalizePath.js"; diff --git a/packages/cli/scripts/index.esm.js b/packages/cli/scripts/index.esm.js index 96073bdf0..6501d45ec 100644 --- a/packages/cli/scripts/index.esm.js +++ b/packages/cli/scripts/index.esm.js @@ -1,6 +1,6 @@ +import {dirname, join} from "node:path"; import {fileURLToPath} from "node:url"; -import {dirname, join} from "path"; import readPkgUp from "read-pkg-up"; const {path, packageJson} = readPkgUp.sync({ diff --git a/packages/cli/src/commands/generate/GenerateCmd.ts b/packages/cli/src/commands/generate/GenerateCmd.ts index 2cf69d22c..f329303e6 100644 --- a/packages/cli/src/commands/generate/GenerateCmd.ts +++ b/packages/cli/src/commands/generate/GenerateCmd.ts @@ -1,16 +1,9 @@ -import { - type CliDefaultOptions, - Command, - type CommandProvider, - Inject, - inject, - ProjectPackageJson, - SrcRendererService -} from "@tsed/cli-core"; +import {basename, dirname, join} from "node:path"; + +import {type CliDefaultOptions, Command, type CommandProvider, Inject, ProjectPackageJson, SrcRendererService} from "@tsed/cli-core"; import {normalizePath} from "@tsed/normalize-path"; import {kebabCase, pascalCase} from "change-case"; import {globbySync} from "globby"; -import {basename, dirname, join} from "path"; import {ProjectConvention} from "../../interfaces/ProjectConvention.js"; import {ClassNamePipe} from "../../pipes/ClassNamePipe.js"; diff --git a/packages/cli/src/commands/init/InitCmd.ts b/packages/cli/src/commands/init/InitCmd.ts index e5ecd920d..acc143211 100644 --- a/packages/cli/src/commands/init/InitCmd.ts +++ b/packages/cli/src/commands/init/InitCmd.ts @@ -1,3 +1,5 @@ +import {basename, join} from "node:path"; + import { CliExeca, CliFs, @@ -19,7 +21,6 @@ import { type Task } from "@tsed/cli-core"; import {kebabCase, pascalCase} from "change-case"; -import {basename, join} from "path"; import {DEFAULT_TSED_TAGS} from "../../constants/index.js"; import {ArchitectureConvention} from "../../interfaces/ArchitectureConvention.js"; diff --git a/packages/cli/src/constants/index.ts b/packages/cli/src/constants/index.ts index 94edd4b23..44683908c 100644 --- a/packages/cli/src/constants/index.ts +++ b/packages/cli/src/constants/index.ts @@ -1,4 +1,5 @@ -import {dirname, join} from "path"; +import {dirname, join} from "node:path"; + import {readPackageUpSync} from "read-pkg-up"; const {path, packageJson} = readPackageUpSync({ diff --git a/packages/cli/src/pipes/ClassNamePipe.ts b/packages/cli/src/pipes/ClassNamePipe.ts index 7cda514e5..6d4628fda 100644 --- a/packages/cli/src/pipes/ClassNamePipe.ts +++ b/packages/cli/src/pipes/ClassNamePipe.ts @@ -1,7 +1,8 @@ +import {basename} from "node:path"; + import {ProjectPackageJson} from "@tsed/cli-core"; import {inject, Injectable} from "@tsed/di"; import {kebabCase, pascalCase} from "change-case"; -import {basename} from "path"; import {ProjectConvention} from "../interfaces/ProjectConvention.js"; import {ProvidersInfoService} from "../services/ProvidersInfoService.js"; diff --git a/packages/cli/src/pipes/OutputFilePathPipe.ts b/packages/cli/src/pipes/OutputFilePathPipe.ts index dc665def4..367b67868 100644 --- a/packages/cli/src/pipes/OutputFilePathPipe.ts +++ b/packages/cli/src/pipes/OutputFilePathPipe.ts @@ -1,6 +1,7 @@ +import {dirname, join} from "node:path"; + import {inject, Injectable, ProjectPackageJson} from "@tsed/cli-core"; import {Inject} from "@tsed/di"; -import {dirname, join} from "path"; import {ArchitectureConvention, ProjectConvention} from "../interfaces/index.js"; import {ProvidersInfoService} from "../services/ProvidersInfoService.js"; diff --git a/packages/cli/src/runtimes/supports/BabelRuntime.ts b/packages/cli/src/runtimes/supports/BabelRuntime.ts index 2ee803448..c1b457d2d 100644 --- a/packages/cli/src/runtimes/supports/BabelRuntime.ts +++ b/packages/cli/src/runtimes/supports/BabelRuntime.ts @@ -1,5 +1,6 @@ +import {dirname} from "node:path"; + import {Injectable} from "@tsed/di"; -import {dirname} from "path"; import {NodeRuntime} from "./NodeRuntime.js"; diff --git a/packages/cli/src/runtimes/supports/WebpackRuntime.ts b/packages/cli/src/runtimes/supports/WebpackRuntime.ts index 608c897ff..4cc889359 100644 --- a/packages/cli/src/runtimes/supports/WebpackRuntime.ts +++ b/packages/cli/src/runtimes/supports/WebpackRuntime.ts @@ -1,5 +1,6 @@ +import {dirname} from "node:path"; + import {Injectable} from "@tsed/di"; -import {dirname} from "path"; import {BabelRuntime} from "./BabelRuntime.js"; diff --git a/packages/cli/templates/generate/server.hbs b/packages/cli/templates/generate/server.hbs index b3b94eb64..2b8c8d1b9 100644 --- a/packages/cli/templates/generate/server.hbs +++ b/packages/cli/templates/generate/server.hbs @@ -1,4 +1,4 @@ -import {join} from "path"; +import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; {{#forEach imports}}{{#if tsIngore}} diff --git a/packages/cli/templates/init/src/config/index.ts.hbs b/packages/cli/templates/init/src/config/index.ts.hbs index b0d58cd3d..6493a41d4 100644 --- a/packages/cli/templates/init/src/config/index.ts.hbs +++ b/packages/cli/templates/init/src/config/index.ts.hbs @@ -1,4 +1,4 @@ -import {readFileSync} from "fs"; +import {readFileSync} from "node:fs"; import {envs} from "./envs/index.js"; import loggerConfig from "./logger/index.js";{{#if mongoose}} import mongooseConfig from "./mongoose/index.js"; diff --git a/packages/cli/test/integrations/init/__snapshots__/init.integration.spec.ts.snap b/packages/cli/test/integrations/init/__snapshots__/init.integration.spec.ts.snap index bb642e808..49252d0ee 100644 --- a/packages/cli/test/integrations/init/__snapshots__/init.integration.spec.ts.snap +++ b/packages/cli/test/integrations/init/__snapshots__/init.integration.spec.ts.snap @@ -1,7 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Init cmd > Express.js > should generate a project with Arch FEATURE 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request @@ -60,7 +60,7 @@ export class Server { `; exports[`Init cmd > Express.js > should generate a project with Babel 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request @@ -108,7 +108,7 @@ export class Server { `; exports[`Init cmd > Express.js > should generate a project with Bun 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request @@ -156,7 +156,7 @@ export class Server { `; exports[`Init cmd > Express.js > should generate a project with Convention ANGULAR 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request @@ -215,7 +215,7 @@ export class Server { `; exports[`Init cmd > Express.js > should generate a project with NPM 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request @@ -263,7 +263,7 @@ export class Server { `; exports[`Init cmd > Express.js > should generate a project with Webpack 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request @@ -311,7 +311,7 @@ export class Server { `; exports[`Init cmd > Express.js > should generate a project with swagger 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request @@ -370,7 +370,7 @@ export class Server { `; exports[`Init cmd > Express.js > should generate a project with the right options 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request @@ -418,7 +418,7 @@ export class Server { `; exports[`Init cmd > Koa.js > should generate a project with the right options 2`] = ` -"import {join} from "path"; +"import {join} from "node:path"; import {Configuration} from "@tsed/di"; import {application} from "@tsed/platform-http"; import "@tsed/platform-log-request"; // remove this import if you don't want log request diff --git a/packages/cli/test/integrations/init/init.integration.spec.ts b/packages/cli/test/integrations/init/init.integration.spec.ts index 58d4795cf..d53223c3f 100644 --- a/packages/cli/test/integrations/init/init.integration.spec.ts +++ b/packages/cli/test/integrations/init/init.integration.spec.ts @@ -1,8 +1,9 @@ +import {join} from "node:path"; + import {PackageManager} from "@tsed/cli-core"; // @ts-ignore import {CliPlatformTest, FakeCliFs} from "@tsed/cli-testing"; import {ensureDirSync, writeFileSync} from "fs-extra"; -import {join} from "path"; import {ArchitectureConvention, InitCmd, ProjectConvention, TEMPLATE_DIR} from "../../../src/index.js";