Skip to content

Commit

Permalink
Update resolver.js (#105)
Browse files Browse the repository at this point in the history
Limit depth of globby.sync calls to increase speed while searching for generators.
  • Loading branch information
andersaloof authored and SBoudrias committed Aug 21, 2018
1 parent ebfcb79 commit 893fc6e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ resolver.lookup = function (cb) {
}

for (const pattern of patterns) {
for (const filename of globby.sync('*/index.js', {cwd: pattern, absolute: true})) {
for (const filename of globby.sync('*/index.js', {cwd: pattern, absolute: true, deep: 1})) {
this._tryRegistering(filename);
}
}
Expand Down Expand Up @@ -73,8 +73,11 @@ resolver.findGeneratorsIn = function (searchPaths) {
// restricted folders.
try {
modules = modules.concat(globby.sync(
['generator-*', '@*/generator-*'],
{cwd: root, onlyFiles: false, absolute: true}
['generator-*'],
{cwd: root, onlyFiles: false, absolute: true, deep: 0}
), globby.sync(
['@*/generator-*'],
{cwd: root, onlyFiles: false, absolute: true, deep: 1}
));
} catch (err) {
debug('Could not access %s (%s)', root, err);
Expand Down

0 comments on commit 893fc6e

Please sign in to comment.