Skip to content

Commit e2cb027

Browse files
committed
⚡ Improvement when matching modules
1 parent f87797c commit e2cb027

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/modclean.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,10 @@ class ModClean extends ModClean_Utils {
198198
obj.isDirectory = isDir;
199199

200200
if(isDir) {
201-
let list = await readdir(obj.fullPath);
202-
if(list.indexOf('package.json') !== -1) obj.isModule = true;
201+
let list = await readdir(obj.fullPath),
202+
parent = path.basename(path.join(obj.fullPath, '../'));
203+
204+
if(list.indexOf('package.json') !== -1 && parent === this.options.modulesDir) obj.isModule = true;
203205
}
204206

205207
obj.stat = stats;

0 commit comments

Comments
 (0)