mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-02 08:35:07 +08:00
* feat: ship the self-hosted native scriptc CLI - Run the shared compiler and CLI natively, including library builds and compile-time evaluation. - Install native platform packages and ship relocatable standalone distributions. - Preserve program semantics and reuse validated build artifacts for fast rebuilds. * fix: complete native CLI integration and validation - Preserve library diagnostics and run recursive compiler work on the main stack. - Restore packaged helper permissions and exercise native npm and Wasm library builds. - Recover interrupted Sandbox status probes within the original command deadline.
19 lines
912 B
JavaScript
19 lines
912 B
JavaScript
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
import { dirname, join, resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
export function prepareNativeCommand(directory) {
|
|
const bin = join(directory, "bin");
|
|
mkdirSync(bin, { recursive: true });
|
|
// npm creates bin links before postinstall. The payload must exist in the
|
|
// tarball, and no shebang may pin the Windows shim to an interpreter.
|
|
// Installation replaces this placeholder with the platform executable.
|
|
writeFileSync(join(bin, "scriptc.exe"),
|
|
"echo 'scriptc: native installation is incomplete; enable install scripts and reinstall scriptc' >&2\nexit 1\n", { mode: 0o755 });
|
|
rmSync(join(bin, "scriptc.exe.json"), { force: true });
|
|
}
|
|
|
|
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
prepareNativeCommand(resolve(dirname(fileURLToPath(import.meta.url)), ".."));
|
|
}
|