fix: make git source prepack self-contained

This commit is contained in:
Peter Steinberger 2026-05-06 00:08:28 +01:00
parent e210a26af2
commit b2e6db91c5
No known key found for this signature in database

View File

@ -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"]);