Skip to content

Scripts

Jonathan Sharpe edited this page Feb 5, 2025 · 9 revisions

Various scripts are provided in the package file, but many are helpers for other scripts; here are the ones you'll commonly use:

  • dev: starts the frontend and backend in dev mode, with file watching (note that the backend runs on port 3100, and the frontend is proxied to it - see Architecture#Development Mode).
  • e2e: builds and starts the app in production mode and runs the Playwright tests against it.
    • e2e:dev: builds and starts the app in dev mode and runs the Playwright tests against it.
  • lint: runs ESLint and Prettier against all the relevant files in the project.
    • format: reformats the code with Prettier.
    • lint:fix: attempts to fix all ESLint and Prettier violations.
  • serve: builds and starts the app in production mode (see Architecture#Production Mode) locally.
  • ship: runs lint, then test, then e2e; ideal before a git push.
  • test: runs the unit and integration tests.
    • test:cover: runs the tests and outputs coverage data.

Note that npm [run] start is designed for production use (in e.g. Heroku), so will likely not do what you expect if you run it locally; it may run older code, or you may see an error like:

error:  [Error: ENOENT: no such file or directory, stat 'path/to/api/static/index.html'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: 'path/to/api/static/index.html',
  expose: false,
  statusCode: 404,
  status: 404
}
info:   GET / 500 3.442 ms - 21

when you try to visit http://localhost:3000.

The code needs to be built before being started - that happens automatically in e.g. Heroku, and is what npm run serve does for you (see Architecture#Production Mode).

Clone this wiki locally