文件全局变量规范

Turborepo 中使用文件通配符 (globs) 来配置在各种上下文中要包含或排除的文件,从而允许你明确定义希望 turbo 使用的文件。

¥File globs are used throughout Turborepo for configuring which files to include or exclude in various contexts, allowing you to specifically define the files you want turbo to use.

通配符模式

¥Glob patterns

模式描述
*匹配目录中的所有文件
**递归匹配所有文件和子目录
some-dir/匹配 some-dir 目录及其内容
some-dir匹配名为 some-dirsome-dir 目录的文件及其内容
some-dir*匹配以 some-dir 开头的文件和目录,匹配目录时包含其内容
*.js匹配目录中的所有 .js 文件
!取反整个 glob(自动将 /** 应用于定义的 glob 末尾)

示例

¥Examples

模式描述
dist/**匹配 dist 目录中的所有文件、其内容及所有子目录
dist/匹配 dist 目录及其内容
dist匹配名为 distdist 目录的文件、其内容及所有子目录
dist/some-dir/**匹配 dist/some-dir 目录中的所有文件以及当前目录中的所有子目录
!dist忽略 dist 目录及其所有内容
dist*匹配以 dist 开头的文件和目录
dist/*.js匹配 dist 目录中的所有 .js 文件
!dist/*.js忽略 dist 目录中的所有 .js 文件
dist/**/*.js递归匹配 dist 目录及其子目录中的所有 .js 文件
../scripts/**向上一级目录,匹配 scripts 目录中的所有文件和子目录