Skip to content

Commit

Permalink
Merge branch 'release/1.2.8' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhioromano committed Mar 7, 2022
2 parents 18435e2 + e05b9a4 commit 1dee7be
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 26 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to the "gitflow" extension will be documented in this file.

## [1.2.8] 03/07/22

- fix - stop command on ESC.
- fix - run version bump only when released or hotfix is started
- enhance - `CHANGELOG.md` update conditions

## [1.2.7] 03/04/22

- fix - changelog update `mm` not to be replaced in a word like co**mm**and.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-gitflow",
"displayName": "Git Flow",
"description": "Git-Flow support for VS Code",
"version": "1.2.7",
"version": "1.2.8",
"engines": {
"vscode": "^1.64.0"
},
Expand Down
60 changes: 35 additions & 25 deletions src/ViewBranches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ export class TreeViewBranches implements vscode.TreeDataProvider<Flow> {
title: "Select options",
canPickMany: true,
});
if (options?.includes("[-r] Delete remote branch")) {
if (options === undefined) {
return;
}
if (options.includes("[-r] Delete remote branch")) {
progress = true;
}
option = options
Expand All @@ -357,8 +360,11 @@ export class TreeViewBranches implements vscode.TreeDataProvider<Flow> {
canPickMany: true,
}
);
if (options === undefined) {
return;
}
option = options
?.map((el) => {
.map((el) => {
let m = el.match(/\[([^\]]*)\]/);
return m === null ? "" : m[1];
})
Expand Down Expand Up @@ -396,13 +402,14 @@ export class TreeViewBranches implements vscode.TreeDataProvider<Flow> {
) {
progress = true;
}
if (options === undefined) {
return;
}
option =
options
?.map((el) => {
let m = el.match(/\[([^\]]*)\]/);
return m === null ? "" : m[1];
})
.join(" ") || "";
options.map((el) => {
let m = el.match(/\[([^\]]*)\]/);
return m === null ? "" : m[1];
}).join(" ") || "";

let msg;

Expand All @@ -411,6 +418,9 @@ export class TreeViewBranches implements vscode.TreeDataProvider<Flow> {
title: 'Message',
value: `Finish ${ucf(feature)}: ${name}`,
});
if (msg === undefined) {
return;
}
msg = `${msg}`.replace("\"", "'").trim();
if (msg === "") {
msg = `Finish ${ucf(feature)}: ${name}`;
Expand All @@ -421,7 +431,7 @@ export class TreeViewBranches implements vscode.TreeDataProvider<Flow> {
let updated = false;
let chc = `${readFileSync(this.util.workspaceRoot + "/CHANGELOG.md")}`;
chc = chc.split("\n").map(el => {
if (el.includes("[Unreleased]") || chc.includes("[unreleased]") || chc.includes("[UNRELEASED]")) {
if (el.toLowerCase().includes("[unreleased]")) {
let date = new Date();
updated = true;
el = el
Expand Down Expand Up @@ -455,24 +465,24 @@ export class TreeViewBranches implements vscode.TreeDataProvider<Flow> {
if (["hotfix", "release"].includes(feature)) {
vscode.commands.executeCommand("gitflow.refreshT");
}
if (["hotfix", "release"].includes(feature) && exist && what === 'start') {
version =
JSON.parse(readFileSync(this.util.workspaceRoot + "/package.json", "utf8")).version ||
"";
if (version !== "" && name !== version && `${name}`.match(/^[0-9\.]*$/) !== null) {
writeFileSync(
this.util.workspaceRoot + "/package.json",
readFileSync(this.util.workspaceRoot + "/package.json", "utf8").replace(
version,
`${name}`
)
);
this.util.execSync("git add ./package.json");
this.util.execSync('git commit ./package.json -m"Version bump"');
}
}
});

if (["hotfix", "release"].includes(feature) && exist && what === 'start') {
version =
JSON.parse(readFileSync(this.util.workspaceRoot + "/package.json", "utf8")).version ||
"";
if (version !== "" && name !== version && `${name}`.match(/^[0-9\.]*$/) !== null) {
writeFileSync(
this.util.workspaceRoot + "/package.json",
readFileSync(this.util.workspaceRoot + "/package.json", "utf8").replace(
version,
`${name}`
)
);
this.util.execSync("git add ./package.json");
this.util.execSync('git commit ./package.json -m"Version bump"');
}
}

function ucf(string: string) {
return string.charAt(0).toUpperCase() + string.slice(1);
Expand Down

0 comments on commit 1dee7be

Please sign in to comment.