release-flow
is a command line tool that simplifies the developer side of software release process taking over tedious and error prone tasks.
release-flow
mixes git flow releases with conventional commits to make release process safe and painless.
Globally (use from console)
npm i -g release-flow
As project dependency (use through npm script or programmatically)
npm i --save-dev release-flow
In your package.json
"scripts": {
"release": "release-flow"
}
release-flow start
Effect:
feat commit === minor
)release-flow publish
release-flow finish
Effect:
release-flow full
Effect:
Same then issuing release-flow start
, release-flow publish
and release-flow finish
in sequence.
NOTE: This approach is especially suitable for libraries and small projects that does not require a QA phase on the release branch.
release-flow
supports both the canonical git-flow
branching model with develop/master and a
simplified branching with just master.
// releaseflowrc
module.exports = {
developmentBranch: "develop",
productionBranch: "master",
};
// releaseflowrc
module.exports = {
developmentBranch: "master",
productionBranch: "master",
};
Release flow uses conventional commits to simplify the release process (computing next version, generating changelogs).
Conventional commits are commits with a specific message format:
type([scope]): message [BREAKING]
ie.
BREAKING
→ major
minor
patch
release-flow
loads a releaseflowrc
javascript file to allow configuration.
The following is an extract of the default configuration file:
export default {
developmentBranch: "develop",
productionBranch: "master",
releaseBranchPrefix: "release/",
tagPrefix: "v",
remoteName: "origin",
logLevel: "info",
initialVersion: "1.0.0",
repoHttpUrl: null,
ErrorFactory: DefaultErrorFactory,
Logger: DefaultLogger,
repoHttpProtocol: "https",
getBump: getBump,
plugins: [],
};
Bumps package json version on start.
// releaseflowrc
module.exports = {
plugins: ["bump-package-json"],
};
Generates a changelog for the release and prepend it CHANGELOG.md
or the choosen path on start.
// releaseflowrc
module.exports = {
changelogPath: 'CHANGELOG.md'
changelogTemplate: release => 'changelog contents'
plugins: [
'generate-changelog'
]
};
A plugin is just a function of the form install(release) => null
. To register it is enough to pass it in releaseflowrc
// releaseflowrc
module.exports = {
plugins: [
(release) => {
// ... do something
},
],
};
Tiplcally a plugin adds some step
to a release phase (one of start, publish or finish).
A step is an object with a name
and a run()
function.
To attach a step to a phase is possible to use array methods like push
or splice
on the release.phases.[start/publish/finish].steps
array or use the release.phases.[start/publish/finish].before
method to insert the step before another specific step:
// releaseflowrc
module.exports = {
plugins: [
(release) => {
let logVersion = {
name: "logVersion",
run(release) {
console.log(release.version);
},
};
release.phases.start.before("commit", logVersion);
},
],
};