7 Commits

6 changed files with 55 additions and 28 deletions

View File

@@ -3,20 +3,20 @@ const { execSync } = require("child_process");
const packageFile = fs.readFileSync("./package.json").toString();
const newPackageFile = packageFile.replace(
/"version": "[0-9]+.[0-9]+.[0-9]+"/,
`"version": "${__NEW_VERSION__}"`
/"version": "[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc|dev)\.[0-9]+)?"/,
`"version": "${__NEW_VERSION__}"`,
);
fs.writeFileSync("./package.json", newPackageFile);
const indexFile = fs.readFileSync("./src/index.ts").toString();
const newIndexFile = indexFile.replace(
/version\("[0-9]+\.[0-9]+\.[0-9]+"\)/,
`version("${__NEW_VERSION__}")`
/version\("[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc|dev)\.[0-9]+)?"\)/,
`version("${__NEW_VERSION__}")`,
);
fs.writeFileSync("./src/index.ts", newIndexFile);
execSync(
`rcz changelog --show-hashes --unreleased-as v${__NEW_VERSION__} > CHANGELOG.md`
`rcz changelog --show-hashes --unreleased-as v${__NEW_VERSION__} > CHANGELOG.md`,
);

View File

@@ -1,7 +1,20 @@
# Changelog
Generation of this changelog is based on commits
## v1.13.1
### Fixes
- [87edf8cfa] - **changelog**: wrong semver sequence generation (#21)
### Miscellaneous
- [47a8b0585] - **commands**: change head error message
- [b6d749bea] - fix version regex to include pre-releases
## v1.13.0
### Fixes
- [7b499d763] - **commands**: commit crash upon missing HEAD (#19)
### Miscellaneous
- [87a7c4dcc] - **release**: v1.13.0
- [6ce6e88d8] - Merge pull request 'Refactor into multiple command files' (#20) from refactor/#18 into main
## v1.13.0-rc.0
### Miscellaneous
- [4b0ce0fd3] - **release**: v1.13.0-rc.0
- [778175a2f] - split commands into files (#18)
## v1.12.4
### Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@resultium/rcz",
"version": "1.13.0-rc.0",
"version": "1.13.1",
"license": "GPL-3.0-or-later",
"description": "Resultium commit standardization library, inspired by conventional commits",
"main": "./dist/index.js",

View File

@@ -20,7 +20,7 @@ along with RCZ. If not, see <https://www.gnu.org/licenses/>.
import { Command } from "commander";
import simpleGit from "simple-git";
import { CommitStack } from "../types";
import { sort } from "semver";
import { gt, sort } from "semver";
const command = new Command("changelog")
.alias("ch")
@@ -113,7 +113,17 @@ const command = new Command("changelog")
lastTag = tag;
}
parsedCommitStacks = parsedCommitStacks.reverse();
// Might be confusing so I will leave mdn docs here
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
parsedCommitStacks = parsedCommitStacks.sort((a, b) => {
if (a.version === unreleased) {
return -1;
} else if (b.version === unreleased) {
return 1;
} else {
return gt(a.version, b.version) ? -1 : 1;
}
});
if (lastOnly) {
parsedCommitStacks = [parsedCommitStacks[0]];

View File

@@ -69,6 +69,7 @@ const command = new Command("commit")
process.exit(0);
}
try {
const changedLines = (
(
await simpleGit().diff(["--numstat", stageAll ? "HEAD" : "--cached"])
@@ -92,6 +93,9 @@ const command = new Command("commit")
process.exit(0);
}
}
} catch {
note("HEAD hasn't been found, skipping commit line sum check");
}
const type: string | symbol = await select({
message: "Choose a commit type",

View File

@@ -29,7 +29,7 @@ import { join } from "path";
program
.name("rcz")
.description("Resultium commit standardization command-line interface")
.version("1.13.0-rc.0");
.version("1.13.1");
const commandFiles = await readdir(join(__dirname, "commands"));