Registry / devops / update-ts-references

update-ts-references

JSON →
library6.0.0jsnpmunverified

Automatically updates TypeScript project references in tsconfig.json files based on workspace dependencies from package.json. Version 6.0.0 requires Node.js >=22.13.0. Works with npm, yarn, pnpm, and lerna monorepos. It reads dependencies out of package.json and applies them as references in tsconfig.json, optionally creating tsconfig files and path mappings. A key differentiator is its support for createTsConfig (auto-creates tsconfig for packages with .ts/.tsx main entries) and createPathMappings (generates path mappings for IDE support). Released under active maintenance on GitHub by eBayClassifiedsGroup.

npm install update-ts-references
INSTALL
IMPORT
SIG · UPDATE-TS-REFERENC
U
update-ts-references
devopsjavascriptv6.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

update-ts-references
npx update-ts-references
yarn add update-ts-references -D -W && yarn update-ts-references
Primarily a CLI tool; use npx for one-off runs or add as devDependency and run via npm script.
programmatic usage
const { updateTsReferences } = require('update-ts-references');
import { updateTsReferences } from 'update-ts-references';
Package does not export any public API in v6; use CLI only.
npx
npx update-ts-references --help
npm install -g update-ts-references && update-ts-references
Global install is not recommended; npx ensures latest version.

Scans all packages in the monorepo and updates their tsconfig.json files to match package.json dependencies.

npx update-ts-references --cwd /path/to/monorepo
Debug
Known issues
breakingRequires Node.js >=22.13.0 as of v6.0.0. Older Node may cause crashes.
fix
Upgrade Node.js to v22.13.0 or later, or pin to v5.x (last compatible with Node 14+).
affects: >=6.0.0
breakingThe --check option only performs a dry-run but does not output exit code 1 if changes needed; may break CI pipelines that rely on exit codes.
fix
Use exit code detection manually or wrap in a script that diffs the output.
affects: >=6.0.0
deprecated--createTsConfig may generate problematic tsconfig if base config is missing; consider manual setup instead.
fix
Review generated tsconfig files and ensure base config exists at expected path.
affects: >=6.0.0
gotchaPath mappings generated with --createPathMappings may not match actual rootDir if not defined in referenced package's tsconfig; falls back to 'src' silently.
fix
Ensure each package's tsconfig has an explicit rootDir.
affects: >=6.0.0
gotchaTool only processes packages that have a main entry in package.json pointing to a .ts/.tsx file when using --createTsConfig.
fix
Manually create tsconfig for packages without .ts/.tsx main entries.
affects: >=6.0.0
Errors
Common errors & fixes
Error: Cannot find module 'update-ts-references'
Package not installed or npx not caching correctly.
fix
Run 'npx update-ts-references' directly without prior install, or install as devDependency.
Reference '..' not found when running update-ts-references
Package dependencies in package.json reference packages outside the monorepo root.
fix
Ensure all dependencies are local workspace packages; use npm/yarn/pnpm workspaces correctly.
TypeScript project references must form a single acyclic graph
Circular dependencies between packages in monorepo.
fix
Restructure packages to avoid circular references or use TypeScript 3.9+ with --strict mode.
Upgrade
Version history
6.0.0latest on npm
Audit
Dependencies
typescriptrequiredRequires TypeScript project references feature to function
workspace tools (lerna, yarn, pnpm, npm)optionalRequires a workspace-aware monorepo setup to read package dependencies
Agent activity
2 hits · last 30 days
node
2
Resources
update-ts-references — npm install update-ts-references · libregistry