NPM Scripts
Custom scripts for common shell commands can be written in package.json
and run the node package manager (NPM). All of the commands needed to develop, build, and deploy Honeycomb are written as scripts.
Additional scripts can be created if desired but we generally recommend against changing or deleting the scripts Honeycomb ships with.
npm run <script>
Start
start
runs the app in development mode and does NOT open a browser. This makes working with electron easier as it creates its own browser for development.start:browser
runs the app in development mode and automatically opens a new browser tab. It uses your system's default browser. The page will reload if you make edits.start:electron
: Waits for the app to be running (fromstart
) and then starts an electron process.
Firebase
firebase:emulators:start
starts the Firebase emulators with the data found inemulator_data/
firebase:emulators:save
saves the current state of the Firebase emulators intoemulator_data/
firebase:download
runs thefirebase-download-script.js
script, saving certain data in Firebase to your local machine.
Dev
npm run dev
runs the app in development mode on Electron. It executes start
and start:electron
concurrently.
Note that this is a base script that other scripts build on top of - you should always run one of the scripts below while developing your app. The additional scripts execute npm run dev
with different environment variables.
dev:home
runs the app with equipment disableddev:home:video
runs the app with equipment disabled and video enableddev:clinic
runs the app with equipment enableddev:clinic:video
runs the app with equipment enabled and video enableddev:turk-prolific
runs the app with prolific and PsiTurk enabled
Firebase
Working with Firebase is slightly different as it is meant to be run on the browser. npm run dev:firebase
executes start:browser
with Firebase enabled, which will automatically launch the running app in your default browser. It can be found on other browsers by navigating to localhost:3000.
dev:firebase
must be run in conjunction with firebase:emulators:start
to work properly. This runs the Firebase Emulators locally with some dummy data. The emulator data can be viewed at localhost:4000.
npm run firebase:emulators:start
must be run in a separate terminal window that stays during development.
The dummy study is s1
and the dummy participant is p1
.
Build
npm run build
creates a production build of the app in the build/
folder.
Note that this is a base script that other scripts build on top of - you should always run one of the scripts below while developing your app. The additional scripts execute npm run build
with different environment variables.
build:home
builds the app with equipment disabledbuild:home:video
builds the app with equipment disabled and video enabledbuild:clinic
builds the app with equipment enabledbuild:clinic:video
builds the app with equipment enabled and video enabledbuild:firebase
builds the app with Firebase enabledbuild:turk-prolific
builds the app with prolific and PsiTurk enabled
Package
npm run package:[platform]
creates a standalone installer for the given platform using electron-forge. The installer is created in out/
. Note that the scripts build the app before creating the installers
npm run package:windows
npm run package:linux
npm run package:mac
Packaging for windows on a non-windows machine requires mono
and wine
to be installed.
Miscellaneous
commit
runs commitizen in the console. It is useful for ensuring your Git commit messages are easy to follow.lint
uses Eslint to find problems in the code.format
uses Prettier to style code in a consistent format.test
launches the test runner in the interactive watch mode. See running tests for more information.