Yarn Constraints

Yarn Constraints let you declare cross-workspace rules — required fields in `package.json`, forbidden dependencies, version pinning, and consistency requirements — using a JavaScript or Prolog DSL. `yarn constraints` validates the project; `yarn constraints --fix` applies automatic fixes. Foundational for governed monorepos.

API entry from apis.yml

apis.yml Raw ↑
aid: yarn-pkg:yarn-constraints
name: Yarn Constraints
tags:
- Constraints
- Policy
- Prolog
- JavaScript
humanURL: https://yarnpkg.com/features/constraints
properties:
- url: https://yarnpkg.com/features/constraints
  type: Documentation
- url: https://yarnpkg.com/cli/constraints
  type: Documentation
- url: https://github.com/yarnpkg/berry/tree/master/packages/plugin-constraints
  type: SourceCode
description: Yarn Constraints let you declare cross-workspace rules — required fields in `package.json`,
  forbidden dependencies, version pinning, and consistency requirements — using a JavaScript or Prolog
  DSL. `yarn constraints` validates the project; `yarn constraints --fix` applies automatic fixes. Foundational
  for governed monorepos.