gitex-flow
gitex-flow is a node.js framework extending git flow that provides an all-in-one approach to a release and deployment strategy and process.
The framework offers automated tools that allows you to embed the release strategy in your development process.
Table of content
Introduction
In my experience as a software developer, one of the most important parts of a software project is a precisely defined and largely automated release and deployment process.
Continous deployments are mostly an essential part of the project requirements, especially for agile projects.
A deployment can be very error prune and time intense.
For this reason, it is worth investing in making the deployment process as simple as possible.
Another common and important requirement is to notify the user of changes from one version to another.
Transparency is important in increasing the acceptance of the software and allows to participate the user into the software project.
When a project gets bigger and more complicated or several developers work on it, a defined release process becomes more and more important.
For this reason, it's advisable to think about the release process as early as possible in the project.
Features
- Deployed versions can be recovered (Tag).
- Deployed versions can be fixed (Hotfix).
- Features can be developed without affecting the development process.
- Deployed versions can be used for long term support.
- Deployed versions do not influence each other.
- Current development should not influence deployed versions.
- Changes between versions should be captured in a changelog.
- All versions should have a standardized version numbers.
- Integration of the release process in the IDE (coming soon).
Differentiation from other projects
For any listed criteria exist some suitable solutions and principles:
git-flow: A git deployment strategy.
semantic versioning (SemVer): A semantic version strategy.
conventional commits: A git commit message standard.
standard-version: A tool providing automated versioning and changelog generation designed for github flow.
ngitflow: A simple node.js git-flow (AVH edition) wrapper written in javascript with version bumping.
release-flow: Simliar idea to gitex-flow but only for git flow releases.
The program comes with its own git flow implementation and does not extend an existing implementation like git-flow (AVH edition).
Additionally there are some very helpful articles about ideas of git flow extensions and concepts:
No. | Feature | git-flow | ngitflow | release-flow | SemVer | Conventional commits | standard-version |
---|
1 | Deployed versions can be recovered (Tag) | ✔ | ✔ | ✔ | | | ✔ |
2 | Features can be developed without affecting the development process | ✔ | ✔ | ✔ | | | |
3 | Deployed versions can be fixed (Hotfix) | ✔ | | | | | |
4 | Deployed versions can be used for long term support | ✔ | | | | | |
5 | Deployed versions do not influence each other | ✔ | ✔ | ✔ | | | |
6 | Current development should not influence deployed versions | ✔ | ✔ | ✔ | | | |
7 | Changes between versions should be captured as a changelog | | | ✔ | | | ✔ |
8 | All versions should have a standardized version numbers | | ✔ | ✔ | ✔ | | ✔ |
9 | Integration of the release process in the IDE | ✔ | | | | ✔ | |
The aim of this project is to offer a well-coordinated overall concept that integrates all of the listed principles and tools into the git flow workflow.
User documentation
If you like to use gitex-flow in your node.js project you can use gitex-flow as a npm script.
Prerequisite
Installation
#> npm install --save-dev gitex-flow
After installation add the following lines to the scripts
section in your package.json
of your project:
"scripts": {
...
"init": "gitex-flow init",
"feature:start": "gitex-flow feature start",
"feature:finish": "gitex-flow feature finish",
"release:start": "gitex-flow release start",
"release:finish": "gitex-flow release finish",
"hotfix:start": "gitex-flow hotfix start",
"hotfix:finish": "gitex-flow hotfix finish",
"bugfix:start": "gitex-flow bugfix start",
"bugfix:finish": "gitex-flow bugfix finish",
"support:start": "gitex-flow support start",
"support:finish": "gitex-flow support finish"
...
}
The very first time after installation you have to initialize git-flow by following command:
#> npm run init
Configuation
To configure gitex-flow you can create a configuration file .gitex
.
The following JSON shows the schema and the default values of the configuration:
{
"gitFlowConfig": {
"masterBranch": "master",
"developBranch": "develop",
"featureBranchPrefix": "feature",
"bugfixBranchPrefix": "bugfix",
"releaseBranchPrefix": "release",
"hotfixBranchPrefix": "hotfix",
"supportBranchPrefix": "support",
"versionTagPrefix": null
},
"projectConfig": {
"projectPath": "./",
"changelogFileName": "CHANGELOG.md",
"storeLatestChangelog": false,
"conventionalChangelogPresent": "angular",
"versionFile": "package.json",
"bumpVersionFiles": [
"package.json",
"package-lock.json"
]
}
}
Further information on the available configurations can be found in the API documentation.
Usage / Workflow
gitex-flow has mostly the same commands and API as git flow.
There are only some simplifying changens and functional extensions which are fully backward compatible.
Commit message convention
Behind the scenes gitex-flow uses parts of the conventional-changelog library to generate its changelogs.
You can select the desired present by setting the option conventionalChangelogPresent
of the project settings.
The default present is angular
.
Example for a matching conventional angular commit message:
feat(gflow): Implemented automatic naming when creating branches
The name of the release and hotfix branch is set automatically when it is created.
closes #5
or
feat(config): Made gitex-flow configurable
Added configuration data structure and introduced optional config file '.gitex'.
BREAKING CHANGE: Adapted API by adding an options to the affected modules (classes).
closes #10
Feature
Features are branches that are based on the develop branch, which add new functionality to the program.
Feature branches can exist across many releases and can be updated regularly with the latest changes the develop branch.
#> npm run feature:start -- <name>
...
#> npm run feature:finish -- <name>
BugFix
Bugfix branches are similar to feature branches, but are used for fixing bugs.
This is useful for bugs which are not fixable as a hotfix (breaking change, low prio bug).
#> npm run bugfix:start -- <name>
...
#> npm run bugfix:finish -- <name>
Release
Releases are branches that are based on the develop branch, which freezes the current code and mark a feature stop.
The code from the release branch can be published to the consolidation (test) system.
Only bugfixes are allowed to be commited on the release branch.
If the release is stable, the release branch can be finished and merged into the master branch.
#> npm run release:start -- [name]
...
#> npm run release:finish -- [name]
Extension features
- If no name is set, the branch name is generated automatically with the next minor semantic version string based on the latest released version.
- If the release is started, the version from
package.json
is updated - If the release is started, the
CHANGELOG.md
is updated with the changes since the last release
HotFix
Hotfixes are bug fixes based on a released version.
#> npm run hotfix:start -- [name]
...
#> npm run hotfix:finish -- [name]
Extension features
- If no name is set, the branch name is generated automatically with the next minor semantic version string based on the latest released version.
- If the hotfix is started, the version from
package.json
is updated - Before the hotfix is finished, the
CHANGELOG.md
is updated with the bugfixs are mode on the hotfix branch
Support
Support branches are based on a released version to provide long term support of a program version.
#> npm run support:start -- <name> <base>
...
#> npm run support:finish -- <name> <base>
Developer documentation (API)
If you like to use gitex-flow in your code, you can use the typescript gitex-flow API.
gitex-flow is implemented as a wrapper of an arbitary git flow implementation.
import { AvhGitFlow, GFlow, GFlowConfig } from 'gitex-flow';
const gFlowConfig: GFlowConfig = {
gitFlowConfig: {
masterBranch: 'master',
developBranch: 'develop',
featureBranchPrefix: 'feature',
bugfixBranchPrefix: 'bugfix',
releaseBranchPrefix: 'release',
hotfixBranchPrefix: 'hotfix',
supportBranchPrefix: 'support',
versionTagPrefix: undefined,
},
projectConfig: {
projectPath: './',
changelogFileName: 'CHANGELOG.md',
storeLatestChangelog: false,
conventionalChangelogPresent: 'angular',
versionFile: 'package.json',
bumpVersionFiles: ['package.json', 'package-lock.json'],
},
};
const gitFlow = new AvhGitFlow();
const gFlow = new GFlow(gitFlow, gFlowConfig);
The full API documentation can be found here.