Skip to content

The CLI

Vantris ships a single binary, vantris, with three commands. The CLI's only job is to parse arguments and route to a command — all behaviour lives in the command modules. This keeps the surface tiny and predictable.

bash
vantris <command> [options]

Run it through your package manager (npm run dev), directly with npx vantris dev, or from a package.json script.

Commands

CommandDescription
vantris devStart the development server with HMR.
vantris buildProduce an optimised production build in outDir.
vantris build --watchRebuild on every change (no dev server).
vantris previewServe the built outDir locally (no compilation).

Each command is documented in depth:

Global flags

FlagApplies toDescription
--mode <mode>allSet the mode (development, production, custom).
--watch, -wbuildRebuild on every change.
--host [host]devBind to a host; bare --host means 0.0.0.0.
--help, -hShow help.
--version, -vShow the version number.
--verbose, --debugallVerbose logging.

--mode

Every command runs in a mode. The mode selects which .env files load and what import.meta.env.MODE resolves to.

  • dev defaults to development.
  • build and preview default to production.

Override it explicitly:

bash
vantris dev --mode staging
vantris build --mode production
vantris preview --mode local

See Env Variables & Modes for how the mode drives environment loading.

--host

dev only. Binds the server so other devices on your network can reach it. Overrides dev.host from the config.

bash
vantris dev --host          # all interfaces (0.0.0.0)
vantris dev --host 0.0.0.0  # explicit
vantris dev --host 192.168.1.42

When bound to a non-localhost address, the dev server prints both the Local and Network URLs on start.

--watch / -w

build only. Rebuilds on every change, debounced. It does not start a dev server — it only rebuilds — and a failed build never stops the watcher.

bash
vantris build --watch
vantris build -w

See Building — Watch mode.

--help and --version

bash
vantris --help      # or -h
vantris --version   # or -v

--help prints the styled command list; --version prints the current version.

Exit codes & errors

Everything Vantris does intentionally throws a VantrisError subclass, rendered cleanly by the CLI with a clear message. A failed command exits with a non-zero status, so it fails your CI as expected. Common cases:

  • vantris preview before vantris build → a clear "run build first" error.
  • A port already in use → a clear address-in-use error.
  • An invalid config value → the property path, expected type, and value received.

Programmatic use

Everything the CLI does is also exported from the vantris package, so you can embed it in custom tooling:

ts
import { run } from "vantris";

await run(["build", "--mode", "production"]);

Or call the lower-level functions (runBuild, startDevServer, startPreviewServer) directly. See the JavaScript API.

Released under the MIT License.