Principle:Cypress io Cypress Monorepo Dependency Management
| Knowledge Sources | |
|---|---|
| Domains | Build, Monorepo |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
A workspace-based dependency management strategy that links inter-package dependencies within a monorepo, enabling development across 30+ packages with a single install command.
Description
The Cypress monorepo contains 30+ packages that depend on each other. Yarn workspaces resolve these internal dependencies by symlinking packages rather than downloading them from npm. This enables developers to make changes in one package and immediately see the effects in dependent packages.
The postinstall pipeline extends basic installation with patch-package (applying local patches to dependencies), yarn-deduplicate (reducing duplicate packages), and an initial yarn build to ensure all packages are compiled.
Usage
Use this principle when setting up the Cypress development environment for the first time or when dependency changes require a fresh install.
Theoretical Basis
Workspace Resolution:
package.json: { "workspaces": ["cli", "packages/*", "npm/*", "tooling/*", "scripts"] }
Install Pipeline:
1. yarn install → resolve all workspace dependencies
2. postinstall → node scripts/run-postInstall.js
a. patch-package → apply local dependency patches
b. yarn-deduplicate → reduce duplicate packages
c. lerna run rebuild-better-sqlite3 → native module rebuild
d. yarn build → compile all packages
e. yarn build-v8-snapshot-dev → generate dev snapshot