1 | import debugFactory from 'debug';
|
2 | import rc from 'rc';
|
3 |
|
4 | const debug = debugFactory('clark:lib:config');
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | export interface Config {
|
10 | scripts?: ScriptConfig;
|
11 | |
12 |
|
13 |
|
14 |
|
15 | include?: string | string[];
|
16 | }
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | export interface ScriptConfig {
|
22 | [key: string]: string;
|
23 | }
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | export function load(): Config {
|
29 | debug('Looking for .clarkrc files');
|
30 | const conf = rc('clark', {
|
31 |
|
32 |
|
33 |
|
34 | include: 'packages/node_modules/{*,@*/*}',
|
35 | });
|
36 | if (conf.configs && conf.configs.length) {
|
37 | debug(`Found "${conf.configs.length}" .clarkrc files`);
|
38 | return conf;
|
39 | }
|
40 | debug('Did not find any .clarkrc files');
|
41 | return {};
|
42 | }
|