Skip to main content

CLI Reference

Commands

CLI CommandVS Code CommandDescription
npx degit evidence-dev/template my-projectEvidence: New Evidence ProjectCreate a new project from the template.
npm run sourcesEvidence: Run SourcesExtract data from sources.
npm run devEvidence: Start ServerStart the development server in the current directory.
npm run buildEvidence: BuildBuild the project for production.
npm run build:strictEvidence: Built StrictBuild, but fails on query or component errors. Components receiving empty data will fail.
npm run previewN/APreview the built site.
Ctrl / Cmd + CEvidence: Stop ServerStop the dev server (when running).
rN/ARestart the dev server (when running).

Options

Append flags with an extra -- after the command to modify behavior.

For example, npm run dev -- --port 4000 will start the development server on port 4000.

Some of the most common are:

CommandFlagDescriptionDetail
sources--changedOnly run sources whose queries have changed
sources--sources [source_name]Only run sources from the specified sourcesSeperate with commas --sources source1,source2
sources--queries [query_name]Only run the specified queriesSeperate with commas
sources--debugShow debug output
dev--open [path]Open browser to path on startup (string)Default --open / opens in root of the project
dev--host [host]Specify hostname (string)--host 0.0.0.0 can be helpful in containers
dev--port <port>Specify port (number)Automatically increment if default 3000 is in use

Evidence's dev, build and preview commands run using Vite, and so support Vite's options.

Environment Variables

You can set environment variables to configure Evidence in production. Most of these are used to set database credentials securely.

The format of environment variables for database credentials is EVIDENCE_SOURCE__[SOURCE_NAME]__[VARIABLE_NAME].

You can copy all your current environment variable values from the settings page at localhost:3000/settings.

N.B. Environment variables are case sensitive, so you should preserve the case specified in the settings page.