From 5080d71fb830f479047e18df4ded7508f2879928 Mon Sep 17 00:00:00 2001 From: Olivers Vitins Date: Tue, 22 Aug 2023 17:28:21 +0300 Subject: [PATCH] feat(config): allow more config file names .rczrc.json and rcz.config.json can now be used as rcz configuration --- .rczrc | 3 ++- README.md | 2 +- src/index.ts | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.rczrc b/.rczrc index ea4301a..8ecc533 100644 --- a/.rczrc +++ b/.rczrc @@ -3,6 +3,7 @@ "commands", "changelog", "readme", - "release" + "release", + "config" ] } diff --git a/README.md b/README.md index 043a821..ce81777 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Resultium commit standardization library ## Configuration -You can create an `.rczrc` file in your root directory and specify available scopes and commit types +You can create an `.rczrc`, `.rczrc.json` or `rcz.config.json` file in your root directory and specify available scopes and commit types ```json { diff --git a/src/index.ts b/src/index.ts index 18c9913..b6549db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,6 +24,18 @@ const GetConfig = async () => { await fs.promises.readFile(path.join(process.cwd(), ".rczrc")) ).toString() ) as Config; + } else if (fs.existsSync(path.join(process.cwd(), ".rczrc.json"))) { + return JSON.parse( + ( + await fs.promises.readFile(path.join(process.cwd(), ".rczrc.json")) + ).toString() + ) as Config; + } else if (fs.existsSync(path.join(process.cwd(), "rcz.config.json"))) { + return JSON.parse( + ( + await fs.promises.readFile(path.join(process.cwd(), "rcz.config.json")) + ).toString() + ) as Config; } else { return null; }