Custom Node.js configuration

npm/Yarn workspaces

By default, the airplane CLI will find the nearest package.json and use that as the root of your task. All code in the root is included when building the task.
If you're using npm or Yarn workspaces, you may want the root to be the parent directory, so that you can install sibling packages. For example, you might be deploying packageA/scripts/myScript.ts:
Copied
1
/
2
package.json
3
packageA/
4
package.json
5
scripts/
6
myScript.ts
7
packageB/
8
package.json
While packageA/package.json will be identified as the root package.json for your task, you'll also want to include the parent folder (and siblings like packageB/) in the build.
To do this, in packageA/package.json you can override the root to be a parent directory:
javascript
Copied
1
// packageA/package.json
2
{
3
"airplane": {
4
"root": ".."
5
}
6
}
This will cause the root to get moved up a level, thus including packageA/ as well as packageB/ in the build. Note that the working directory will remain at packageA/—any build/install commands will still be run from the subdirectory.

Custom build settings

When you trigger a deploy, Airplane builds your tasks. The default build pipeline works most of the time, but you can also customize some steps.

Custom install

Airplane attempts to install dependencies by running
bash
Copied
1
npm ci --production
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 builds 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
}