Seed CLISeed CLI

Build

Bundle a Seed CLI app for Node.js or compile it into a standalone executable.

Seed CLI gives you two build modes:

  • Bundle for Node.js with seed build
  • Compile a standalone executable with seed build --compile

The Full and Minimal templates already include both scripts:

package.json
{
  "scripts": {
    "build": "seed build",
    "compile": "seed build --compile --outfile my-cli"
  }
}

If you generated your project with Seed, @seedcli/cli is already installed as a dev dependency. If you removed it, add it back before using seed build.

Bundle for Node.js

Use this when you want a JavaScript build that runs on Node.js:

npm run build
# or
seed build

seed build reads your project entry point, resolves auto-discovered commands, extensions, and plugins into a static build entry, then bundles the result into dist/index.js.

The output is a plain ES module — typically tens of KB, executable directly via node dist/index.js. This is the usual build mode for CLIs you plan to publish on npm.

Externals

In bundle mode, seed build automatically keeps your runtime dependencies external so the published tarball stays small and uses npm's normal install graph:

  • dependencies, peerDependencies, and optionalDependencies from package.json → kept external
  • devDependencies and workspace packages → inlined into the bundle
  • Subpaths like react/jsx-runtime are matched against the package root (so adding react as an external also externalizes react/jsx-runtime)

You can add more externals via the build.external array in seed.config.ts:

seed.config.ts
import { defineConfig } from "@seedcli/core";

export default defineConfig({
  build: {
    external: ["some-native-module", "another-package"],
  },
});

…or on the CLI for one-off builds:

seed build --external some-native-module,another-package

Shebang and Executable Bit

seed build automatically:

  • prepends #!/usr/bin/env node to the bundle (unless your entry source already declares one — no double-shebang)
  • runs chmod +x on the output so it works directly as a bin entry

This means you can point package.json#bin straight at dist/index.js:

package.json
{
  "type": "module",
  "bin": {
    "my-cli": "./dist/index.js"
  },
  "files": ["dist"]
}

Sourcemaps

Pass --sourcemap (or set build.bundle.sourcemap: true in config) to emit dist/index.js.map alongside the bundle.

Compile a Standalone Executable

Use this when you want to ship a single executable instead of requiring Node.js on the target machine.

npm run compile
# or
seed build --compile

By default, seed build --compile targets the current host platform. You can target specific platforms with --target:

seed build --compile \
  --target node24-macos-arm64,node24-linux-x64,node24-win-x64 \
  --outdir dist

Current compile targets:

  • node24-linux-x64
  • node24-linux-arm64
  • node24-macos-x64
  • node24-macos-arm64
  • node24-win-x64
  • node24-win-arm64
  • node24-linuxstatic-x64
  • all

Use --outfile when you want one explicit output path for a single target. For multi-target builds, use --outdir.

Configure Builds in seed.config.ts

You can keep your preferred build defaults in seed.config.ts:

seed.config.ts
import { defineConfig } from "@seedcli/core";

export default defineConfig({
  build: {
    // Applies to both bundle and compile modes
    external: ["some-native-module"],
    bundle: {
      outdir: "dist",
      sourcemap: true,
    },
    compile: {
      targets: ["node24-macos-arm64", "node24-linux-x64", "node24-win-x64"],
    },
  },
});

CLI flags still override these defaults for one-off builds.

For shipping guidance, see Distribution. For the full seed build flag reference, see CLI Tools.

On this page