yarnpkg / yarnpkg/berry

[Feature] Built-in constraints

Open
#469 5 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
TypeScript
Stars
8.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

  • I'd be willing to implement this feature
  • This feature can already be implemented through a plugin

Describe the user story

As a user I don't want to spend too much time learning constraints for basic needs, like enforcing same package version in all my workspaces.

Describe the solution you'd like

Ideally, I would like to use built-in reusable constraints. Currently there are few examples available in the documentation and in this repository.

Instead of copy-pasting:

% This rule will enforce that a workspace MUST depend on the same version of a dependency as the one used by the other workspaces
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange2, DependencyType) :-
  % Iterates over all dependencies from all workspaces
    workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType),
  % Iterates over similarly-named dependencies from all workspaces (again)
    workspace_has_dependency(OtherWorkspaceCwd, DependencyIdent, DependencyRange2, DependencyType2),
  % Ignore peer dependencies
    DependencyType \= 'peerDependencies',
    DependencyType2 \= 'peerDependencies'.

I would like something like:

enforce_same_version_everywhere()

These built-in constraints would be tested and maintained by experienced prolog developers.

Describe the drawbacks of your solution

  • Such built-in constraints may not be suitable for all the use cases.
  • More work for the yarn maintainers;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the constraints documentation and the examples in constraints.pro first, especially the same-version rule shown in the issue. Define the built-in constraint API and scope from the requested enforce_same_version_everywhere() example. Done means reusable basic constraints are available without copy-pasting Prolog and are tested and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.