- Implemented live card image generation for user habits using canvas. - Created API endpoints for starting and managing live Discord sharing sessions. - Added tests for live Discord sharing to ensure functionality and reliability. - Introduced CSS styles for the live Discord sharing interface. - Enhanced error handling and state management for Discord message updates.
31 lines
911 B
TypeScript
31 lines
911 B
TypeScript
import tailwind from "bun-plugin-tailwind";
|
|
import { rm, mkdir, copyFile } from "node:fs/promises";
|
|
import path from "node:path";
|
|
|
|
const outdir = path.join(process.cwd(), "dist");
|
|
await rm(outdir, { recursive: true, force: true });
|
|
|
|
const result = await Bun.build({
|
|
entrypoints: ["src/index.ts"],
|
|
outdir,
|
|
plugins: [tailwind],
|
|
minify: true,
|
|
target: "bun",
|
|
external: ["@napi-rs/canvas"],
|
|
sourcemap: "linked",
|
|
define: {
|
|
"process.env.NODE_ENV": JSON.stringify("production"),
|
|
},
|
|
});
|
|
|
|
if (!result.success) {
|
|
throw new AggregateError(result.logs, "Build failed");
|
|
}
|
|
|
|
for (const output of result.outputs) {
|
|
console.log(` ${path.relative(process.cwd(), output.path)} ${(output.size / 1024).toFixed(1)} KB`);
|
|
}
|
|
|
|
await mkdir(path.join(outdir, "fonts"), { recursive: true });
|
|
await copyFile("src/assets/fonts/InstrumentSerif-Regular.ttf", path.join(outdir, "fonts/InstrumentSerif-Regular.ttf"));
|