feat(config): allow more config file names

.rczrc.json and rcz.config.json can now be used as rcz configuration
This commit is contained in:
2023-08-22 17:28:21 +03:00
parent 56ad837b82
commit 5080d71fb8
3 changed files with 15 additions and 2 deletions

3
.rczrc
View File

@@ -3,6 +3,7 @@
"commands", "commands",
"changelog", "changelog",
"readme", "readme",
"release" "release",
"config"
] ]
} }

View File

@@ -23,7 +23,7 @@ Resultium commit standardization library
## Configuration ## 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 ```json
{ {

View File

@@ -24,6 +24,18 @@ const GetConfig = async () => {
await fs.promises.readFile(path.join(process.cwd(), ".rczrc")) await fs.promises.readFile(path.join(process.cwd(), ".rczrc"))
).toString() ).toString()
) as Config; ) 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 { } else {
return null; return null;
} }