Skip to content

Support monorepos with multiple projects #7

@crqrdotcom

Description

@crqrdotcom

Tracker

Description

Support repositories with multiple projects (aka monorepos).

A --project (aliased -p) global option should be introduced that allows maintainers of monorepos to specify which project they want to query/bump versions for.

If we're inside a sub-directory on the Git repository, that sub-directory is used as the default value for --project.

Version increments are detected based on commits that affect at least one file/directory inside the --project directory.

Tags for versions in monorepos are prefixed with the name of the project. For example, if we have a project inside /workflows/release the tag that should be created is workflows/release/[VERSION]

Example

For a repository with the following structure:

| workflows/
|-- release/
|-- build/

where each directory inside workflows is a project and, for demonstration purposes, imagining each is currently on version 0.0.1 and each have a commit fix: demo commit that modifies a file those directories:

$ git semver next -p workflows/release
0.0.2
$ git semver bump -p workflows/release
0.0.2 # creates tag workflows/release/0.0.2
$ git semver latest -p workflows/release
0.0.2
$ git semver latest -p workflows/build
0.0.1

Omitting the --project or -p option

The user should also be able to omit the --project option if she/he's already inside a sub-directory:

$ cd workflows/build
$ git semver latest
0.0.1
$ git commit -am "fix: demo"
$ git semver bump
0.0.2 # creates tag workflows/build/0.0.2

cc @jsmvaldivia

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions