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

Suggest using import.meta.glob #9181

Merged
merged 14 commits into from
Sep 5, 2024
Merged

Suggest using import.meta.glob #9181

merged 14 commits into from
Sep 5, 2024

Conversation

matthewp
Copy link
Contributor

@matthewp matthewp commented Aug 23, 2024

Description (required)

Replaces usage of Astro.glob with import.meta.glob instead.

For Astro version: 5.x. See astro PR #11826.

Copy link

netlify bot commented Aug 23, 2024

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 75c4149
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/66d9ea5371cf290008e140eb
😎 Deploy Preview https://deploy-preview-9181--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@astrobot-houston
Copy link
Contributor

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en guides/imports.mdx Source changed, localizations will be marked as outdated.
en guides/markdown-content.mdx Source changed, localizations will be marked as outdated.
en guides/migrate-to-astro/from-nextjs.mdx Source changed, localizations will be marked as outdated.
en guides/routing.mdx Source changed, localizations will be marked as outdated.
en reference/api-reference.mdx Source changed, localizations will be marked as outdated.
en tutorial/5-astro-api/1.mdx Source changed, localizations will be marked as outdated.
en tutorial/5-astro-api/2.mdx Source changed, localizations will be marked as outdated.
en tutorial/5-astro-api/3.mdx Source changed, localizations will be marked as outdated.
en tutorials/add-content-collections.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

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.

Thanks for this, @matthewp ! Only two kinds of small changes I've made below:

  • Depending on the type of page, some of the links will link to our own Import page entry for import.meta.glob(). Only the more reference type pages will link back to Vite directly. This is to give our readers a friendlier explanation, and resources about glob patterns etc. if they're on more "learning" type pages like the guides and tutorial.
  • The pages that do link back to vite include "Vite's" in the link so that it's clear readers will be taken off the page when they click, and that this is a "Vite thing" ultimately, so they understand that.

Otherwise, this PR is fine, and for Yan and the rest of Team Docs reading, yes, I am aware this means we will have to update the tutorial repo code.

I also think there are more Astro.glob references in docs. Some of them are error messages that need to be fixed at the source. But sometimes we will have written just the words "Astro.glob" e.g. in the in the frontmatter description of the tutorial 5-astro-api/1.mdx

So, I'm happy after committing these to do a bigger sweep, if you prefer! It might be easier for me to do, since I'll know whether I want to use import.meta.glob() or "importing with glob patterns" if it shows up somewhere in explanatory text.

src/content/docs/en/guides/imports.mdx Outdated Show resolved Hide resolved
src/content/docs/en/guides/imports.mdx Outdated Show resolved Hide resolved
src/content/docs/en/guides/imports.mdx Outdated Show resolved Hide resolved
src/content/docs/en/guides/markdown-content.mdx Outdated Show resolved Hide resolved
src/content/docs/en/guides/markdown-content.mdx Outdated Show resolved Hide resolved
src/content/docs/en/tutorial/5-astro-api/1.mdx Outdated Show resolved Hide resolved
src/content/docs/en/reference/api-reference.mdx Outdated Show resolved Hide resolved
@sarah11918 sarah11918 added this to the 5.0.0-beta milestone Aug 28, 2024
@sarah11918 sarah11918 changed the base branch from main to 5.0.0-beta August 28, 2024 15:25
@sarah11918
Copy link
Member

sarah11918 commented Sep 3, 2024

Noting that the main pages updated with new text content will be 👍

  • imports guide (draft done)
  • api reference - need to figure out what to do re: AstroInstance, MarkdownInstance, CustomDataFile interfaces listed there.

Most other pages should be updating examples, links etc.

@sarah11918
Copy link
Member

OK, @matthewp ! Thank you for your patience!

I went through and caught more instances, updated links etc. The main change occurs here, so if you don't mind previewing it to make sure this section seems OK, that would be great:

https://deploy-preview-9181--astro-docs-2.netlify.app/en/guides/imports/#importmetaglob

There is stuff there taken from both the Astro.glob() API reference (types) and a helpful pattern from the troubleshooting page. Both of these sections will be removed (Astro.glob eventually, troubleshooting now because it refers to a deprecated error), so it made sense to include the still relevant content all together here.

When that section looks good to you, I'm happy for this to be merged into the beta branch and the whole thing will be generally proofread/polished etc. before launch week, so no need for this to be perfect yet!

@matthewp
Copy link
Contributor Author

matthewp commented Sep 3, 2024

@sarah11918 look good to me!

Copy link
Contributor

@ArmandPhilippot ArmandPhilippot left a comment

Choose a reason for hiding this comment

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

There is just one problem with one of the examples. I think it hasn't been updated during the transfer from another page. But I am not sure what the best approach is here.
Other than that, it looks good to me!

src/content/docs/en/guides/imports.mdx Outdated Show resolved Hide resolved
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.

OK! I think we got everything worked out on this one, so merging in to the beta docs!

@sarah11918 sarah11918 added the Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)! label Sep 5, 2024
@sarah11918
Copy link
Member

!coauthor

Copy link

github-actions bot commented Sep 5, 2024

Co-authored-by: Houston (Bot) <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Armand Philippot <[email protected]>
Co-authored-by: Chris Swithinbank <[email protected]>

@sarah11918 sarah11918 merged commit 2c63510 into 5.0.0-beta Sep 5, 2024
4 of 5 checks passed
@sarah11918 sarah11918 deleted the astro-glob branch September 5, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0.0-beta Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants