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. 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 install 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
}

Build hooks

Airplane lets you customize your task's build process through Build hooks. For Node 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 your package.json.
    json
    Copied
    1
    {
    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 your package.json, for example:
    json
    Copied
    1
    {
    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.