Skip to content

⛵ Automate independent versioning and publishing in a monorepo

License

Notifications You must be signed in to change notification settings

shinobi5/monorepo-release

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⛵ Monorepo Release

Automate independent versioning and publishing of packages in a monorepo.

License MIT


Commit message format

Commit messages in the following format are required

<type>(<scope>): <subject>

<scope> should be the name of the package intended to be released. The commit message format follows the angular commit message guidelines.

Note: for <scope> don't include the @scope/ prefix of the package (only the package name).

Commit message examples

feat(package-a): add stuff to package-a
fix(package-b): fix something in package-b

BREAKING CHANGE:
Description of the breaking changes caused by the fix to package-b

Commit message CLI

A commit message CLI builder like cz-customisable can be included in your project to ensure commit messages are always formatted correctly.

This project uses cz-customisable (see project configuration file).

Setup

Requires initial package git tags to exist before the release() function can be used to automate versioning and publishing

Generate tags manually or run a function available in this package to generate initial tags across current packages

Create initial tags: scripts/createTags.js

const { createTag, getPackages } = require('monorepo-release');
const packages = getPackages();

packages.forEach(createTag());

Run script

node scripts/createTags.js

Release: scripts/release.js

const { getPackages, release } = require('monorepo-release');
const packages = getPackages();

const config = {
  dryRun: true,
};

packages.forEach(release(config));

Config options and defaults

Run script locally or in CI

node scripts/release.js

Changelogs

Package changelogs can be generated with something like auto-changelog by setting the changelog command (changelogCmd) that is run (for each package)

Install auto-changelog in project

yarn add --dev auto-changelog

packages/package-a/package.json

"scripts": {
  "changelog": "auto-changelog"
},
"auto-changelog": {
  "output": "CHANGELOG.md",
  "tagPattern": "@scope/package-a@"
}

scripts/release.js

const { getPackages, release } = require('monorepo-release');
const packages = getPackages();

const config = {
  changelog: true,
  changelogCmd: 'yarn changelog',
};

packages.forEach(release(config));

Run script locally or in CI

node scripts/release.js

About

⛵ Automate independent versioning and publishing in a monorepo

Resources

License

Stars

Watchers

Forks

Packages

No packages published