@bomb.sh/tools
Version:
The internal dev, build, and lint CLI for Bombshell projects
40 lines (39 loc) • 1.19 kB
JavaScript
import { printViolations } from "./lint.mjs";
import { runPublint } from "./publint.mjs";
import { parse } from "@bomb.sh/args";
import { build as build$1 } from "tsdown";
//#region src/commands/build.ts
async function build(ctx) {
const args = parse(ctx.args, { boolean: [
"bundle",
"dts",
"minify"
] });
const entry = args._.length > 0 ? args._.map(String) : ["src/**/*.ts", "!src/**/*.test.ts"];
try {
await build$1({
config: false,
entry,
format: "esm",
sourcemap: true,
clean: true,
unbundle: !args.bundle,
dts: args.dts === false ? false : { tsgo: true },
minify: args.minify
});
} catch (error) {
if (error instanceof Error && /Cannot find entry/.test(error.message)) {
console.error(`No entry files matched: ${entry.join(", ")}`);
console.error(`Looked in: ${process.cwd()}`);
console.error("Pass explicit entry files (e.g. `bsh build src/index.ts`).");
process.exit(1);
}
throw error;
}
const violations = await runPublint();
if (violations.length > 0) printViolations(violations);
if (violations.some((v) => v.level === "error")) process.exit(1);
}
//#endregion
export { build };
//# sourceMappingURL=build.mjs.map