- Node.js (see
.nvmrcfor the development version). - pnpm 12 or later, installed globally without Corepack (e.g.
npm install -g pnpm; Microsoft developers, read Package registry first). Inside the repository, pnpm switches itself to the version pinned inpackage.json'spackageManagerfield. If you've runcorepack enable, runcorepack disable pnpmso Corepack's shim doesn't shadow the global pnpm. On Windows, use an elevated prompt if Node.js is installed underProgram Files.
pnpm installThis runs the postinstall script automatically. Then, from the repository root:
pnpm lint
pnpm build
pnpm testTo target a single workspace, add --filter <package-name> (e.g. pnpm --filter vscode-containers run build).
The repository does not check in an .npmrc, so installs use whichever registry your own configuration points at. pnpm-lock.yaml records no tarball URLs, so the same lockfile installs from either registry:
| Environment | Registry | Configured by |
|---|---|---|
| Microsoft developers | The internal azcode Azure Artifacts feed |
A tokenHelper in pnpm's global config (see below), which scripts/pnpmfile.mjs detects |
| External contributors and GitHub Actions | Public npm (https://registry.npmjs.org/) |
Nothing; this is the default |
Azure DevOps (.config/*.yml) |
The internal azcode feed |
The shared pipeline template writes an authenticated build-time .npmrc |
Microsoft developers authenticate with a pnpm tokenHelper. It asks the Azure CLI for a fresh feed token on every run, so there's no stored token to expire. When the azcode feed has a tokenHelper, the updateConfig hook in scripts/pnpmfile.mjs switches pnpm to azcode, only within this repository. Everywhere else, pnpm and npm keep the registry configured in ~/.npmrc.
You need the Azure CLI installed and signed in with az login, and the azcodeazdoar-ozy2 CoreIdentity entitlement, which grants access to the feed. Then, once per machine:
-
Point npm at a registry reachable from the corporate network, and install pnpm:
npm config set registry https://packagefeedproxy.microsoft.io/npm/ npm install -g pnpmThis proxy holds new versions for 7 days. That's fine for installing pnpm and for other projects. It's too slow for this repository, which uses packages as soon as they're published.
-
From the root of a clone you intend to keep, point pnpm's
tokenHelperforazcodeat the repository's token script. pnpm needs the script's absolute path, so if you later move or delete that clone, rerun this command from another clone. pnpm splits thetokenHelpervalue on whitespace, so the path can't contain spaces. If your clone's path does (e.g.C:\Users\Jane Doe\...), copy the script to a path without spaces and pointtokenHelperthere instead.Windows (PowerShell):
pnpm config set -g //devdiv.pkgs.visualstudio.com/DevDiv/_packaging/azcode/npm/registry/:tokenHelper "$PWD\scripts\azcode-token.cmd"
macOS/Linux:
pnpm config set -g //devdiv.pkgs.visualstudio.com/DevDiv/_packaging/azcode/npm/registry/:tokenHelper "$PWD/scripts/azcode-token.sh"
This writes pnpm's global auth.ini, which npm doesn't read. pnpm accepts tokenHelper only from user-level configuration. The scripts (scripts/azcode-token.cmd and scripts/azcode-token.sh) print a token from az account get-access-token for the Microsoft tenant and the Azure DevOps resource. pnpm downloads its pinned version before it loads the hook, so that download comes from the registry in ~/.npmrc.
If installs fail with 401 Unauthorized, run the script directly. It should print a token. If it fails, run az login --tenant 72f988bf-86f1-41af-91ab-2d7cd011db47. If the script prints a token but installs still fail with 401 or 403, check that you have the entitlement above.
Don't add a checked-in .npmrc. It would force external contributors and GitHub Actions onto a feed they can't authenticate to, and the Azure DevOps template defers to a checked-in .npmrc.
Azure Artifacts returns feed-specific tarball URLs and, for some packages, only a SHA-1 integrity. Whenever pnpm resolves dependencies, scripts/pnpmfile.mjs removes the feed URLs and keeps the integrity already recorded in pnpm-lock.yaml for the same package version. That way, updating the lockfile through the feed doesn't rewrite existing entries. pnpm-lock.yaml also records a checksum of the pnpmfile. After editing scripts/pnpmfile.mjs, run pnpm install --no-frozen-lockfile, or frozen installs fail with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH.