fix: make git source prepack self-contained
This commit is contained in:
parent
e210a26af2
commit
b2e6db91c5
@ -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"]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user