versionize icon indicating copy to clipboard operation
versionize copied to clipboard

Versioning a monorepo

Open sreejith-ms opened this issue 4 years ago • 5 comments

Any thoughts on supporting a monorepo?

Currently, versionize shows an error message if multiple project files have different versions.

sreejith-ms avatar May 07 '21 12:05 sreejith-ms

How would that work? How would you differentiate which commit is for which project to be able to set the correct semantic version for each project?

nerdybynature avatar May 13 '21 17:05 nerdybynature

I think that a joint versioning strategy could be implemented in which each project will have the same version number. A disjoint versioning schema will be more complex taking project dependencies into account

saintedlama avatar May 14 '21 05:05 saintedlama

@saintedlama @nerdybynature Take a look at my fork (a quick and dirty one:blush:, but did the purpose for me).

Here is the gist:

Create a version.json file for each projects in solution (similar to GitVersioning)

Here is a sample version.json file

{
  "version": "1.0.0",
  "scopeName": "foolib",
  "parentScopes": []
}
  • version indicates the current version of the project.
  • scopeName is used to indicate the package names in a monorepo
  • The scopeName must be used in the commit message, it is the [optional scope] in conventional commits specification.
  • Sample commit message: feat(foolib): add foobar
  • The versioning of the package is calculated by using the scopeName. The scopeName also used in tagging and changelog.
  • parentScopes is used to indicate a dependency packages. Suppose a project foo depends on another project bar, then a commit in bar should cause a version bump in foo. To acheive this the parentScopes in foo must refer to bar. Example: "parentScopes": ["bar"]
  • The version gets bumped based on your commit history with scope

sreejith-ms avatar May 15 '21 06:05 sreejith-ms

I'd be happy if all the projects had same version number...

clarity99 avatar Nov 03 '22 22:11 clarity99

I'll toss my vote in for this one as well.

I have a project that has a structure like:

repo
- api (console)
- authentication (library)
- configuration (library)
- data (library)
- logic (library)
- security (library)
- utility (library)

All projects belong to the same application (call it "api").

I currently use the /p:AssemblyVersion and /p:Version parameters of the dotnet publish command to increment the version number of the generated assemblies manually during my CI build based on the most recent tag found on the repo.

Only one project (api) has a <Version> tag in its .csproj file.

Ideally, I'd be able to add versionize into the mix to automatically increment the version number based on conventional commit messages prior to execution of dotnet build. That way, the CI and the assemblies would all have the same version.

gsroberts avatar Jun 24 '23 13:06 gsroberts

Someone contributed #121 recently, so I'll go ahead and close this issue. If it doesn't match your expectations, feel free to create a new issue.

cabauman avatar May 05 '24 01:05 cabauman