To install dependencies, you can add them to your script's
you normally would:
bashCopied1# Example installing the airplane SDK2# Updates package-lock.json3npm install airplane
bashCopied1# Example installing the airplane SDK2# Updates yarn.lock3yarn add airplane
You should place your
package.json file either next to your task or in a parent directory. The
closest directory containing a
package.json becomes the task root—the task root is uploaded
Airplane skips installation of devDependencies—if your application requires devDependencies, you can override the install command. See Custom build steps.
Private npm packages
Environment variables are set at build time in addition to runtime—when building, Airplane will look
BUILD_NPM_TOKEN and configure a
.npmrc file for you.
Other private packages
If you're using other private registries like GitHub packages, you can upload the entire contents of
.npmrc file as a config variable (assuming the tokens are stored there) and set the
BUILD_NPM_RC environment variable:
.npmrc as a config variable.
bashCopied1cat .npmrc | airplane configs set --secret npmrc
BUILD_NPM_RC environment variable.
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/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:
This will cause the root to get moved up a level, thus including
packageA/ as well as
in the build. Note that the working directory will remain at
commands will still be run from the subdirectory.