Skip to content

Scripts

Jonathan Sharpe edited this page Aug 24, 2024 · 8 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.
  • lint: runs ESLint against all the JavaScript in the project.
  • 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 in api/ and web/.

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