15 lines
729 B
TypeScript
15 lines
729 B
TypeScript
// bun run build:userscript → dist/web/mbseed.user.js (served by our server at /mbseed.user.js).
|
|
// Set MBSEED_PUBLIC_URL to add our server to @connect.
|
|
import pkg from "../package.json";
|
|
import { userscriptBanner } from "./userscript-banner";
|
|
|
|
const result = await Bun.build({ entrypoints: ["src/userscript/main.ts"], target: "browser", format: "iife" });
|
|
if (!result.success) {
|
|
for (const log of result.logs) console.error(log);
|
|
process.exit(1);
|
|
}
|
|
const code = await result.outputs[0]!.text();
|
|
const out = userscriptBanner(pkg.version, process.env.MBSEED_PUBLIC_URL || undefined) + code;
|
|
await Bun.write("dist/web/mbseed.user.js", out);
|
|
console.log(`wrote dist/web/mbseed.user.js (${Math.round(out.length / 1024)} KB)`);
|