Yarn: Add option to change version of all workspaces together

Created on 5 Jul 2018  路  5Comments  路  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?

Feature

What is the current behavior?
yarn version only changes current package.json file

What is the expected behavior?
yarn version should have to option to change the version in all workspaces, or a version command should be added to yarn workspaces.

e.g.
yarn workspaces version will change the version in all workspaces to the new one.

This will be useful for packages that you always want to stay in sync, and get released together.

triaged

Most helpful comment

Hi @milesj Lerna resolves the versioning, but in my case it also added other issues with npm-run-all (https://github.com/lerna/lerna/issues/2145).

@alexbrazier @alexindigo because of the issue that I had with Lerna, I decided to create an script to update the versions: https://github.com/dfernandez79/set-versions if you only want to update the versions it may be useful (if you want to do more stuff... take a look to Lerna).

All 5 comments

@alexbrazier I was just looking for something like this. Thanks for taking the time to write up the proposal.

@alexbrazier Would Lerna work here? https://github.com/lerna/lerna

Also would be useful to have option to change versions simultaneously in all workspaces and in the root package.json, for complex applications we build in corporate world, where we not only publish our workspaces on npm, but use root package.json version for other tooling.

Hi @milesj Lerna resolves the versioning, but in my case it also added other issues with npm-run-all (https://github.com/lerna/lerna/issues/2145).

@alexbrazier @alexindigo because of the issue that I had with Lerna, I decided to create an script to update the versions: https://github.com/dfernandez79/set-versions if you only want to update the versions it may be useful (if you want to do more stuff... take a look to Lerna).

The following currently works:

/packages/A/package.json
"scripts": {
  "prerelease": "yarn version --patch",
  "release": "npm publish", 
}

/packages/B/package.json
"scripts": {
  "prerelease": "yarn version --patch",
  "release": "npm publish", 
}

/package.json
"scripts": {
  "release": "yarn workspaces run release"
}

This does a decent job of keeping the versions in sync as well

Was this page helpful?
0 / 5 - 0 ratings