Given the following state of my NextJS monorepo app:
develop
is default branch, testing environment and has multiple commits ahead of main
main
branch has fewer commits and only those ready for staging environmentmain
are pushed via PRs with cherry-picking from develop
develop
versioning of those private monorepo packages is all green (the yarn version check
command)main
and due to cherry-picking/reverts/squash/etc. the yarn version check
fails on the main
branch with the following error:yarn version check
➤ YN0001: UsageError: Your current branch contains multiple versioning files; this isn't supported:
- /Users/tbutcaru/Projects/my-nextjs-app/.yarn/versions/00648a82.yml
- /Users/tbutcaru/Projects/my-nextjs-app/.yarn/versions/009a6542.yml
- /Users/tbutcaru/Projects/my-nextjs-app/.yarn/versions/018f7b67.yml
- /Users/tbutcaru/Projects/my-nextjs-app/.yarn/versions/0197a805.yml
at h (/Users/tbutcaru/Projects/my-nextjs-app/.yarn/plugins/@yarnpkg/plugin-version.cjs:5:3539)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
....
.yarn/versions/...
files do not exist in my main
branch.Same issue here and here - closed without solution. I've already tried what others have said through comments in the mentioned links.
I've tried:
yarn version apply --all
yarn version check --interactive
.yarn/versions
file dir + yarn.lock and reinstall all packages.yarn/versions
file dir from develop
to main
changesetIgnorePatterns: - '.yarn/**/*'
in the .yarnrc.yml
file and I no longer get the error above but the following YN0000: @my-nextjs-app/shared-components@workspace:packages/shared-components has been modified but doesn't have a release strategy attached
and I've run the yarn version check --interactive
, so the package has a release strategy attached, but still the yarn version check
fails.... none of the above worked.
How can I fix the "multiple versioning files" issue?
Or, at least, how do I completely reset/reinit the yarn workspace packages versions on the main
branch?
Thank you!
I didn't find any solution to my issue with the initial setup described in the original post, but I've manage to fix the yarn version check --interactive
with a .yarnrc.yml
config change!
I'll try to provide a bit more context on the issue and solution.
Recently I've changed my repo's default branch from develop
to main
and that's how I've ended up with the issue above. The idea behind the default branch switch was to move to main
and archive develop
forever and that created a task of removing all codebase and configs related to develop
.
So, while working on removing any develop
branch leftovers from my repo, I've reached to .yarnrc.yml
which had the following config:
changesetBaseRefs:
- develop
- origin/develop
- upstream/develop
... changing it to:
changesetBaseRefs:
- main
- origin/main
- upstream/main
... resulted in yarn version check --interactive
and yarn version check
to work!