Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document glob spec. #7076

Merged
merged 4 commits into from
Jan 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/pages/repo/docs/reference/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -437,4 +437,34 @@ option, `turbo` can warn you about an invalid configuration.
}
```

## Glob specification for paths

Turborepo's glob implementation is based on [wax](https://glob.guide/user-guide/syntax/). A few of the most common patterns you will need are in the table below:

| Pattern | Description |
| ------------------- | ---------------------------------------------------------------------------------- |
| `*` | Match all files in the directory |
| `**` | Deeply match all files and sub-directories |
| `some-dir/` | Match the `some-dir` directory **but not its contents** |
| `some-dir*` | Match files and directories that start with `some-dir` |
anthonyshew marked this conversation as resolved.
Show resolved Hide resolved
| `*.js` | Matches all `.js` files in the directory |
| `*.{js,ts,tsx,jsx}` | Matches all files that end with the provided extensions in the directory |
| `*.{js?x}` | Matches all files with the `js` and `jsx` extensions in the directory |
| `!` | Negate the whole glob (automatically applies `/**` to the end of the defined glob) |

Here are a few examples of how to use these patterns:
anthonyshew marked this conversation as resolved.
Show resolved Hide resolved

| Pattern | Description |
| ------------------ | ------------------------------------------------------------------------------------------------- |
| `dist/**` | Match all files in the `dist` directory and all sub-directories |
| `dist/some-dir/**` | Match all files in the `dist/some-dir` directory and all sub-directories in the current directory |
| `dist/` | Match the `dist` directory **but not its contents** |
| `dist` | Match the `dist` directory **but not its contents** |
| `dist*` | Match files and directories that start with `dist` |
| `dist/*.js` | Matches all `.js` files in the `dist` directory |
| `dist/**/*.js` | Matches all deeply nested `.js` files in the `dist` directory |
| `../scripts/**` | Up one directory, match all files and sub-directories in the `scripts` directory |

For more advanced globbing patterns, see the [wax glob guide](https://glob.guide/user-guide/syntax/).
anthonyshew marked this conversation as resolved.
Show resolved Hide resolved

[1]: /repo/docs/core-concepts/monorepos/configuring-workspaces
Loading