feat(config): add auto-signing options

This commit is contained in:
2023-12-16 14:37:47 +02:00
parent 498c830e34
commit c80d763259
4 changed files with 14 additions and 7 deletions

View File

@@ -34,6 +34,8 @@ You can create an `.rczrc`, `.rczrc.json` or `rcz.config.json` file in your root
"value": "chore", "value": "chore",
"hint": "a routine action" "hint": "a routine action"
} }
] ],
"autoSignCommits": false,
"autoSignReleases": true
} }
``` ```

View File

@@ -1,6 +1,6 @@
{ {
"name": "@resultium/rcz", "name": "@resultium/rcz",
"version": "1.6.0", "version": "1.7.0",
"description": "Resultium commit standardization library, based on conventional commits", "description": "Resultium commit standardization library, based on conventional commits",
"main": "./dist/index.js", "main": "./dist/index.js",
"bin": { "bin": {

View File

@@ -45,7 +45,7 @@ const program = new Command();
program program
.name("rcz") .name("rcz")
.description("Resultium commit standardization command-line interface") .description("Resultium commit standardization command-line interface")
.version("1.6.0"); .version("1.7.0");
program program
.command("commit") .command("commit")
@@ -53,11 +53,11 @@ program
.option("-S, --sign", "sign the commit") .option("-S, --sign", "sign the commit")
.option("--amend", "amend commit message to the last commit") .option("--amend", "amend commit message to the last commit")
.action(async (options) => { .action(async (options) => {
const sign = options.sign ? true : false;
const amend = options.amend ? true : false;
const config = await GetConfig(); const config = await GetConfig();
const sign = config?.autoSignCommits || options.sign ? true : false;
const amend = options.amend ? true : false;
intro("Creating a conventional commit"); intro("Creating a conventional commit");
if (!fs.existsSync(path.join(process.cwd(), ".git"))) { if (!fs.existsSync(path.join(process.cwd(), ".git"))) {
@@ -421,7 +421,10 @@ program
.argument("<version>", "new version formatted in SemVer") .argument("<version>", "new version formatted in SemVer")
.option("-S, --sign", "sign the release commit and tag") .option("-S, --sign", "sign the release commit and tag")
.action(async (string: string, options) => { .action(async (string: string, options) => {
const sign = options.sign ? true : false; const config = await GetConfig();
const sign = config?.autoSignReleases || options.sign ? true : false;
const version = string.replace("v", ""); const version = string.replace("v", "");
const packageFile = JSON.parse( const packageFile = JSON.parse(
( (

View File

@@ -3,6 +3,8 @@ import { DefaultLogFields, ListLogLine } from "simple-git";
export interface Config { export interface Config {
types?: Array<Type>; types?: Array<Type>;
scopes?: Array<string>; scopes?: Array<string>;
autoSignCommits?: boolean;
autoSignReleases?: boolean;
} }
export interface Type { export interface Type {