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

Fix: Content Collections - Ignore .json files nested in non-underscored subdirectories within underscored directories #7909

Conversation

thisistonydang
Copy link
Contributor

@thisistonydang thisistonydang commented Aug 1, 2023

Changes

Change glob pattern to exclude files in underscored directories from

  • !${contentDir}**/_*/**${extGlob}
    to
  • !${contentDir}**/_*/**/*${extGlob}

This allows for all files in a directory prefixed with an _ to be ignored regardless of how nested the file is.

Details

This PR is related to issue #7154.

Previously, PR #7246 and #7268 addressed ignoring files prefixed with an _ (i.e. _underscored-file.json) and files that are direct children of an underscored directory (i.e. _underscored-dir/non-underscored-file.json). However, it did not address the case where a file is in a non-underscored subdirectory of an underscored directory (i.e. _underscored-directory/non-underscored-dir/non-underscored-file.json).

Glob pattern checked with globster.

Testing

A new file was added under test fixtures for content collections at:

astro/packages/astro/test/fixtures/content-collections/src/content/with-schema-config/_ignore/ignore/file.md

With this file and without the fix on this PR, running pnpm run test:match "with schema" will result in tests failing.

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Aug 1, 2023

🦋 Changeset detected

Latest commit: 693b329

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Aug 1, 2023
Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for the PR, this looks perfect!

@natemoo-re natemoo-re merged commit e1e958a into withastro:main Aug 1, 2023
13 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Aug 1, 2023
@thisistonydang thisistonydang deleted the tonydangblog/fix-ignore-files-in-underscore-directories branch August 3, 2023 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants