英文:
ignore folder with specific ending using glob
问题
我尝试在特定文件夹的所有子目录中查找所有的project.json文件:
import glob from 'glob';
glob.sync('apps/**/project.json', {
ignore: ['apps/**-e2e/project.json']
})
这会给我一个类似以下的结果:
[
'apps/something/project-e2e/project.json',
'apps/something/project/project.json'
]
我想要忽略所有以 e2e
结尾的文件夹。这是否可能?我的尝试使用 ignore
部分不起作用。
英文:
I try to find all project.json files in all subdirectories of a specific folder:
import glob from 'glob'
glob.sync('apps/**/project.json', {
ignore: ['apps/**-e2e/project.json']
})
This gives me a result like:
[
'apps/something/project-e2e/project.json',
'apps/something/project/project.json'
]
I would like to ignore all folders, which ends with e2e
. Is this possible. My attempt using the ignore
part doesn't work
答案1
得分: 1
在代码中添加额外的 /*
,也许 **
不允许部分目录名称。
import glob from 'glob';
glob.sync('apps/**/project.json', {
ignore: ['apps/**/*-e2e/project.json']
})
英文:
Add an extra /*
, perhaps the **
doesn't allow for partial directory names
import glob from 'glob'
glob.sync('apps/**/project.json', {
ignore: ['apps/**/*-e2e/project.json']
})
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论