3 Commits

4 changed files with 31 additions and 21 deletions

View File

@@ -1,7 +1,13 @@
# Changelog
Generation of this changelog is based on commits
## v1.13.0
### Fixes
- [7b499d763] - **commands**: commit crash upon missing HEAD (#19)
### Miscellaneous
- [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.0",
"license": "GPL-3.0-or-later",
"description": "Resultium commit standardization library, inspired by conventional commits",
"main": "./dist/index.js",

View File

@@ -69,28 +69,32 @@ const command = new Command("commit")
process.exit(0);
}
const changedLines = (
(
await simpleGit().diff(["--numstat", stageAll ? "HEAD" : "--cached"])
).match(/\d+/gm) || []
).reduce((partialSum, num) => partialSum + Number(num), 0);
try {
const changedLines = (
(
await simpleGit().diff(["--numstat", stageAll ? "HEAD" : "--cached"])
).match(/\d+/gm) || []
).reduce((partialSum, num) => partialSum + Number(num), 0);
if (changedLines > 250 && !sudo) {
const proceedCommitting = await confirm({
message:
"You are about to commit changes to more than 250 lines, are you sure you want to proceed?",
initialValue: false,
});
if (changedLines > 250 && !sudo) {
const proceedCommitting = await confirm({
message:
"You are about to commit changes to more than 250 lines, are you sure you want to proceed?",
initialValue: false,
});
if (isCancel(proceedCommitting)) {
cancel("Commit creation cancelled");
process.exit(0);
}
if (!proceedCommitting) {
cancel("Cancelled, please split this commit into smaller ones");
process.exit(0);
if (isCancel(proceedCommitting)) {
cancel("Commit creation cancelled");
process.exit(0);
}
if (!proceedCommitting) {
cancel("Cancelled, please split this commit into smaller ones");
process.exit(0);
}
}
} catch {
note("HEAD hasn't been found, skipping commit line amount check");
}
const type: string | symbol = await select({

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.0");
const commandFiles = await readdir(join(__dirname, "commands"));