#!/usr/bin/env node /** * msger-native WSL builder — delegates to @bobfrankston/rust-builder * Run this directly inside WSL: node builder/build-under-wsl.ts */ import { build, type BuildConfig } from "@bobfrankston/rust-builder"; import path from "path"; import fs from "fs"; import { fileURLToPath } from "url"; import JSON5 from "json5"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const nativeDir = path.join(__dirname, ".."); const binDir = path.join(nativeDir, "bin"); // build-config.json may contain comments — parse with json5 instead of using // rust-builder's loadConfig (which is strict JSON-only). const json = JSON5.parse(fs.readFileSync(path.join(__dirname, "build-config.json"), "utf-8")); const config: BuildConfig = { binaryName: "msgernative", cargoDir: nativeDir, binDir, ...json }; // Only build WSL targets when running inside WSL config.platforms.windows = false; config.platforms.pi = false; const success = build(config); if (!success) process.exit(1);