Yarn has a handy versioning config which allows you to configure git when a tag is created during versioning:
yarn config set version-tag-prefix "v"
yarn config set version-git-message "v%s"
However, I have a project with multiple npm projects inside of it and I want to version each with project-vn.n.n
and the above seems to be a global setting.
Is there a way to configure the prefix and message per package.json (without having to manually specify it)?
So, I just faced that exact same issue and found a way to fix it.
The short answer is that you can create a file .yarnrc
in each project directory, with the following content:
# example of myrepo/workspace1/.yarnrc
version-tag-prefix workspace-1-v
version-git-message "workspace-1 v%s"
That way when running yarn publish
from the workspace directory, or yarn workspaces run publish
from the root of the repository yarn use workspace1/.yarnrc
configuration.
A way to see where yarn is looking for config files is to run yarn <command> --verbose
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With