View dependencies

Install dependencies

To install dependencies, you can add them to your script's package.json using standard npm, yarn, or pnpm commands:
bash
Copied
1
# Example installing the airplane SDK
2
npm install airplane
You should place your package.json file either next to your view 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

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:
yaml
Copied
1
# airplane.yaml
2
view:
3
envVars:
4
BUILD_NPM_TOKEN:
5
config: 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

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.
Copied
1
// .npmrc
2
//registry.npmjs.org/:_authToken=TOKEN_FOR_NPM
3
//npm.pkg.github.com/:_authToken=TOKEN_FOR_GITHUB
bash
Copied
1
cat .npmrc | airplane configs set --secret npmrc
Set the BUILD_NPM_RC environment variable in your airplane.yaml configuration file.
yaml
Copied
1
# airplane.yaml
2
view:
3
envVars:
4
BUILD_NPM_RC:
5
config: npmrc

Upgrading your views version

To upgrade to the latest version of @airplane/views, you can run:
bash
Copied
1
npm update @airplane/views
This will automatically update your @airplane/views package to its latest minor/patch version as long as it is prefixed with a ^ in your package.json.
We recommend upgrading your @airplane/views package often. We are constantly adding bug fixes, new features, and performance improvements.
Make sure you are on the latest version of @airplane/views if you run into any bugs or missing features!