Skip to content

Commit

Permalink
fix(cwd): addition of cwd missed function definition
Browse files Browse the repository at this point in the history
modernized to modern js as well

Signed-off-by: Tobias Gurtzick <magic@wizardtales.com>
  • Loading branch information
wzrdtales committed May 13, 2019
1 parent 9754c5b commit 7c238a4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,18 @@ function loadPlugins (options) {
return hooks;
}

module.exports.getInstance = function (isModule, options, callback) {
module.exports.getInstance = function (
isModule,
options = { cwd: process.cwd() },
callback
) {
delete require.cache[require.resolve('./api.js')];
delete require.cache[require.resolve('optimist')];
var Mod = require('./api.js');
var plugins = {};

var options_ = options || {};
options_.cwd = options.cwd || process.cwd;

try {
if (!options || !options.noPlugins) plugins = loadPlugins(options_);
if (!options || !options.noPlugins) plugins = loadPlugins(options);
} catch (ex) {
log.warn(ex);
}
Expand Down

0 comments on commit 7c238a4

Please sign in to comment.