Comparing Packages Across Monorepo Workspaces

Compare package.json files from different workspaces in a monorepo to find version inconsistencies and missing shared dependencies.

Monorepo Management

Detailed Explanation

Monorepo Package Consistency

In monorepos (using npm workspaces, Yarn workspaces, pnpm workspaces, or Turborepo), each workspace has its own package.json. Keeping dependency versions consistent across workspaces prevents subtle bugs caused by version mismatches.

Common inconsistency patterns

# packages/web/package.json vs packages/api/package.json

dependencies:
  ~ zod: ^3.21.0 -> ^3.22.0        [MINOR]
  ~ typescript: ^5.2.0 -> ^5.3.0   [MINOR]
  + @prisma/client: ^5.0.0         [ADDED - only in api]
  - react: ^18.2.0                 [REMOVED - only in web]

Why consistency matters

Issue Consequence
Different TypeScript versions Incompatible type definitions across packages
Mismatched shared library versions Runtime errors when passing data between packages
Missing peer dependencies Warnings or silent failures
Duplicate dependencies Increased node_modules size

How to use the diff for monorepo auditing

  1. Copy the package.json from workspace A (e.g., packages/web/package.json)
  2. Paste it into the left panel
  3. Copy the package.json from workspace B (e.g., packages/api/package.json)
  4. Paste it into the right panel
  5. Click Compare and filter to Changed only to see version discrepancies

Fixing inconsistencies

After identifying mismatches, you can:

  • Use the root package.json overrides field (npm) or resolutions field (Yarn) to enforce versions
  • Create a shared tsconfig.base.json that all workspaces extend
  • Use tools like syncpack to automatically align versions

Use Case

A monorepo maintainer notices flaky tests in CI and suspects version mismatches between the frontend and backend workspaces. They compare both package.json files to find that the shared validation library has different versions in each workspace.

Try It — Package.json Diff

Open full tool