Node.js build steps
By default, Airplane handles installing dependencies and building your code for you. See Custom build steps below to suplement this behavior.
- Install dependencies: Airplane installs dependencies listed in the
dependencies
section of yourpackage.json
using the following command. If you do not have a package.json, no dependencies are installed. Airplane detects if you're usingnpm
oryarn
and runs the respective command::
bashCopied1npm ci --production
bashCopied1yarn install --non-interactive --production --frozen-lockfile
- Transpile and bundle: Airplane transpiles your code into JavaScript that supports your task's Node version. The transpiled code uses CommonJS modules—the default for Node.js applications. If your task pulls in other files, they are bundled into one single file.
Custom build steps
The default build steps work for most tasks, but you can also customize some steps.
Install
You can override the install command in your package.json
. For example, to install both
dependencies
and devDependencies
, add:
jsonCopied1{2"airplane": {3"install": "npm ci --include=dev"4}5}
jsonCopied1{2"airplane": {3"install": "yarn install --non-interactive --production=false --frozen-lockfile"4}5}
Post install
After Airplane has installed dependencies, it transpiles and bundles your task. If you need to run a
custom script before the build stage, you can add a postinstall command to your package.json
. For
example:
jsonCopied1{2"scripts": {3"generate": "echo generating..."4},5"airplane": {6"postinstall": "npm run generate"7}8}