CLI Commands

Baybay has four commands. Run baybay <command> --help anywhere for the same information in your terminal.

Global flags

These flags work on every command:

FlagDescription
--config <path>Use a config file other than ./baybay.config.js.
--quietOnly print warnings and errors. Exit codes are unchanged.
--verbosePrint the resolved config and per-file timing.
--no-colorDisable ANSI colors (also respects the NO_COLOR env var).
--version, -vPrint version and platform, then exit.
--help, -hShow usage for the command.

baybay new

Scaffold a new project into a fresh directory. Refuses to write into a non-empty folder unless --force is given.

usage
baybay new <directory> [flags]
FlagDefaultDescription
--template <name>defaultStarter template: default, blog, docs, or bare (no layout, no CSS).
--locale <tag>enSet the default locale in the generated config.
--no-gitSkip git init and the generated .gitignore.
--forceScaffold into a non-empty directory, overwriting clashes.

Example

shell
$ baybay new field-notes --template blog --locale fil
 Created field-notes/
 Wrote 11 files (blog template, locale: fil)
 Initialized git repository

  next:  cd field-notes && baybay dev

baybay dev

Start the local development server with incremental rebuilds and live reload. Drafts (draft: true) are always included in dev.

usage
baybay dev [flags]
FlagDefaultDescription
--port <n>8484Port to listen on. Falls through to the next free port if taken.
--host <addr>localhostBind address. Use 0.0.0.0 to test from other devices on your network.
--openOpen the site in your default browser once the server is ready.
--no-reloadDisable live reload; rebuilds still happen, refresh manually.

Example

shell
$ baybay dev --port 3000 --open
baybay v1.4.2  dev server

   Local:    http://localhost:3000/

  built 12 pages in 96 ms · watching src/ and static/

baybay build

Compile the site for production into outDir (default dist/). Exits non-zero on any broken internal link, so it is safe to gate CI on.

usage
baybay build [flags]
FlagDefaultDescription
--out <dir>distOverride outDir for this build.
--base <path>/Override the public base path (e.g. /docs/).
--draftsInclude pages marked draft: true.
--no-minifySkip HTML/CSS minification (useful for diffing output).
--no-cleanDo not empty outDir before building.

Example

shell
$ baybay build --base /docs/ --verbose
baybay v1.4.2  production build

  config: baybay.config.js (base overridden by flag)
   12 pages compiled (en: 6, fil: 6)
   5 assets copied from static/
   0 broken links · sitemap.xml written

  dist/ · 12 pages · 88.6 kB total · 104 ms

baybay deploy

Run a production build, then publish outDir to a hosting target. Credentials are read from the environment (BAYBAY_TOKEN) or the host's own CLI login — Baybay never writes secrets to disk.

usage
baybay deploy --target <target> [flags]
FlagDefaultDescription
--target <name>Required. One of netlify, vercel, gh-pages, rsync.
--dest <spec>For rsync: destination, e.g. user@host:/var/www/site.
--branch <name>gh-pagesFor gh-pages: branch to push the build to.
--prodFor netlify/vercel: promote to the production URL instead of a preview.
--dry-runBuild and list what would be uploaded, then stop.

Example

shell
$ baybay deploy --target gh-pages --branch gh-pages
 Built 12 pages in 101 ms
 Committed dist/ to gh-pages (17 files)
 Pushed to origin/gh-pages

   Live: https://daiven.github.io/field-notes/

  deployed in 6.8 s

Exit codes

CodeMeaning
0Success.
1Build error (invalid config, template error, broken internal link).
2Deploy error (auth failed, upload rejected). The build itself succeeded.