Files
scriptc/scripts/sync-versions.mjs
T
Malte UblandClaude Opus 5.5 e9c6b68c07 Build prebuilt libnode packs for Node islands
Add the @scriptc/libnode-<platform> packs (linux-x64-gnu, linux-arm64-gnu,
darwin-arm64, darwin-x64): the pinned Node.js 24.22.0 built as a stripped
shared library with full ICU and its startup snapshot, the scriptc bridge
compiled against that release's headers, Node's LICENSE and a manifest
with the Node version, NODE_MODULE_VERSION, bridge ABI and file hashes.

packages/libnode-common holds the pin, the build (fetch and verify the
source tarball, configure --shared, build only the libnode target, strip,
stage with headers in a cache keyed by release, flags, platform and
toolchain; the bridge rebuilds in seconds against the cached headers),
a verifier, and a smoke test: a C program that loads a pack the way the
runtime does, starts Node from the snapshot and evaluates expressions
synchronously, asynchronously and throwing.

The libnode-packs workflow builds the packs on native runners, Linux in
the manylinux_2_28 images for a glibc 2.28 floor, caches each libnode
build, smoke-tests and uploads every pack. It never runs in the ordinary
build or test path. The compiler gains the pack lookup (SCRIPTC_LIBNODE,
then the installed package), validation, the nodeIslands.libnode
placements and the license notices for the Node island loader to use.

The bridge source and its C ABI header are the NI-1 bridge agent's,
included here so the packs build; the packs stay private until the
in-process island runtime ships.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 17:52:22 -07:00

66 lines
1.9 KiB
JavaScript

#!/usr/bin/env node
// Stamps the version from packages/cli/package.json into packages/runtime
// packages/compiler, runtime, and platform helper packages so every component
// participating in the helper protocol moves in lockstep.
// Usage: node scripts/sync-versions.mjs
import { readFileSync, writeFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
const root = fileURLToPath(new URL("..", import.meta.url));
const manifest = (pkg) => `${root}packages/${pkg}/package.json`;
const read = (path) => JSON.parse(readFileSync(path, "utf8"));
const version = read(manifest("cli")).version;
if (typeof version !== "string" || version.length === 0) {
console.error("packages/cli/package.json has no version");
process.exit(1);
}
for (const pkg of [
"runtime",
"runtime-darwin-arm64",
"runtime-darwin-x64",
"runtime-linux-x64-gnu",
"runtime-linux-arm64-gnu",
"runtime-linux-x64-musl",
"runtime-linux-arm64-musl",
"runtime-win32-x64-msvc",
"runtime-wasm32-wasi",
"runtime-ios-arm64",
"runtime-ios-simulator-arm64",
"runtime-android-arm64",
"compiler",
"experimental",
"node",
"threads",
"types",
"cli-darwin-arm64",
"cli-darwin-x64",
"cli-linux-x64-gnu",
"cli-linux-arm64-gnu",
"cli-linux-x64-musl",
"cli-linux-arm64-musl",
"cli-win32-x64-msvc",
"llvm-darwin-arm64",
"llvm-darwin-x64",
"llvm-linux-x64-gnu",
"llvm-linux-arm64-gnu",
"llvm-linux-x64-musl",
"llvm-linux-arm64-musl",
"llvm-win32-x64-msvc",
"libnode-linux-x64-gnu",
"libnode-linux-arm64-gnu",
"libnode-darwin-arm64",
"libnode-darwin-x64",
]) {
const path = manifest(pkg);
const json = read(path);
if (json.version === version) {
console.log(`packages/${pkg}: already ${version}`);
continue;
}
console.log(`packages/${pkg}: ${json.version} -> ${version}`);
json.version = version;
writeFileSync(path, JSON.stringify(json, null, 2) + "\n");
}