↑ ↓ to move · Enter to open · Esc to close

Tooling

CLI reference

Every white command, the generators, live reload and white doctor.

The package exposes two binaries, white and white-js, both pointing at bin/white.js.

Command What it does
white run start the site
white run dev start with restart on changes
white install example:<name> [folder] create a project from an example
white plugin add <name...> install and enable plugins
white plugin remove <name...> remove plugins
white routes list every route and the file it comes from
white make route <path> [--api] [--no-view] create a route and its view
white make middleware <folder> create a _middleware.js for api/... or client/...
white make plugin <name> create a local plugin and register it
white mesh status check that every peer answers and accepts our signature
white mesh keygen print a new random secret for a service link
white doctor [--deep] [--json] [--strict] diagnose the project without changing it
white migrate [name@version] move to another protocol generation (docs)
white protocol list | info <name> show the protocol registry (docs)

#Live reload

white run dev refreshes the browser by itself:

  • a changed view reloads the page;
  • a changed .css file in public/ is swapped in place, so scroll position and page state stay;
  • a changed server file restarts the server, and the open page reloads once it is back.

It is active only in white run dev. Turn it off with dev: { reload: false } in white.config.js.

#Generators

sh
white make route about                 # server/routes/client/about.js + app/views/about.eta
white make route "blog/[slug]"         # GET /blog/:slug, with req.params.slug passed to the view
white make route "docs/[...path]"      # GET /docs/*path, req.params.path is an array
white make route status --api          # server/routes/api/status.js, answers JSON
white make middleware api/admin        # server/routes/api/admin/_middleware.js, runs before every route below it
white make plugin analytics            # server/plugins/analytics.js, added to white.config.js

Existing files are never overwritten.

#white routes and white doctor

white routes prints every method, URL and source file, including routes of nested routers.

white doctor is a read-only diagnosis. It checks the Node version, package.json, the config, the folders, the layout of the route files (unknown groups, bad parameter names, conflicts), how every plugin resolves, the protocol generations in use (Protocols) and whether the port is free. It does not run your plugins or routes; add --deep to load the whole app as white run would, which does run them.

Findings have four severities: info, warning, error and critical (a security problem). Exit code: 0 nothing worse than warnings, 1 errors, 2 critical security problems. --strict makes warnings exit with 1, and --json prints the result for CI.