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

Refine content collection warnings #10001

Merged
merged 6 commits into from
Feb 14, 2024
Merged

Conversation

bholmesdev
Copy link
Contributor

@bholmesdev bholmesdev commented Feb 6, 2024

Changes

Starlight users have struggled with a warning message for the i18n collection:

[WARN] [content] The i18n collection is defined but no content/i18n folder exists in the content directory. Create a new folder for the collection, or check your content configuration file for typos.

This warning was initially added to prevent typos between your configured collection name and the actual directory name. Even so, warning logs are easily lost during development. This GitHub discussion describes hours lost due to this.

What we want is some indicator during development that there's a mismatch, without excessive console warnings. We landed here:

  1. We should remove the warning for a configured collection that lacks a directory.
  2. Add type generation for a configured collection even when the directory doesn't exist. As that discussion above notes, they may have caught their typo sooner if generated types included their misconfigured directory. "Huh, why do I see both article and articles in my intellisense? Ah, probably a typo."

Code changes

  • Remove "may be a typo" warning when a configured collection lacks a matching directory
  • Respect configured collections in generated types, even when a matching directory DNE

Testing

N/A - type change only

Docs

N/A

Copy link

changeset-bot bot commented Feb 6, 2024

🦋 Changeset detected

Latest commit: 9d34d66

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 Feb 6, 2024
@github-actions github-actions bot added the semver: minor Change triggers a `minor` release label Feb 6, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This PR is blocked because it contains a minor changeset. A reviewer will merge this at the next release if approved.

@Princesseuh Princesseuh added this to the 4.4 milestone Feb 6, 2024
Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Not super familiar with the type gen code, but I agree with the idea here and it looks like the right pieces have been added and removed as far as I can tell — thanks for tackling @bholmesdev!

.changeset/hip-hotels-divide.md Outdated Show resolved Hide resolved
Co-authored-by: Chris Swithinbank <[email protected]>
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

YAY BEN! 🥳

For the sake of a visible checkmark, docs is approving!

@ematipico ematipico merged commit 748b2e8 into main Feb 14, 2024
13 checks passed
@ematipico ematipico deleted the feat/content-collection-warnings branch February 14, 2024 10:09
@astrobot-houston astrobot-houston mentioned this pull request Feb 14, 2024
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) semver: minor Change triggers a `minor` release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants