1 | 'use strict';
|
2 |
|
3 | const path = require('path');
|
4 | const oshomedir = require('os-homedir');
|
5 | const minimist = require('minimist');
|
6 | const createExplorer = require('./lib/createExplorer');
|
7 |
|
8 | const parsedCliArgs = minimist(process.argv);
|
9 |
|
10 | module.exports = function (moduleName, options) {
|
11 | options = Object.assign({
|
12 | packageProp: moduleName,
|
13 | rc: `.${moduleName}rc`,
|
14 | js: `${moduleName}.config.js`,
|
15 | argv: 'config',
|
16 | rcStrictJson: false,
|
17 | stopDir: oshomedir(),
|
18 | cache: true,
|
19 | }, options);
|
20 |
|
21 | if (options.argv && parsedCliArgs[options.argv]) {
|
22 | options.configPath = path.resolve(parsedCliArgs[options.argv]);
|
23 | }
|
24 |
|
25 | return createExplorer(options);
|
26 | };
|