Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
We have provided a lot of developer automation for common tasks using the
"scripts" section in the
Below is a guide to some of the scripts you may find yourself using.
yarn install:all: install all of the client and server dependencies.
yarn client ...: run the provided command in the
yarn client add [whatever]allows you to install a new client dependency.
yarn dev: runs the app in development mode, where changes to the client or server code will cause a reload. This uses
nodemonto watch the server files and the
create-react-appserver for the client. In this mode you can visit the client at http://localhost:4200 and any requests will be proxied to the server (running on port 3000). Note that the browser will reload automatically if the client code changes, but you have to refresh the page manually to see changes in the server code. This also runs the Zapier spy.
yarn test:client:watch: watches the code in the
clientdirectory and re-runs the appropriate unit and integration tests whenever anything changes.
yarn test:scripts:watch: as above but for the
yarn test:server:watch: as above but for the
yarn e2e:dev: runs the end-to-end tests (see below) against the development mode of the application.
yarn cypress:dev: opens the Cypress UI and targets the development mode app, allowing you to see exactly what's happening in the end-to-end tests.
yarn mm migrate: apply the migrations specified in
server/migrationsto the local database (or the database specified with the
yarn mm create [name]: create a new migration file; see
lint:fixto automatically fix simple errors.
yarn test: runs the unit and integration tests for the client, script and server code.
yarn test:cover: runs all of the unit and integration tests and generates code coverage reports.
yarn e2e: runs the end-to-end tests, simulating a user interacting with the application in a browser, using Cypress. By default this runs against the app in production mode, on port 3000.
yarn e2e:ci: simultaneously starts the app in production mode (on port 3100 to avoid any conflicts) and runs the end-to-end tests against it, after waiting for the app to start. This also runs the Zapier spy.
yarn ship: runs linting, flow checking, unit and integration testing and the end-to-end CI test. This is executed by
huskywhen you try to push your git commits to a remote, as a final check that everything works correctly*.
yarn start: runs the app in the production mode, by building the React app, copying the resulting files over to the Express app's
static/directory, then starting the Express app. You can then visit the application at http://localhost:3000 (or whatever port you specify with the
PORTenvironment variable). Note that this will not start the Zapier spy, so you need to provide an
EMAIL_WEBHOOKif you want to test the password reset.
yarn zapier: runs the Zapier spy (see
e2e/fixtures/zapierSpy.js), which accepts any POST request to
/and stores the request bodies for later recovery via the
/_callsendpoint. This is used by the
e2e:ciscripts to allow testing of the password reset flow.
yarn generate-reports: each implementing partner gets a new report to fill in every month, created by this script. In production we're using PCF Scheduler to run this task on the first of every month, but you can also run this locally for testing (it will only generate one report per implementing partner per month, even if you run it more than once).
yarn hash-password [password]: uses
bcryptto create a hashed version of the supplied password to store in the database.
yarn send-due-emails: sends emails to anyone whose report is due in the next week, via the specified
* If you're making non-code changes, e.g. updating the documentation, you can
[ci skip] in the commit message to skip the Travis build and use the
--no-verify flag to
git push to skip the Husky hook.