Skip to content

Commit bf7665d

Browse files
aichbauerJPeer264
authored andcommitted
🐛 Fix: updated stmt, pass with altPath, package.json and .sgcrc_default
1 parent 9814eef commit bf7665d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/getConfig.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ const getConfig = (altPath) => {
88
let configObject = json.readToObjSync(pathString);
99

1010
if (!configObject) {
11-
// package.json .rcs if no other config is found
12-
configObject = json.readToObjSync(path.join(cwd, 'package.json')).sgc;
13-
}
14-
15-
if (!configObject) {
16-
// if no config is available on the users project, the default settings should be used
17-
configObject = json.readToObjSync(path.join(__dirname, '..', '.sgcrc_default'));
11+
// if package.json .rcs else .sgcrc_default
12+
const packageJson = json.readToObjSync(path.join(cwd, 'package.json')).sgc;
13+
const sgcrcDefault = json.readToObjSync(path.join(__dirname, '..', '.sgcrc_default'));
14+
configObject = typeof packageJson === 'object' ? packageJson : sgcrcDefault;
1815
}
1916

2017
return configObject;

0 commit comments

Comments
 (0)