Skip to content

Commit 0e4e983

Browse files
committed
feat: add PS_BUILD
1 parent 6a6799a commit 0e4e983

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

example/2-client-component/app.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { Hono } from "hono";
22
import { serveStatic } from "hono/bun";
33
import { build } from "plainstack/bun";
44
import { render } from "plainstack/client";
5-
import { Counter } from "./client/counter";
5+
import { Counter } from "./counter";
66

77
const app = new Hono();
88

99
app.use("/static/*", serveStatic({ root: "./example/2-client-component" }));
1010

1111
await build({
12-
entrypoints: "example/2-client-component/client",
12+
entrypoints: ["example/2-client-component/counter.tsx"],
1313
outdir: "example/2-client-component/static",
1414
});
1515

src/bun.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { randomBytes } from "node:crypto";
33
import { readdir } from "node:fs/promises";
44
import { join } from "node:path";
55
import type { BuildConfig as BunBuildConfig } from "bun";
6+
import consola from "consola";
67
import { CamelCasePlugin, Kysely } from "kysely";
78
import { BunSqliteDialect } from "kysely-bun-sqlite";
89
import { bun } from "plainjob";
@@ -51,12 +52,16 @@ export async function build(options: BuildConfig) {
5152
files.map((file) => join(options.entrypoints as string, file)),
5253
)
5354
: options.entrypoints;
54-
console.log(entrypointfiles);
55-
return await Bun.build({
55+
const result = await Bun.build({
5656
outdir: "static",
5757
sourcemap: "linked",
58-
minify: prod(),
58+
minify: false, // TODO this breaks the naming atm
5959
...options,
6060
entrypoints: entrypointfiles,
6161
});
62+
if (process.env.PS_BUILD) {
63+
consola.info("✓ build finished, PB_BUILD=1 exiting process...");
64+
process.exit(0);
65+
}
66+
return result;
6267
}

0 commit comments

Comments
 (0)