dhoulb / multi-semantic-release

Proof of concept that wraps semantic-release to work with monorepos.
BSD Zero Clause License
203 stars 36 forks source link

fix: handle pnpm monorepo `workspace:^` version correctly (#111) #128

Closed lyh543 closed 2 years ago

lyh543 commented 2 years ago

resolve #111: support of replacing pnpm's workspace: dependencies version. pnpm docs

I modify current existing tests, since I think it should work like this :P. Anyway, I may have misunderstanding on this project, so I'm happy to discuss with contributor.

After I'm allowed to modify current existing tests, I will add integration tests on monorepo that uses pnpm workspace: protocol.


Update: integration tests added.

lyh543 commented 2 years ago

Why I modify the existing tests

Due to the --deps.bump docs from README:

Define deps version update rule. override — replace any prev version with the next one, satisfy — check the next pkg version against its current references. If it matches (* matches to any, 1.1.0 matches 1.1.x, 1.5.0 matches to ^1.0.0 and so on) release will not be triggered, if not override strategy will be applied instead; inherit will try to follow the current declaration version/range. ~1.0.0 + minor turns into ~1.1.0, 1.x + major gives 2.x, but 1.x + minor gives 1.x so there will be no release, etc.

In yarnWorkspacesPackagesCarret, all deps are defined like ^0.0.0. In my opinion, with inherit as rule, deps version in new package.json should keep the ^1.0.0 style, so I update the test expectation.

Discussions are welcome👋

antongolub commented 2 years ago

We also experimented with the workspace protocol in https://github.com/semrel-extra/zx-bulk-release/blob/master/src/main/js/deps.js#L56. I'm not sure if this implementation is correct, but it might be a starting point.

lyh543 commented 2 years ago

We also experimented with the workspace protocol in https://github.com/semrel-extra/zx-bulk-release/blob/master/src/main/js/deps.js#L56. I'm not sure if this implementation is correct, but it might be a starting point.

This implementation with regex is really simple! I'm so amazed that I refactored my code immediately.

BTW, can you review the part that modified existing tests? I wonder if I caught an bug or just misunderstood the code.

antongolub commented 2 years ago

@Badisi, @moroine, could you pls take a look?

antongolub commented 2 years ago

:tada: This PR is included in version 3.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: