3 Commits

4 changed files with 31 additions and 21 deletions

View File

@@ -1,7 +1,13 @@
# Changelog # Changelog
Generation of this changelog is based on commits 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 ## v1.13.0-rc.0
### Miscellaneous ### Miscellaneous
- [4b0ce0fd3] - **release**: v1.13.0-rc.0
- [778175a2f] - split commands into files (#18) - [778175a2f] - split commands into files (#18)
## v1.12.4 ## v1.12.4
### Fixes ### Fixes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@resultium/rcz", "name": "@resultium/rcz",
"version": "1.13.0-rc.0", "version": "1.13.0",
"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

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