简体   繁体   English

全局:找到不在“文件夹”内的“文件夹”

[英]glob: find `folder` that are not inside `folder`

Using https://github.com/isaacs/node-glob 使用https://github.com/isaacs/node-glob

The task is to find all node_modules folders in the project tree, that are not inside other node_modules. 任务是在项目树中找到所有不在其他node_modules内的node_modules文件夹。

I tried: something like: 我试过:类似:

  • ('**/node_modules/', {ignore: '**/node_modules/**/node_modules/'})

This works but takes a few minutes (about 10) for my projects with ~10 subrojects. 这可行,但是对于我的带有约10个子项目的项目,需要花费几分钟(约10分钟)的时间。

I thought there might be quicker way? 我认为可能会有更快的方法? Any advice on this? 有什么建议吗?

Dunno, works works fine for me: Dunno,作品对我来说很好:

glob('**/node_modules/', {ignore: '**/node_modules/**/node_modules/'}, console.log)
// Output: null [ 'node_modules/' ]

//  or sync
glob.sync('**/node_modules/', {ignore: '**/node_modules/**/node_modules/'})
// => [ 'node_modules/' ]

What did you expect? 您期望什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM