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.

  1. Install dependencies: Airplane installs dependencies listed in the dependencies section of your package.json using the following command. If you do not have a package.json, no dependencies are installed. Airplane detects if you're using npm or yarn and runs the respective command::
bash
Copied
1
npm ci --production
  1. 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:

json
Copied
1
{
2
"airplane": {
3
"install": "npm ci --include=dev"
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:

json
Copied
1
{
2
"scripts": {
3
"generate": "echo generating..."
4
},
5
"airplane": {
6
"postinstall": "npm run generate"
7
}
8
}