yarnpkg / yarnpkg/berry

[Feature] yarn version --deferred should modify the directory of every affected package

Open
#925 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

  • I'd be willing to help implement this feature
  • This feature would be implemented on the version plugin

Describe the user story

Setup:

A workspaces based monorepo. CI done using GitLab (although the same problem probably exists in other, but not all CI vendors). test repo: https://github.com/bryanlarsen/berry

"service" package has dependency "mod".

A developer makes a change to "mod" and then runs yarn version check --interactive, resulting in a commit something like https://github.com/bryanlarsen/berry/commit/933e47a664087a5a13be8bc8039081e59c5ef49d

The CI system therefore needs to run the tests for both "mod" and "service". However, it should not run pipelines for any other packages.

Describe the solution you'd like

yarn version --deferred when used with workspaces should create a file within each marked package in addition to the files it creates within .yarn/releases of the workspaces root. The CI system can trivially detect that a subdirectory has changed and run appropriate stages.

Describe the drawbacks of your solution

  • the standard drawbacks of denormalization
  • the current version of yarn version apply would not clean up the new files created by this hypothetical new version of yarn version --deferred

Describe alternatives you've considered

  • I could write a script stage that parses .yarn/versions and creates a GitLab artifact, but AFAICT surprisingly it seems there is no way for only: to trigger off an artifact in GitLab. Even if there was, this seems like a lot of rigamarole for a seemingly minor problem.

  • I could have the CI system push to the repo to do something similar, but having the CI system also creating commits really messes with developers who now have to do a pull before every push

  • Instead of having stages not run when they don't need to, I can have them exit early if they don't need to run. The problem here is that for many packages, starting the stage takes a lot more time than actually running the tests so this doesn't save much.

  • I can create a script that wraps yarn version --deferred that I force our devs to use. Probably better just to fork the version plugin instead. But if I'm going to do this, getting the input from the yarn berry devs is highly useful. -> this feature request

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

Review the version plugin and trace how yarn version --deferred writes under .yarn/releases and reads .yarn/versions for workspaces. Check the behavior of yarn version apply, then define tests showing that every affected package receives the expected directory change and that deferred files are cleaned up.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.