From 46a52ddebba6d0a82400bff47b487963536557af Mon Sep 17 00:00:00 2001 From: Olivers Vitins Date: Sun, 20 Aug 2023 18:01:12 +0300 Subject: [PATCH 1/3] feat(commands): add the ability to sign conventional commits (#2) --- src/index.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7b23fa4..7f68b9f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -38,7 +38,10 @@ program program .command("commit") .description("Create a conventional commit") - .action(async () => { + .option("-S, --sign", "sign the commit") + .action(async (options) => { + const sign = options.sign ? true : false; + const config = await GetConfig(); intro("Creating a conventional commit"); @@ -178,9 +181,11 @@ program }${body ? `\n\n${body}` : ``}`; if (stageAll) { - await simpleGit().add(".").commit(commitMessage); + await simpleGit() + .add(".") + .commit(commitMessage, sign ? ["-S"] : []); } else { - await simpleGit().commit(commitMessage); + await simpleGit().commit(commitMessage, sign ? ["-S"] : []); } note(commitMessage); @@ -372,7 +377,9 @@ program "Changes package.json version and creates a new commit with a tag" ) .argument("", "new version formatted in SemVer") - .action(async (string: string) => { + .option("-S, --sign", "sign the release commit and tag") + .action(async (string: string, options) => { + const sign = options.sign ? true : false; const version = string.replace("v", ""); const packageFile = JSON.parse( ( @@ -392,8 +399,12 @@ program await simpleGit() .add(".") - .commit(`chore(release): v${version}`) - .addTag(`v${version}`); + .commit(`chore(release): v${version}`, sign ? ["-S"] : []) + .tag( + sign + ? [`-s v${version}`, `-m "Version ${version}"`] + : [`-a v${version}`, `-m "Version ${version}"`] + ); }); program.parse(); From c69db8f4b9c756d116343081c159c6cc300ef77a Mon Sep 17 00:00:00 2001 From: Olivers Vitins Date: Sun, 20 Aug 2023 18:09:28 +0300 Subject: [PATCH 2/3] chore(release): v1.2.0 --- README.md | 1 + package.json | 2 +- src/index.ts | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cdfa8b3..043a821 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Resultium commit standardization library 1. Make changes to your git initialized project 2. Run `rcz commit` in the root directory + - if you wish to sign your commit use `--sign` option 3. Answer all the questions 4. Push to remote diff --git a/package.json b/package.json index 9f1157d..aef811b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@resultium/rcz", - "version": "1.1.3", + "version": "1.2.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 7f68b9f..71c4a13 100644 --- a/src/index.ts +++ b/src/index.ts @@ -402,8 +402,8 @@ program .commit(`chore(release): v${version}`, sign ? ["-S"] : []) .tag( sign - ? [`-s v${version}`, `-m "Version ${version}"`] - : [`-a v${version}`, `-m "Version ${version}"`] + ? [`-s`, `v${version}`, `-m`, `"Version ${version}"`] + : [`-a`, `v${version}`, `-m`, `"Version ${version}"`] ); }); From 8816db86fecc7429aa6cf27dd34e32e14a2275b8 Mon Sep 17 00:00:00 2001 From: Olivers Vitins Date: Sun, 20 Aug 2023 18:11:20 +0300 Subject: [PATCH 3/3] docs(changelog): generate --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4b997d..6bb63bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Generation of this changelog is based on commits +## v1.2.0 + +### Features + +- [46a52ddeb] - **commands**: add the ability to sign conventional commits (#2) + ## v1.1.3 ### Fixes