View 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 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
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.yaml2view:3envVars:4BUILD_NPM_TOKEN:5config: 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.yaml2view:3envVars:4BUILD_NPM_RC:5config: npmrc
Upgrading your views version
Upgrading your views version
To upgrade to the latest version of
@airplane/views
, you can run:bashCopied1npm update @airplane/views
bashCopied1yarn upgrade @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!