gitmono

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 6 Imported by: 0

README

gitmono

Git wrapper for monorepos

The following commands take one or more project paths as input (using the -p argument). The projects are any of the monorepo subdirectories and are considered separate projects residing in the monorepo. This tool provides commands to manage versioning of projects in monorepos.

Commands

diff command prints out the projects whose scope matches to at least one file included in the diff of the specified reference range.

version command extracts the latest version of the specified project.

release command releases a new version of the specified project, after looking up for a version bump command in the commits that reference files of that project.

init command releases a new version (0.1.0) for the specified projects that have never been released.

log command prints out the commits of the specified project.

Examples

  1. Initialise the version of all monorepo projects:
gitmono init -version-prefix=v -p mod1 -p mod2

mod2/0.1.0
mod1/0.1.0
  1. Get the latest version of a monorepo project:
gitmono version -p mod1

mod1/0.1.0
  1. Get the subset of modified monorepo projects:
gitmono diff -f head~1 -t head -p mod2 -p mod1

mod1
  1. Release new version for a modified monorepo project:
gitmono release -p mod1 --commit-scheme=conventional --version-prefix=v

mod1/v0.2.0
  1. Get log of commits relevant to a monorepo project:
gitmono log -p mod1 -f head~2 -t head

7fd4cd0d6141b3cbc3c4f0a2206090140d2d7722 fix: mod1 modified

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitParser

type CommitParser struct {
	// contains filtered or unexported fields
}

type Config

type Config struct {
	Projects      []string
	DryRun        bool
	CommitScheme  string
	VersionPrefix string
}

Config defines generic configuration applying to multiple commands

type Differ

type Differ struct {
	// contains filtered or unexported fields
}

func NewDiffer

func NewDiffer(mono *GitMono) *Differ

func (*Differ) Diff

func (d *Differ) Diff(from, to string) ([]string, error)

type GitMono

type GitMono struct {
	// contains filtered or unexported fields
}

GitMono contains repository instance and command parameters

func OpenRepo added in v0.2.0

func OpenRepo(path string) (*GitMono, error)

OpenRepo open a git repository and returns the monorepo wrapper

func (*GitMono) SetConfig added in v0.2.0

func (m *GitMono) SetConfig(config *Config)

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(mono *GitMono) *Logger

func (*Logger) CommitHashByRevision

func (l *Logger) CommitHashByRevision(rev string) (string, error)

func (*Logger) Log

func (l *Logger) Log(from, to string) ([]*git.Commit, error)

type Tagger

type Tagger struct {
	// contains filtered or unexported fields
}

func (*Tagger) Tags

func (t *Tagger) Tags() ([]string, error)

func (*Tagger) WriteTag

func (t *Tagger) WriteTag(tagCommit *VersionedCommit) error

type VersionedCommit

type VersionedCommit struct {
	CommitID      string
	Version       *version.Version
	VersionPrefix string
	Project       string
}

func (*VersionedCommit) GetTag

func (vc *VersionedCommit) GetTag() string

type Versioner

type Versioner struct {
	// contains filtered or unexported fields
}

func NewVersioner

func NewVersioner(mono *GitMono) *Versioner

func (*Versioner) CurrentVersion

func (v *Versioner) CurrentVersion() (*VersionedCommit, error)

func (*Versioner) InitVersion

func (v *Versioner) InitVersion() ([]*VersionedCommit, error)

func (*Versioner) NewVersion

func (v *Versioner) NewVersion() (*VersionedCommit, error)

Directories

Path Synopsis
cmd
gitmono command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL