NPM Scripts
Custom scripts for common shell commands can be written in package.json
and run via 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.
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 disabled.dev:home:video
runs the app with equipment disabled and video enabled.dev:clinic
runs the app with equipment enabled.dev:clinic:video
runs the app with equipment enabled and video enabled.dev:turk-prolific
runs the app with prolific and PsiTurk enabled.
Firebase Development
dev:firebase
runs the app with Firebase enabled.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/
.
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
cli
runs the Firebase CLI script.commit
runs Commitizen in the console. It is useful for ensuring your Git commit messages are easy to follow.format
uses Prettier to style code in a consistent format.lint
uses Eslint to find problems in the code.postinstall
is run automatically afternpm install
and is used to rebuild the Electron dependenciesprepare
is run automatically before the project is packaged/installed and is used to set up the project's pre-commit hooksprebuild
is run automatically beforenpm run build
and is used to rebuild the Electron dependencies