Skip to content

Commit

Permalink
Merge branch 'release/2.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jrebmann committed Aug 8, 2023
2 parents 2dc385a + 7453a63 commit 45f3bca
Show file tree
Hide file tree
Showing 34 changed files with 814 additions and 151 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"client",
"api",
"support",
"changelog"
"changelog",
"prerelease"
]
}
12 changes: 9 additions & 3 deletions CHANGELOG.latest.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
## 2.3.10 (2023-07-29)
# 2.4.0 (2023-08-08)


### Bug Fixes

* **docu:** Refactored links to new api documention in README ([fdcace5](https://github.com/gitex-flow/gitex-flow-node/commits/fdcace522c39f2fef7be607a63a6d4320aab6e11))
* **security:** Updated bugfix versions of dependencies ([7a07d39](https://github.com/gitex-flow/gitex-flow-node/commits/7a07d39c47612b94eb88425b91e31f922c013f6d))
* **release:** Fixed creation of the changelog for the first release 1.0.0 ([f1601f5](https://github.com/gitex-flow/gitex-flow-node/commits/f1601f508011edd3b51a0e41b7adf3370e3181a6)), closes [#79](https://github.com/gitex-flow/gitex-flow-node/issues/79)


### Features

* **gitex-flow :** Added command "gitex-flow changelog unreleased" to show unreleased changes ([6b1215a](https://github.com/gitex-flow/gitex-flow-node/commits/6b1215af3342d76df4608fc1cd091415958addab)), closes [#49](https://github.com/gitex-flow/gitex-flow-node/issues/49)
* **gitex-flow :** Added command "gitex-flow changelog update [version] [name]" to update the changelog manually ([35b0e95](https://github.com/gitex-flow/gitex-flow-node/commits/35b0e95596c0cda52724d7f19e9270bc30ef09cd)), closes [#61](https://github.com/gitex-flow/gitex-flow-node/issues/61)
* **prerelease:** Added prerelease command for alpha and beta versions ([1dc6180](https://github.com/gitex-flow/gitex-flow-node/commits/1dc618036406cd2a9969afb7b02a720e51da366f)), closes [#63](https://github.com/gitex-flow/gitex-flow-node/issues/63)



16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# 2.4.0 (2023-08-08)


### Bug Fixes

* **release:** Fixed creation of the changelog for the first release 1.0.0 ([f1601f5](https://github.com/gitex-flow/gitex-flow-node/commits/f1601f508011edd3b51a0e41b7adf3370e3181a6)), closes [#79](https://github.com/gitex-flow/gitex-flow-node/issues/79)


### Features

* **gitex-flow :** Added command "gitex-flow changelog unreleased" to show unreleased changes ([6b1215a](https://github.com/gitex-flow/gitex-flow-node/commits/6b1215af3342d76df4608fc1cd091415958addab)), closes [#49](https://github.com/gitex-flow/gitex-flow-node/issues/49)
* **gitex-flow :** Added command "gitex-flow changelog update [version] [name]" to update the changelog manually ([35b0e95](https://github.com/gitex-flow/gitex-flow-node/commits/35b0e95596c0cda52724d7f19e9270bc30ef09cd)), closes [#61](https://github.com/gitex-flow/gitex-flow-node/issues/61)
* **prerelease:** Added prerelease command for alpha and beta versions ([1dc6180](https://github.com/gitex-flow/gitex-flow-node/commits/1dc618036406cd2a9969afb7b02a720e51da366f)), closes [#63](https://github.com/gitex-flow/gitex-flow-node/issues/63)



## 2.3.10 (2023-07-29)


Expand Down
90 changes: 76 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ It also represents a tool chain for a continuous release strategy that automates
- [Configuation](#configuation)
- [Conventional commits guideline](#conventional-commits-guideline)
- [Changelog generator](#changelog-generator)
- [Git flow branches](#git-flow-branches)
- [Changelog commands](#changelog-commands)
- [Git flow branches and tags](#git-flow-branches-and-tags)
- [Feature](#feature)
- [Bugfix](#bugfix)
- [Release](#release)
- [Hotfix](#hotfix)
- [Support](#support)
- [Prerelease](#prerelease)
- [Developer documentation (API)](#developer-documentation-api)
- [Troubleshooting](#troubleshooting)

Expand Down Expand Up @@ -57,7 +59,7 @@ In addition, using git flow covers some common requirements and allows other pro
**gitex-flow** is fully compatible with **git flow**.
This means that gitex-flow uses the same commands as git flow, but with additional functionality:

1. Automatic calculation of versions for release and hotfix branches using [semantic versioning (SemVer)](https://semver.org/) and BREAKING CHANGE flag of [conventional commits](#conventional-commits-guideline).
1. Automatic calculation of versions for (pre-)release and hotfix branches using [semantic versioning (SemVer)](https://semver.org/) and BREAKING CHANGE flag of [conventional commits](#conventional-commits-guideline).
2. Automatic dumping of npm project versions (`package.json`, `package-lock.json`).
3. Automatic creation of a changelog for each version by [conventional commits](#conventional-commits-guideline).

Expand All @@ -72,6 +74,11 @@ You can install them either as global or project reference.
- [git-flow (AVH edition)](https://github.com/petervanderdoes/gitflow-avh) is installed
- [node.js](https://nodejs.org/en/) is installed

> **NOTICE:**
>
> The project [git-flow (AVH edition)](https://github.com/petervanderdoes/gitflow-avh) has been archived on Jun 19, 2023 and is no longer supported.
> However, there is a follow-on project [git-flow (CJS edition)](https://github.com/CJ-Systems/gitflow-cjs) which is actively being developed and is 100% backward compatible.
## Installation

### As a global reference
Expand Down Expand Up @@ -104,6 +111,8 @@ To integrate the gitex workflow into your project, add the following lines to th
"bugfix:finish": "gitex-flow bugfix finish",
"support:start": "gitex-flow support start",
"support:finish": "gitex-flow support finish"
"prerelease:alpha": "gitex-flow prerelease alpha start",
"prerelease:beta": "gitex-flow prerelease beta start"
...
}
```
Expand Down Expand Up @@ -134,11 +143,11 @@ 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",
"featureBranchPrefix": "feature/",
"bugfixBranchPrefix": "bugfix/",
"releaseBranchPrefix": "release/",
"hotfixBranchPrefix": "hotfix/",
"supportBranchPrefix": "support/",
"versionTagPrefix": null
},
"projectConfig": {
Expand Down Expand Up @@ -251,10 +260,39 @@ Depending on the implementation there may be additional properties.
| `ConventionalChangelog` | Implementation of the [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) generator. | [ConventionalChangelogWriterOptions](https://gitex-flow.github.io/gitex-flow-node/interfaces/changelog_ConventionalChangelogWriter.ConventionalChangelogWriterOptions.html) | `default` |
| `KeepAChangelog` | Implementation of the [keep-a-changelog](https://keepachangelog.com/en/1.0.0/) generator. | [KeepAChangelogWriterOptions](https://gitex-flow.github.io/gitex-flow-node/interfaces/changelog_KeepAChangelogWriter.KeepAChangelogWriterOptions.html) | |

## Git flow branches
### Changelog commands

To interact with the changelog generator, gitex-flow provides some commands.

**Print the changelog**

The following command prints the complete changelog as Markdown to the console.

```shell
#> gitex-flow changelog
```

**Print unreleased changes**

The following command prints the unreleased changes to the console.

```shell
#> gitex-flow changelog unreleased
```

**Manually updating the changelog**

The following command updates the changelog with a given version and name.

```shell
#> gitex-flow changelog update [version] [name]
```

## Git flow branches and tags

Git flow offers five branches for different use cases.
For some branch types several branches can be active at the same time (_features_, _bugfixes_, _support-branches_). For others (_release_, _hotfix_) only one.
Furthermore, gitex-flow extends the classic git-flow branches with prerelease tags.

### Feature

Expand Down Expand Up @@ -387,7 +425,7 @@ Support branches are based on a released version to provide long term support of

**Start support**

As default the base of a new support branch is the `master` branch.
By default, the base of a new support branch is the `master` branch.

```shell
#> gitex-flow support start <name> [base]
Expand All @@ -404,6 +442,30 @@ The name does not need to be specified if the release branch has already been ch
#> gitex-flow support finish [name]
```

### Prerelease

There are two types of pre-releases: `alpha` and `beta` releases.

1. An `alpha` release is an early version of a software during the initial development phase, often unstable and tested internally by developers. Gitex-flow enables the creation of alpha releases from the `develop` or a `feature` branch.

2. A `beta` release is the phase following alpha, where the software has fewer bugs and is more stable. It's tested by a limited number of external users, known as beta testers, to gather feedback before the final release. Gitex-flow enables the creation of beta releases from the `release` or the `hotfix` branch.

**List pre-released versions**

```shell
#> gitex-flow prerelease <alpha|beta>
```

**Create a pre-release**

By default, the base of a new prerelease is the current branch.
However, a branch can also be specified explicitly, e.g. `develop` or `hotfix/1.0.2`.
If a prerelease is executed on a inappropriate branch, an error occurs.

```shell
#> gitex-flow prerelease <alpha|beta> start [base]
```

# Developer documentation (API)

If you like to use **gitex-flow** in your code, you can use the typescript API.
Expand All @@ -418,11 +480,11 @@ const gFlowConfig: GFlowConfig = {
gitFlowConfig: {
masterBranch: 'master',
developBranch: 'develop',
featureBranchPrefix: 'feature',
bugfixBranchPrefix: 'bugfix',
releaseBranchPrefix: 'release',
hotfixBranchPrefix: 'hotfix',
supportBranchPrefix: 'support',
featureBranchPrefix: 'feature/',
bugfixBranchPrefix: 'bugfix/',
releaseBranchPrefix: 'release/',
hotfixBranchPrefix: 'hotfix/',
supportBranchPrefix: 'support/',
versionTagPrefix: undefined,
},
projectConfig: {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gitex-flow",
"version": "2.3.10",
"version": "2.4.0",
"description": "A git flow extension that provides some additional automation and feature improvements. The aim of the project is to offer a complete process chain in order to organize the releases of your projects as easily as possible. ",
"main": "build/src/index.js",
"typings": "build/src/index.d.ts",
Expand Down
16 changes: 16 additions & 0 deletions src/api/GitFlowEntity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This interface represents a basic git flow entity.
*/
export interface GitFlowEntity<T> {
/**
* Specifies the git flow entity type.
*/
readonly type: T;

/**
* Lists all git flow entity of the type '[[type]]'.
*
* @param withPrefix - Indicates if the entities should be listed with their prefix.
*/
list(withPrefix?: boolean): Promise<string[]>;
}
13 changes: 2 additions & 11 deletions src/api/branches/GitFlowBranch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { GitFlowBranchConfig } from '../GitFlowBranchConfig';
import { GitFlowEntity } from '../GitFlowEntity';

/**
* Types of the git flow base branches.
Expand All @@ -13,12 +14,7 @@ export type GitFlowBranchType = 'feature' | 'release' | 'bugfix' | 'hotfix' | 's
/**
* This interface represents the basic functionality of a git flow branch.
*/
export interface GitFlowBranch {
/**
* Specifies the git flow branch type.
*/
readonly type: GitFlowBranchType;

export interface GitFlowBranch extends GitFlowEntity<GitFlowBranchType> {
/**
* Default base of this branch.
*/
Expand All @@ -29,11 +25,6 @@ export interface GitFlowBranch {
*/
getConfig(): Promise<GitFlowBranchConfig>;

/**
* Lists all branches of the type '[[type]]'.
*/
list(): Promise<string[]>;

/**
* Creates and starts a new branch of the type '[[type]]'.
*
Expand Down
2 changes: 2 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export * from './ConfigProvider';
export * from './GitFlow';
export * from './GitFlowEntity';
export * from './GitFlowBranchConfig';
export * from './branches';
export * from './tags';
24 changes: 24 additions & 0 deletions src/api/tags/GitFlowTag.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { GitFlowEntity } from '../GitFlowEntity';

/**
* Types of the git flow tags.
*/
export type GitFlowTagType = 'alpha' | 'beta';

/**
* This interface represents the basic functionality of a git flow tag.
*/
export interface GitFlowTag extends GitFlowEntity<GitFlowTagType> {
/**
* Publishs a new tag of the type '[[type]]'.
*
* @param baseBranch - The base branch to create an prerelease from.
* @returns The git reference of the create tag.
*/
start(baseBranch?: string): Promise<string>;

/**
* Generates a default tag name.
*/
generateTagName(): Promise<string | undefined>;
}
1 change: 1 addition & 0 deletions src/api/tags/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './GitFlowTag';
12 changes: 10 additions & 2 deletions src/avh/branches/AvhGitFlowBranch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,23 @@ export abstract class AvhGitFlowBranch implements GitFlowBranch {
/**
* {@inheritdoc}
*
* @param withPrefix - Indicates if the entities should be listed with their prefix.
* @returns The list of the currently opened branch.
*/
public async list(): Promise<string[]> {
public async list(withPrefix?: boolean): Promise<string[]> {
const output = await GitFlowBashExecuter.execute({
type: this.type,
action: 'list',
repositoryPath: this.repositoryPath,
});
return AvhBranchListParser.parse(output);

const branches = await AvhBranchListParser.parse(output);
if (withPrefix) {
for (let i = 0; i < branches.length; i++) {
branches[i] = await this.getBranchNameFromConfig(branches[i]);
}
}
return branches;
}

/**
Expand Down
12 changes: 12 additions & 0 deletions src/changelog/ChangelogWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ export abstract class ChangelogWriter {
this.logger.info(changelogUpdatedMessage);
}

/**
* Gets the unreleased changes as changelog.
*
* @param context - The context information of the git repository.
* @param logs - The conventional git logs since the last release.
* @returns A changelog with unreleased changes.
*/
public async getUnreleasedChangelog(context: GitRepositoryContext, logs: GitLog[]): Promise<string> {
const stream = await this.createLatestChangelogStream(context, logs);
return Utils.convertStreamToString(stream);
}

/**
* Derives the name of the seperated latest changelog from the main changelog name.
*
Expand Down
Loading

0 comments on commit 45f3bca

Please sign in to comment.