Install your first package
Install a package through Depot without creating an organization token. This walkthrough uses npm and the built-in npmjs cache. Other clients follow the same flow in the ecosystem guides.
Before you begin
You need a Depot account, membership in a Depot organization, the Depot CLI, and npm. Reader access is sufficient to install packages.
Install through Depot
-
Sign in to Depot:
depot login -
Open your organization's Packages, select Cache repositories, and open npmjs. Copy the organization ID from the repository endpoint on Setup.
-
Configure npm to use the cache:
depot packages configure npm --org <org-id> --repository npmjsReplace
<org-id>with the copied organization ID. The command sets the registry and saves your token in your user~/.npmrc. -
Install a dependency:
npm install lodashnpm installs
lodashthrough Depot, and Depot caches the upstream download. You can find the package in thenpmjsrepository in Packages.
Rerun depot packages configure when your login token changes. To keep the token out of ~/.npmrc, or to configure CI, follow the npm guide instead.
Publish a private package
Publishing requires a Private repository or a Virtual repository with publishing enabled. Ask an owner or administrator to create a Private npm repository named internal in Packages.
-
In a package project with a valid
nameandversioninpackage.json, configure the publish destination:depot packages configure npm --org <org-id> --repository internal --auth-only npm pkg set publishConfig.registry=https://packages.depot.dev/<org-id>/npm/internal/--auth-onlysaves a credential forinternaland keepsnpmjsas your install registry.The package must not have
"private": true. Choose a package name and version your team hasn't published. -
Publish the package:
npm publish -
Open
internalin Packages and confirm that the version appears.
The Private repository contains your packages. To install those packages alongside npm dependencies through one URL, create a Virtual repository.