Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// The library entry retains its existing import-time execution and rejection behaviour.
// This CLI-only boundary reports a concise diagnostic and a nonzero exit status.
try {
await import('./index.js');
} catch (error) {
console.error(error instanceof Error ? error.message : String(error));
process.exitCode = 1;
}
4 changes: 2 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ const config: ReturnType<typeof defineConfig> = defineConfig({
// integration-bundled-binary.test.ts copies only this file into an
// isolated tempdir with no node_modules, so every runtime `dependency`
// has to be bundled in, not left external.
entry: "src/index.ts",
entry: "src/cli.ts",
Comment thread
Jamie-BitFlight marked this conversation as resolved.
outputOptions: { entryFileNames: "index.js", codeSplitting: false },
platform: "node",
outDir: "dist/bin",
// tsdown auto-enables declaration output repo-wide because
Expand All @@ -70,7 +71,6 @@ const config: ReturnType<typeof defineConfig> = defineConfig({
// binary with no node_modules to resolve sibling chunks from. Keep this
// off even when no current dependency lazy-loads: it is what stops the
// single-file invariant from depending on which packages happen to.
outputOptions: { codeSplitting: false },
// Preserves the shebang + __filename/__dirname/require ESM-interop
// shim scripts/esbuild.mjs's banner used to inject.
banner: `#!/usr/bin/env node
Expand Down
Loading