CLI
CLI in CI
Validate plugins, build with readable logs and apply migrations with the VitNode CLI in GitHub Actions, Docker and other pipelines.
The VitNode CLI runs in pipelines without changes: it never waits for input there, and every command exits with a non-zero code when it fails, so a pipeline stops at the first problem.
vitnode plugin validate
vitnode build --plain
vitnode db migrate --yesRun each command in your app's folder, so the CLI finds the app's config. The examples below assume a Turborepo workspace from create-vitnode-app, where the app package is named web and the root has a build:plugins script. In a monorepo app, the database belongs to the api package, so run migrations with --filter api. A single app without Turborepo has no plugins to build, so run the commands in the project root without --filter.
GitHub Actions
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm build:plugins
- run: pnpm --filter web exec vitnode plugin validate
- run: pnpm --filter web exec vitnode build --plain--filter web runs vitnode in the web app's folder. Plugins are built first, because validation and the app build both read their dist output.
To compare bundle sizes between runs, cache node_modules/.cache/vitnode. That is where vitnode build keeps the previous build's sizes.
Migrate during deployment
POSTGRES_URL=postgresql://... pnpm --filter web exec vitnode db migrate --yes
pnpm --filter web startUse --filter api for the migration in a monorepo app, whose API owns the database. Run migrations once per deployment, before the new version starts. --yes is required, because the CLI never waits for an answer without an interactive terminal. If two instances start at once, the second waits for the first instead of racing it.
What changes in a pipeline
Under CI, with piped output, or when stdin is not a terminal, the CLI:
- shows no spinners, animations or cursor movement
- never prompts: a command that needs a confirmation exits with code
2and names the flag to pass, such as--yes
--plain gives stable, prefixed lines that are easy to grep:
VitNode - Production build
[OK] Configuration loaded, plugin routes generated (1.5s)
[OK] Building client (21.7s)
[OK] Building server (12.8s)
[WARN] admin-D2kL8aQ1.js is larger than the recommended 500.0 kB for a client chunk.Size warnings never fail a build. Output and exit codes lists every exit code and how colors are chosen.