microsoft / beachball

The Sunniest Semantic Version Bumper

Home Page:https://microsoft.github.io/beachball

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

beachball not updating yarn.lock (Yarn 2 / Yarn 3) when publishing

matthias-ccri opened this issue · comments

Hi all, this is related to #525 but for Yarn 2 / Yarn 3. (With Yarn 1 it works fine because Yarn 1 did not store workspace package versions in its lockfile).

Yarn 2's yarn.lock lockfile has blocks like this:

"@org/package@^1.0.0, @org/package@workspace:path/to/package":
  version: 0.0.0-use.local
  resolution: "@org/package@workspace:path/to/package"
  dependencies:
  ...

Whereas yarn 1 doesn't include workspace packages in yarn.lock at all.

So we're starting to use Yarn 3 at our org (:tada:), and we noticed that beachball would publish e.g. @org/package@2.0.0 but the lockfile would still say @org/package@^1.0.0 which would cause subsequent commit noise (and in our particular case, it failed our daily CI job which checked the lockfile with the yarn --immutable command).

Is it within the scope of beachball to update the Yarn 2 / Yarn 3 lockfile when running beachball publish?

Here's our current workaround:

beachball publish --yes --no-push
yarn --no-immutable
git add --all
git commit --message "applying package updates [skip ci]"
git push --set-upstream origin main

Using beachball@2.30.1 and yarn@3.2.3.

Beachball does something similar for updating npm lock files in updatePackageLock, so it could be reasonable to add yarn lock updating there as well (only if yarn 2 or 3 is detected).

Just as an FYI, our repo (FluentUI React Native) also updated to yarn 3 and ran into this issue. We have a workaround but also saw the updatePackageLock method as a "possible PR" place
Speaking of.. how did you link directly to the method in Github? I only know how to make text look like this

Thank you!