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.

Yarn Constraints is one of 10 APIs that Yarn publishes on the APIs.io network.

Tagged areas include Constraints, Policy, Prolog, and JavaScript. The published artifact set on APIs.io includes API documentation.

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.