Skip to main content
Version: 3.3.x

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.

Executing an NPM Script
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 (from start) 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 in emulator_data/.
  • firebase:emulators:save saves the current state of the Firebase emulators into emulator_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.

caution

npm run firebase:emulators:start must be run in a separate terminal window that stays during development.

tip

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 disabled
  • build:home:video builds the app with equipment disabled and video enabled
  • build:clinic builds the app with equipment enabled
  • build:clinic:video builds the app with equipment enabled and video enabled
  • build:firebase builds the app with Firebase enabled
  • build: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
info

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 after npm install and is used to rebuild the Electron dependencies
  • prepare is run automatically before the project is packaged/installed and is used to set up the project's pre-commit hooks
  • prebuild is run automatically before npm run build and is used to rebuild the Electron dependencies