We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0124b5a commit 5c63fceCopy full SHA for 5c63fce
lib/getConfig.js
@@ -0,0 +1,23 @@
1
+import path from 'path';
2
+import json from 'json-extra';
3
+
4
+const cwd = process.cwd();
5
6
+const getConfig = (altPath) => {
7
+ const pathString = altPath || path.join(cwd, '.sgcrc');
8
+ let configObject = json.readToObjSync(pathString);
9
10
+ 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
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'));
18
19
20
+ return configObject;
21
+};
22
23
+export default getConfig;
0 commit comments