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
:
Copied1/2package.json3packageA/4package.json5scripts/6myScript.ts7packageB/8package.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:
javascriptCopied1// packageA/package.json2{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
bashCopied1npm ci --production
bashCopied1yarn install --non-interactive --production --frozen-lockfile
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 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:
jsonCopied1{2"scripts": {3"generate": "echo generating..."4},5"airplane": {6"postinstall": "npm run generate"7}8}