#!/usr/bin/env node /** * msger-native builder — delegates to @bobfrankston/rust-builder */ 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 }; // msger-specific: copy icons config.options = config.options || {}; config.options.icons = ["msger.ico", "msger.png"]; config.options.iconDir = path.join(nativeDir, ".."); const success = build(config); if (!success) process.exit(1);