From 2bf63cbb060d34675467697f6f38daaab6b5363f Mon Sep 17 00:00:00 2001 From: Tansan Date: Tue, 6 Dec 2022 14:09:13 +0800 Subject: [PATCH 1/2] feat: support JSON config file --- lib/read-config-file.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/read-config-file.js b/lib/read-config-file.js index 45e4c0e..ad9f76f 100755 --- a/lib/read-config-file.js +++ b/lib/read-config-file.js @@ -13,6 +13,12 @@ const readConfigFile = (CZ_CONFIG_NAME = '.cz-config.js') => { return czConfig; } + const czConfigJSON = findConfig.require(path.parse(CZ_CONFIG_NAME).name, {home: false}) + + if (czConfigJSON) { + return czConfigJSON + } + // fallback to locating it using the config block in the nearest package.json let pkg = findConfig('package.json', { home: false }); From 002b428e66e2ad02c54ecf4d6b52433c69c477e3 Mon Sep 17 00:00:00 2001 From: Tansan Date: Tue, 6 Dec 2022 17:02:24 +0800 Subject: [PATCH 2/2] fix: missing .json --- lib/read-config-file.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/read-config-file.js b/lib/read-config-file.js index ad9f76f..275a2c4 100755 --- a/lib/read-config-file.js +++ b/lib/read-config-file.js @@ -13,7 +13,7 @@ const readConfigFile = (CZ_CONFIG_NAME = '.cz-config.js') => { return czConfig; } - const czConfigJSON = findConfig.require(path.parse(CZ_CONFIG_NAME).name, {home: false}) + const czConfigJSON = findConfig.require(`${path.parse(CZ_CONFIG_NAME).name}.json`, { home: false }) if (czConfigJSON) { return czConfigJSON