Skip to content

Commit 618860d

Browse files
committed
docs added
1 parent 1fea6ed commit 618860d

File tree

1 file changed

+89
-1
lines changed

1 file changed

+89
-1
lines changed

website/docs/core-concepts/vendor/vendor-manifest.mdx

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ The `vendor.yaml` vendoring manifest supports Kubernetes-style YAML config to de
217217

218218
<dt>`included_paths` and `excluded_paths`</dt>
219219
<dd>
220-
`included_paths` and `excluded_paths` support [POSIX-style greedy Globs](https://en.wikipedia.org/wiki/Glob_(programming)) for filenames/paths (double-star/globstar `**` is supported as well).
220+
`included_paths` and `excluded_paths` support [POSIX-style greedy Globs](https://en.wikipedia.org/wiki/Glob_(programming)) for filenames/paths (double-star/globstar `**` is supported as well). For more details, see [Vendoring with Globs](#vendoring-with-globs).
221221
</dd>
222222

223223
<dt>`component`</dt>
@@ -497,3 +497,91 @@ To vendor the `vpc` component, execute the following command:
497497
atmos vendor pull -c vpc
498498
```
499499
</Terminal>
500+
501+
## Vendoring with Globs
502+
503+
When defining vendoring rules in Atmos, **glob patterns** determine which files and directories are included or excluded. Understanding how globs behave—especially when using greedy (`**`) versus non-greedy (`*`) patterns—is crucial for precise vendoring.
504+
505+
### Understanding Greedy and Non-Greedy Globs
506+
507+
Globs use special wildcard characters:
508+
509+
- `*` (single asterisk) matches any sequence of characters **within a single path segment**.
510+
- `**` (double asterisk) matches across multiple path segments **recursively**.
511+
512+
This distinction is important when excluding specific directories or files while vendoring.
513+
514+
#### Example: Excluding a Subdirectory
515+
516+
Consider the following configuration:
517+
518+
```yaml
519+
included_paths:
520+
- "**/demo-library/**"
521+
excluded_paths:
522+
- "**/demo-library/**/stargazers/**"
523+
```
524+
525+
How It Works:
526+
- The included_paths rule `**/demo-library/**` ensures all files inside `demo-library` (at any depth) are vendored.
527+
- The excluded_paths rule `**/demo-library/**/stargazers/**` prevents any files inside `stargazers` subdirectories from being vendored.
528+
529+
This means:
530+
- All files within demo-library except those inside any `stargazers` subdirectory are vendored.
531+
- Any other files outside `stargazers` are unaffected by this exclusion.
532+
533+
Example: A Non-Recursive Pattern That Doesn't Work
534+
535+
```yaml
536+
included_paths:
537+
- "**/demo-library/*"
538+
excluded_paths:
539+
- "**/demo-library/**/stargazers/**"
540+
```
541+
542+
In this case:
543+
- `**/demo-library/*` only matches immediate children of demo-library, not nested files or subdirectories.
544+
- This means `stargazers/` itself could be matched, but its contents might not be explicitly excluded.
545+
- To correctly capture all subdirectories and files while still excluding stargazers, use `**/demo-library/**/*`.
546+
547+
Using `{...}` for Multiple Extensions or Patterns
548+
549+
Curly braces `{...}` allow for expanding multiple patterns into separate glob matches. This is useful when selecting multiple file types or directories within a single glob pattern.
550+
551+
Example: Matching Multiple File Extensions
552+
553+
```yaml
554+
included_paths:
555+
- "**/demo-library/**/*.{tf,md}"
556+
```
557+
558+
This is equivalent to writing:
559+
560+
```yaml
561+
included_paths:
562+
- "**/demo-library/**/*.tf"
563+
- "**/demo-library/**/*.md"
564+
```
565+
566+
The `{tf,md}` part expands to both `*.tf` and `*.md`, making the rule more concise.
567+
568+
Example: Excluding Multiple Directories
569+
570+
```yaml
571+
excluded_paths:
572+
- "**/demo-library/**/{stargazers,archive}/**"
573+
```
574+
575+
This excludes both:
576+
- `**/demo-library/**/stargazers/**`
577+
- `**/demo-library/**/archive/**`
578+
579+
Using `{...}` here prevents the need to write two separate exclusion rules.
580+
581+
Key Takeaways
582+
1. Use `**/` for recursive matching to include everything inside a directory.
583+
2. Use `*` for single-segment matches, which won't include deeper subdirectories.
584+
3. Use `{...}` to match multiple extensions or directories within a single pattern.
585+
4. Exclusion rules must match nested paths explicitly when trying to exclude deep directories.
586+
587+
By carefully combining `included_paths`, `excluded_paths`, and `{...}` expansion, you can precisely control which files are vendored while ensuring unwanted directories like stargazers are omitted.

0 commit comments

Comments
 (0)