diff --git a/scripts/prepack-build.mjs b/scripts/prepack-build.mjs index 19bb681..5c7da80 100644 --- a/scripts/prepack-build.mjs +++ b/scripts/prepack-build.mjs @@ -2,6 +2,8 @@ import { existsSync } from "node:fs"; import { spawnSync } from "node:child_process"; +const tscBin = process.platform === "win32" ? "node_modules/.bin/tsc.cmd" : "node_modules/.bin/tsc"; + function run(command, args) { const result = spawnSync(command, args, { stdio: "inherit", shell: process.platform === "win32" }); if (result.status !== 0) { @@ -9,8 +11,15 @@ function run(command, args) { } } -if (!existsSync("node_modules/typescript/bin/tsc")) { - run("pnpm", ["install", "--prod=false", "--ignore-scripts", "--frozen-lockfile=false"]); +if (!existsSync(tscBin)) { + run("pnpm", [ + "add", + "--save-dev", + "typescript@^5.8.3", + "@types/node@^22.15.19", + "--ignore-scripts", + "--lockfile=false", + ]); } -run("pnpm", ["exec", "tsc", "-p", "tsconfig.json"]); +run(tscBin, ["-p", "tsconfig.json"]);