From 8ab631549af780314dee217b477989cc2d0a5829 Mon Sep 17 00:00:00 2001 From: Olivers Vitins Date: Mon, 21 Aug 2023 18:33:33 +0300 Subject: [PATCH 1/3] feat(commands): add the ability to return code only for validation --- src/index.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index ba17731..6c7a34c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -420,9 +420,11 @@ program .command("validate") .description("Validate whether a string fits given commit conventions") .argument("[message]", "string for validation") - .action(async (string: string) => { + .option("-C, --code-only", "return code only") + .action(async (string: string, options) => { try { const message = string || fs.readFileSync(0, "utf-8"); + const codeOnly = options.codeOnly ? true : false; const config = await GetConfig(); @@ -439,11 +441,15 @@ program "gm" ); - console.log( - testRegex.test(message) - ? "[rcz]: valid message" - : "[rcz]: invalid message" - ); + if (codeOnly) { + console.log(testRegex.test(message) ? 0 : 1); + } else { + console.log( + testRegex.test(message) + ? "[rcz]: valid message" + : "[rcz]: invalid message" + ); + } } catch (err) { console.log("[rcz]: no stdin found"); } From 77dfc9a73b894ad4ef4a3ad3094bd98326622c9a Mon Sep 17 00:00:00 2001 From: Olivers Vitins Date: Mon, 21 Aug 2023 18:33:50 +0300 Subject: [PATCH 2/3] chore(release): v1.4.0 --- package.json | 2 +- src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9785910..550a8bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@resultium/rcz", - "version": "1.3.0", + "version": "1.4.0", "description": "Resultium commit standardization library, based on conventional commits", "main": "./dist/index.js", "bin": { diff --git a/src/index.ts b/src/index.ts index 6c7a34c..18c9913 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,7 +33,7 @@ const program = new Command(); program .name("rcz") .description("Resultium commit standardization command-line interface") - .version("1.3.0"); + .version("1.4.0"); program .command("commit") From 003c943a741e83344612b3bdd908be929daaffbd Mon Sep 17 00:00:00 2001 From: Olivers Vitins Date: Mon, 21 Aug 2023 18:35:05 +0300 Subject: [PATCH 3/3] docs(changelog): generate for v1.4.0 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1a05a9..faa4d5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Generation of this changelog is based on commits +## v1.4.0 + +### Features + +- [8ab631549] - **commands**: add the ability to return code only for validation command + ## v1.3.0 ### Features