Search code examples
continuous-integrationyarnpkg-v2

How to set yarn version configs in yarn2+?


I am moving my project from yarn1 to yarn2+.
I'm using yarn to bump the versions of the packages in a monorepo and setting config version options with a command e.g. yarn config set version-git-message in my ci pipeline.

However, with yarn2+ I am getting an error that says Couldn't find a configuration settings named "version-git-message"

My first question is, is it possible to set yarn version config options e.g. version-git-message and version-commit-hooks with yarn2+ ?

If not, how would I accomplish setting these version config options?

For reference, here are the scripts that I'm using in my CI pipeline

  - script: yarn config set version-git-message "v%s [skip ci]"
    displayName: 'tell the agent not to trigger a subsequent build after bumping the versions'
  - script: yarn config set version-commit-hooks false
    displayName: 'skip commit hooks'
  - script: yarn config set version-git-tag false
    displayName: 'skip commit tag'

Solution

  • Looks like yarn2+ removed a lot of their built in utilities that integrate with other tools. Where yarn 1 automatically created a git tag with the version script, yarn2+ doesn't do that, so the git tag management scripts from yarn1 are no longer around. Yarn2 also uses a plug-in architecture, so to use the version tools you'll need to install the version plugin