Skip to content

Commit c3f801b

Browse files
committed
feat(build): add --bundle flag
1 parent 78e6973 commit c3f801b

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

.changeset/great-hoops-heal.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@bomb.sh/tools": patch
3+
---
4+
5+
Adds `--bundle` flag to `build` command (default is tsdown's `unbundle` behavior

src/commands/build.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
1+
import { parse } from "@bomb.sh/args";
12
import { x } from "tinyexec";
23
import type { CommandContext } from "../context.ts";
34
import { local } from "../utils.ts";
45

56
export async function build(ctx: CommandContext) {
6-
const stdio = x(local("tsdown"), [
7-
"src/bin.ts",
8-
"--format",
9-
"esm",
10-
"--sourcemap",
11-
"--clean",
12-
"--unbundle",
13-
"--no-config",
14-
...ctx.args,
15-
]);
7+
const args = parse(ctx.args, {
8+
boolean: ["bundle"],
9+
});
1610

17-
for await (const line of stdio) {
18-
console.log(line);
19-
}
11+
const tsdownArgs = [
12+
"src/bin.ts",
13+
"--format",
14+
"esm",
15+
"--sourcemap",
16+
"--clean",
17+
"--no-config",
18+
...args._.map((v) => v.toString()),
19+
];
20+
if (!args.bundle) tsdownArgs.push("--unbundle");
21+
22+
const stdio = x(local("tsdown"), tsdownArgs);
23+
24+
for await (const line of stdio) {
25+
console.log(line);
26+
}
2027
}

0 commit comments

Comments
 (0)