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

🔧 Resolve toc patterns in intentional order #1266

Merged
merged 9 commits into from
Jun 5, 2024
Merged

Conversation

fwkoch
Copy link
Collaborator

@fwkoch fwkoch commented Jun 3, 2024

The new project tocs introduced support for pattern entries, where users may specify a glob pattern as part of their tree. However, these were just getting resolved to a flat list of files, ordered by default system ordering.

This PR adds much more explicit handling of patterns. glob is still used to collect the files, but then we:

  • keep folder nesting
  • order within each folder as: index, remaining files in alpha order, then subfolders in alpha ordrer
  • deduplicate files in the tree, so if you specify a file that is also part of a pattern, it will not show up in the resolved pattern tree
  • respect exclude from project frontmatter

These changes mean pattern resolution is similar to the implicit project resolution, with a few small differences:

  • patterns do not automatically ignore files like _build, node_modules, .* - they can still be ignored with exclude
  • index file is handled at a per-folder level (maybe we want this behavior for implicit resolution...?)
  • deduplication of files is not required on implicit resolution since files are never encountered twice there.

This addresses #1244 - it also addresses #1243 in the process, since we resolve patterns to create a new tree without patterns.

@fwkoch fwkoch force-pushed the feat/toc-pattern-order branch from a8266f9 to ce8751a Compare June 5, 2024 17:19
@fwkoch
Copy link
Collaborator Author

fwkoch commented Jun 5, 2024

Chatted through this with @rowanc1 - merging without official review.

This also fixes up the test failure that is currently plaguing all builds.

@fwkoch fwkoch merged commit 10e80d0 into main Jun 5, 2024
5 checks passed
@fwkoch fwkoch deleted the feat/toc-pattern-order branch June 5, 2024 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant