1 |
|
2 | 'use strict';
|
3 |
|
4 | const os = require('os');
|
5 | const createExplorer = require('./createExplorer');
|
6 |
|
7 | const homedir = os.homedir();
|
8 |
|
9 | module.exports = function cosmiconfig(
|
10 | moduleName ,
|
11 | options
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | ) {
|
25 | options = Object.assign(
|
26 | {},
|
27 | {
|
28 | packageProp: moduleName,
|
29 | rc: `.${moduleName}rc`,
|
30 | js: `${moduleName}.config.js`,
|
31 | rcStrictJson: false,
|
32 | stopDir: homedir,
|
33 | cache: true,
|
34 | sync: false,
|
35 | },
|
36 | options
|
37 | );
|
38 |
|
39 | return createExplorer(options);
|
40 | };
|