mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-02 08:06:00 +00:00
d052871fe0
Added "wrangler" to the external dependencies in the build configuration. Improved error logging in the Storage class to include the file name when image dimension retrieval fails. Enhanced the InvalidSchemaError to provide additional context by including the schema in the error message.
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import pkg from "./package.json" with { type: "json" };
|
|
import c from "picocolors";
|
|
import { formatNumber } from "bknd/utils";
|
|
import * as esbuild from "esbuild";
|
|
|
|
const deps = Object.keys(pkg.dependencies);
|
|
const external = ["jsonv-ts/*", "wrangler", ...deps];
|
|
|
|
if (process.env.DEBUG) {
|
|
const result = await esbuild.build({
|
|
entryPoints: ["./src/cli/index.ts"],
|
|
outdir: "./dist/cli",
|
|
platform: "node",
|
|
minify: true,
|
|
format: "esm",
|
|
metafile: true,
|
|
bundle: true,
|
|
external,
|
|
define: {
|
|
__isDev: "0",
|
|
__version: JSON.stringify(pkg.version),
|
|
},
|
|
});
|
|
await Bun.write("./dist/cli/metafile-esm.json", JSON.stringify(result.metafile, null, 2));
|
|
process.exit(0);
|
|
}
|
|
|
|
const result = await Bun.build({
|
|
entrypoints: ["./src/cli/index.ts"],
|
|
target: "node",
|
|
outdir: "./dist/cli",
|
|
env: "PUBLIC_*",
|
|
minify: true,
|
|
external,
|
|
define: {
|
|
__isDev: "0",
|
|
__version: JSON.stringify(pkg.version),
|
|
},
|
|
});
|
|
|
|
for (const output of result.outputs) {
|
|
const size_ = await output.text();
|
|
console.info(
|
|
c.cyan(formatNumber.fileSize(size_.length)),
|
|
c.dim(output.path.replace(import.meta.dir + "/", "")),
|
|
);
|
|
}
|