JavaScript build steps
By default, Airplane handles installing dependencies and building your code for you. See
Custom build steps below to supplement this behavior.
- Install dependencies: Airplane installs dependencies listed in the
dependencies
section of yourpackage.json
. If you do not have apackage.json
, no dependencies are installed. Airplane detects if you're usingnpm
oryarn
and runs the respective install command::
bashCopied1npm ci
bashCopied1yarn install --non-interactive --frozen-lockfile
- Transpile and bundle: Airplane transpiles your code into JavaScript that supports your task's
Node version (as specified in your
airplane.yaml
configuration file). 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}
Build hooks
Airplane lets you customize your task's build process through Build hooks. For
JavaScript tasks, you can explicitly specify those hooks via your
package.json
which will take
precedence over the corresponding build hook file, if any.-
To run a script before dependency installation, you can add a
preinstall
command to yourpackage.json
.jsonCopied1{2"scripts": {3"generate": "echo generating..."4},5"airplane": {6"preinstall": "npm run generate"7}8} -
To run a script after dependency installation, but before we transpile and bundle your task, you can add a
postinstall
command to yourpackage.json
, for example:jsonCopied1{2"scripts": {3"generate": "echo generating..."4},5"airplane": {6"postinstall": "npm run generate"7}8}
For build hooks that span multiple lines, it's recommended that you use
Build hooks instead.