4 Commits

Author SHA1 Message Date
6df1021561 chore(release): v1.13.1 2024-05-04 21:56:07 +03:00
87edf8cfad fix(changelog): wrong semver sequence generation (#21)
now made ascending with "Unreleased" on top
2024-05-04 21:55:04 +03:00
47a8b05856 refactor(commands): change head error message
to sound more natively
2024-03-12 18:41:36 +02:00
b6d749beae build: fix version regex to include pre-releases 2024-03-08 23:42:42 +02:00
6 changed files with 27 additions and 10 deletions

View File

@@ -3,20 +3,20 @@ const { execSync } = require("child_process");
const packageFile = fs.readFileSync("./package.json").toString(); const packageFile = fs.readFileSync("./package.json").toString();
const newPackageFile = packageFile.replace( const newPackageFile = packageFile.replace(
/"version": "[0-9]+.[0-9]+.[0-9]+"/, /"version": "[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc|dev)\.[0-9]+)?"/,
`"version": "${__NEW_VERSION__}"` `"version": "${__NEW_VERSION__}"`,
); );
fs.writeFileSync("./package.json", newPackageFile); fs.writeFileSync("./package.json", newPackageFile);
const indexFile = fs.readFileSync("./src/index.ts").toString(); const indexFile = fs.readFileSync("./src/index.ts").toString();
const newIndexFile = indexFile.replace( const newIndexFile = indexFile.replace(
/version\("[0-9]+\.[0-9]+\.[0-9]+"\)/, /version\("[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc|dev)\.[0-9]+)?"\)/,
`version("${__NEW_VERSION__}")` `version("${__NEW_VERSION__}")`,
); );
fs.writeFileSync("./src/index.ts", newIndexFile); fs.writeFileSync("./src/index.ts", newIndexFile);
execSync( 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,9 +1,16 @@
# Changelog # Changelog
Generation of this changelog is based on commits 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 ## v1.13.0
### Fixes ### Fixes
- [7b499d763] - **commands**: commit crash upon missing HEAD (#19) - [7b499d763] - **commands**: commit crash upon missing HEAD (#19)
### Miscellaneous ### Miscellaneous
- [87a7c4dcc] - **release**: v1.13.0
- [6ce6e88d8] - Merge pull request 'Refactor into multiple command files' (#20) from refactor/#18 into main - [6ce6e88d8] - Merge pull request 'Refactor into multiple command files' (#20) from refactor/#18 into main
## v1.13.0-rc.0 ## v1.13.0-rc.0
### Miscellaneous ### Miscellaneous

View File

@@ -1,6 +1,6 @@
{ {
"name": "@resultium/rcz", "name": "@resultium/rcz",
"version": "1.13.0", "version": "1.13.1",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"description": "Resultium commit standardization library, inspired by conventional commits", "description": "Resultium commit standardization library, inspired by conventional commits",
"main": "./dist/index.js", "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 { Command } from "commander";
import simpleGit from "simple-git"; import simpleGit from "simple-git";
import { CommitStack } from "../types"; import { CommitStack } from "../types";
import { sort } from "semver"; import { gt, sort } from "semver";
const command = new Command("changelog") const command = new Command("changelog")
.alias("ch") .alias("ch")
@@ -113,7 +113,17 @@ const command = new Command("changelog")
lastTag = tag; 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) { if (lastOnly) {
parsedCommitStacks = [parsedCommitStacks[0]]; parsedCommitStacks = [parsedCommitStacks[0]];

View File

@@ -94,7 +94,7 @@ const command = new Command("commit")
} }
} }
} catch { } catch {
note("HEAD hasn't been found, skipping commit line amount check"); note("HEAD hasn't been found, skipping commit line sum check");
} }
const type: string | symbol = await select({ const type: string | symbol = await select({

View File

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