From be57505e2a8e2e1174f9855797f687c65c067b2d Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Mon, 9 Sep 2024 22:54:11 +0100 Subject: [PATCH] feat(cli): read typscript's version from `package.json` --- src/executable/TypiaSetupWizard.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/executable/TypiaSetupWizard.ts b/src/executable/TypiaSetupWizard.ts index 3e53c1090f..729b0c5de1 100644 --- a/src/executable/TypiaSetupWizard.ts +++ b/src/executable/TypiaSetupWizard.ts @@ -1,4 +1,5 @@ import fs from "fs"; +import path from "path"; import { DetectResult, detect } from "package-manager-detector"; import { ArgumentParser } from "./setup/ArgumentParser"; @@ -6,6 +7,8 @@ import { CommandExecutor } from "./setup/CommandExecutor"; import { PackageManager } from "./setup/PackageManager"; import { PluginConfigurator } from "./setup/PluginConfigurator"; +const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "../../package.json"), "utf-8")); + export namespace TypiaSetupWizard { export interface IArguments { manager: "npm" | "pnpm" | "yarn" | "bun"; @@ -22,7 +25,7 @@ export namespace TypiaSetupWizard { const args: IArguments = await ArgumentParser.parse(pack)(inquiry); // INSTALL TYPESCRIPT COMPILERS - pack.install({ dev: true, modulo: "typescript", version: "^5.6.2" }); + pack.install({ dev: true, modulo: "typescript", version: pkg.devDependencies.typescript as string }); pack.install({ dev: true, modulo: "ts-patch", version: "latest" }); args.project ??= (() => { const runner: string = pack.manager === "npm" ? "npx" : pack.manager;