UNPKG

665 BJavaScriptView Raw
1'use strict';
2
3const path = require('path');
4const oshomedir = require('os-homedir');
5const minimist = require('minimist');
6const createExplorer = require('./lib/createExplorer');
7
8const parsedCliArgs = minimist(process.argv);
9
10module.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};