JavaScript dependencies
Install dependencies
Install dependencies
To install dependencies, you can add them to your script's
package.json using standard npm,
yarn, or pnpm commands:bashCopied1# Example installing the airplane SDK2npm install airplane
bashCopied1# Example installing the airplane SDK2yarn add airplane
bashCopied1# Example installing the airplane SDK2pnpm 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 root of your
project.Airplane skips installation of
devDependencies—if your application requires devDependencies, you
can override the install command. See Custom build steps.Private npm packages
Private npm packages
To install private packages from NPM, you'll need to generate an
access token with read-only permissions. Add it as a
Config Var and set it as an environment variable in your
airplane.yaml configuration file called BUILD_NPM_TOKEN:yamlCopied1# airplane.yaml2javascript:3nodeVersion: "18"4envVars:5BUILD_NPM_TOKEN:6config: BUILD_NPM_TOKEN
Build-time environment variables like
BUILD_NPM_TOKEN will only be applied if included in the
airplane.yaml configuration file.Other private packages
Other private packages
If you're using other private registries like GitHub packages, you can upload the entire contents of
your
.npmrc file as a config variable (assuming the tokens are stored there) and set the
BUILD_NPM_RC environment variable:Upload
.npmrc as a config variable.Copied1// .npmrc2//registry.npmjs.org/:_authToken=TOKEN_FOR_NPM3//npm.pkg.github.com/:_authToken=TOKEN_FOR_GITHUB
bashCopied1cat .npmrc | airplane configs set --secret npmrc
Set the
BUILD_NPM_RC environment variable in your
airplane.yaml configuration file.yamlCopied1# airplane.yaml2javascript:3nodeVersion: "18"4envVars:5BUILD_NPM_RC:6config: npmrc
npm/Yarn/pnpm workspaces
npm/Yarn/pnpm workspaces
By default, the
airplane CLI will find the nearest package.json to determine the root directory
of your project.If you are using npm, yarn, or pnpm workspaces, you must tell Airplane where to find the root of
your workspace. See
Yarn, npm, and pnpm workspaces
for instructions.