Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jrebmann committed Aug 9, 2023
2 parents da717cf + 23ab74e commit 1d2b9ee
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 11 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.latest.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
## 1.2.4 (2023-08-09)
# 1.3.0 (2023-08-09)


### Bug Fixes

* **project:** Updated dependencies due to security issues ([49a1a65](https://github.com/gitex-flow/gitex-flow-vscode/commits/49a1a65b46bddab09a578ff030e8abc7ac4542af))
* **config:** Allowed to configure the version prefix on gitex flow init ([bd8f837](https://github.com/gitex-flow/gitex-flow-vscode/commits/bd8f8372180acbe1b8f5c41d2ad65d652c7bc1d5)), closes [#11](https://github.com/gitex-flow/gitex-flow-vscode/issues/11)


### Features

* **vscode-ex:** Integrated alpha and beta prerelease functionality ([e85e07e](https://github.com/gitex-flow/gitex-flow-vscode/commits/e85e07e72c60588b53b1c0aa4329a5b819b5fdb8)), closes [#13](https://github.com/gitex-flow/gitex-flow-vscode/issues/13)



14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 1.3.0 (2023-08-09)


### Bug Fixes

* **config:** Allowed to configure the version prefix on gitex flow init ([bd8f837](https://github.com/gitex-flow/gitex-flow-vscode/commits/bd8f8372180acbe1b8f5c41d2ad65d652c7bc1d5)), closes [#11](https://github.com/gitex-flow/gitex-flow-vscode/issues/11)


### Features

* **vscode-ex:** Integrated alpha and beta prerelease functionality ([e85e07e](https://github.com/gitex-flow/gitex-flow-vscode/commits/e85e07e72c60588b53b1c0aa4329a5b819b5fdb8)), closes [#13](https://github.com/gitex-flow/gitex-flow-vscode/issues/13)



## 1.2.4 (2023-08-09)


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.

15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "gitex-flow-vscode",
"displayName": "gitex-flow",
"description": "The official gitex-flow extension for vscode.",
"version": "1.2.4",
"version": "1.3.0",
"main": "./dist/extension",
"publisher": "gitex-flow",
"author": {
Expand Down Expand Up @@ -41,7 +41,7 @@
},
"homepage": "https://github.com/gitex-flow/gitex-flow-vscode",
"engines": {
"vscode": "^1.50.0"
"vscode": "^1.81.0"
},
"keywords": [
"git",
Expand Down Expand Up @@ -161,6 +161,12 @@
"category": "gitex-flow",
"icon": "$(primitive-square)"
},
{
"command": "gitex-flow.prerelease.start",
"title": "Start prerelease",
"category": "gitex-flow",
"icon": "$(play)"
},
{
"command": "gitex-flow.hotfix.start",
"title": "Start hotfix",
Expand Down Expand Up @@ -233,6 +239,11 @@
"when": "viewItem == gitex-release",
"group": "inline@2"
},
{
"command": "gitex-flow.prerelease.start",
"when": "viewItem == gitex-prerelease",
"group": "inline@1"
},
{
"command": "gitex-flow.hotfix.start",
"when": "viewItem == gitex-hotfix",
Expand Down
46 changes: 43 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,45 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
await extension.release.finish();
});

const prereleaseStartDisposable = vscode.commands.registerCommand('gitex-flow.prerelease.start', async function () {
const extension = await createGFlow();

const featureBranches = await extension.feature.list();
const bugfixBranches = await extension.bugfix.list();
const releaseBranches = await extension.release.list();
const hotfixBranches = await extension.hotfix.list();
const config = await extension.config.get();
const alphaBranches = [...featureBranches, ...bugfixBranches, config.developBranch ?? 'develop'];
const betaBranches = [...releaseBranches, ...hotfixBranches];

const availablePrereleases = ['alpha'];
if (betaBranches.length !== 0) {
availablePrereleases.push('beta');
}

let prereleaseType: string | undefined = availablePrereleases[0];
if (availablePrereleases.length > 1) {
prereleaseType = await vscode.window.showQuickPick(availablePrereleases, {
placeHolder: `Prerelease type`,
});
}

if (prereleaseType === 'alpha') {
const branchName = await vscode.window.showQuickPick(alphaBranches, {
placeHolder: `Base branch for alpha release`,
});
if (branchName) {
await extension.alpha.start(branchName);
}
} else if (prereleaseType === 'beta') {
const branchName = await vscode.window.showQuickPick(betaBranches, {
placeHolder: `Base branch for beta release`,
});
if (branchName) {
await extension.beta.start(branchName);
}
}
});
const hotfixStartDisposable = vscode.commands.registerCommand('gitex-flow.hotfix.start', async function () {
const extension = await createGFlow();
await extension.hotfix.start();
Expand All @@ -70,6 +109,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
bugfixFinishDisposable,
releaseStartDisposable,
releaseFinishDisposable,
prereleaseStartDisposable,
hotfixStartDisposable,
hotfixFinishDisposable,
supportStartDisposable,
Expand All @@ -86,10 +126,10 @@ export async function deactivate(): Promise<void> {}

/**
* Creates GFlow instance.
*
* @returns A promise on the GFlow instance.
*
* @returns A promise on the GFlow instance.
*/
async function createGFlow(): Promise<GFlow> {
async function createGFlow(): Promise<GFlow> {
const workspaceFolder = await getWorkspaceFolder();
return GFlowExtension.create(workspaceFolder.uri.fsPath);
}
Expand Down
12 changes: 10 additions & 2 deletions src/gflowext/GFlowExtension.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AvhGitFlow, GFlow, GFlowConfig, GFlowConfigLoader, GitFlow, GitFlowBranch, GitFlowConfig } from 'gitex-flow';
import { AvhGitFlow, GFlow, GFlowConfig, GFlowConfigLoader, GitFlow, GitFlowConfig } from 'gitex-flow';
import * as vscode from 'vscode';
import { GFlowExtBranch } from './branches/GFlowExtBranch';
import { GFlowExtTag } from './tags/GFlowExtTag';

/**
* Main class of the gitex-flow extension for vscode.
Expand Down Expand Up @@ -31,6 +32,8 @@ export class GFlowExtension extends GFlow {
this.release = new GFlowExtBranch(this.release, this.options.projectConfig);
this.hotfix = new GFlowExtBranch(this.hotfix, this.options.projectConfig);
this.support = new GFlowExtBranch(this.support, this.options.projectConfig);
this.alpha = new GFlowExtTag(this.alpha);
this.beta = new GFlowExtTag(this.beta);
}

/**
Expand All @@ -40,7 +43,7 @@ export class GFlowExtension extends GFlow {
* @param force - Force reinitialisation if git flow already initialized.
*/
public async init(): Promise<void> {
let useDefault = await vscode.window.showQuickPick(['yes', 'no'], {
const useDefault = await vscode.window.showQuickPick(['yes', 'no'], {
placeHolder: `Use default git flow config`,
});
let config: GitFlowConfig | undefined = undefined;
Expand Down Expand Up @@ -74,6 +77,11 @@ export class GFlowExtension extends GFlow {
prompt: 'Prefix of support branches',
value: 'support',
});
const versionPrefix = await vscode.window.showInputBox({
prompt: 'Prefix of (pre-)release versions',
placeHolder: 'ex. "v" for "v1.0.0',
});
config.versionTagPrefix = versionPrefix === '' ? undefined : versionPrefix;
}
try {
await super.init(config);
Expand Down
2 changes: 1 addition & 1 deletion src/gflowext/branches/GFlowExtBranch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { GFlowBranch, GitFlowBranch, ProjectConfig } from 'gitex-flow';
import * as vscode from 'vscode';

/**
* This class extending a hotfix branch with some helpful functionality.
* This class extending a gflow branch with some helpful functionality.
*/
export class GFlowExtBranch extends GFlowBranch {
/**
Expand Down
53 changes: 53 additions & 0 deletions src/gflowext/tags/GFlowExtTag.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { GitFlowTag, GitFlowTagType, ProjectConfig } from 'gitex-flow';
import * as vscode from 'vscode';

/**
* This class extending a gflow tag with some helpful functionality.
*/
export class GFlowExtTag implements GitFlowTag {
private gitFlowTag: GitFlowTag;

/**
* {@inheritDoc}
*/
public get type(): GitFlowTagType {
return this.gitFlowTag.type;
}

/**
* Initializes a new instance of this class.
*
* @param gitFlowTag - Git flow tag to be wrapped.
*/
constructor(gitFlowTag: GitFlowTag) {
this.gitFlowTag = gitFlowTag;
}

/**
* {@inheritDoc}
*/
public list(withPrefix?: boolean | undefined): Promise<string[]> {
return this.gitFlowTag.list(withPrefix);
}

/**
* {@inheritDoc}
*/
public async start(branchName?: string): Promise<string> {
let tagName = '';
try {
tagName = await this.gitFlowTag.start(branchName);
vscode.window.showInformationMessage(`Created ${this.type} tag "${tagName}" on branch "${branchName}"`);
} catch (error) {
vscode.window.showErrorMessage(`Failed to create ${this.type} tag on branch "${branchName}". ${error}`);
}
return tagName;
}

/**
* {@inheritDoc}
*/
public generateTagName(): Promise<string | undefined> {
return this.gitFlowTag.generateTagName();
}
}
1 change: 1 addition & 0 deletions src/gitexTreeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export class GitexFlowTreeProvider implements vscode.TreeDataProvider<vscode.Tre
private data: TreeItem[] = [
new TreeItem('Feature', 'gitex-feature', new vscode.ThemeIcon('rocket')),
new TreeItem('Bugfix', 'gitex-bugfix', new vscode.ThemeIcon('bug')),
new TreeItem('Prerelease', 'gitex-prerelease', new vscode.ThemeIcon('megaphone')),
new TreeItem('Release', 'gitex-release', new vscode.ThemeIcon('package')),
new TreeItem('Hotfix', 'gitex-hotfix', new vscode.ThemeIcon('flame')),
new TreeItem('Support', 'gitex-support', new vscode.ThemeIcon('star-empty')),
Expand Down

0 comments on commit 1d2b9ee

Please sign in to comment.