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

feat(next): update .astro paths #11963

Open
wants to merge 15 commits into
base: next
Choose a base branch
from
Open

Conversation

florian-lefebvre
Copy link
Member

@florian-lefebvre florian-lefebvre commented Sep 10, 2024

Changes

Testing

Should still pass

Docs

Not sure what should be updated. Pretty much everything should not be accessed directly by user, except json schemas for data collections. @sarah11918 would that only require updating https://docs.astro.build/en/guides/content-collections/#enabling-json-schema-generation ?

Copy link

changeset-bot bot commented Sep 10, 2024

⚠️ No Changeset found

Latest commit: a850394

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Sep 10, 2024
@github-actions github-actions bot added the semver: major Change triggers a `major` release label Sep 10, 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 major changeset. A reviewer will merge this at the next release if approved.

@florian-lefebvre florian-lefebvre marked this pull request as ready for review September 11, 2024 12:27
@Princesseuh
Copy link
Member

@florian-lefebvre
Copy link
Member Author

Done in withastro/language-tools#951

@bluwy
Copy link
Member

bluwy commented Sep 12, 2024

Why are we moving all the files one-level down? Don't we control .astro so we are free to structure it however we want? Is this making way for other integrations to put stuff in .astro without naming collisions? If that's true, I don't think we should be explicitly catering it as they should be using a unique enough name (like .astro/my-integration-special-data.json) to prevent collision chances.

@florian-lefebvre
Copy link
Member Author

ATM we can't control where people put stuff. I'm in favor of creating somle kind of convention (.astro/astro for core) there. At least that was the intent when doing injectTypes in 4.14. To protect ourselves even more, we'd need a injectAsset (probably bad name) that would do basically the same as injectTypes BUT for any file and without creating references.

@bluwy
Copy link
Member

bluwy commented Sep 12, 2024

Do we want to say that it's safe to put your stuff in .astro? There's always a risk borrowing a folder you don't own and putting stuff there, and I think it should apply here too.

Astro owns the .astro folder so I don't think we need to protect ourselves from integrations tampering it. If an integration caused a name conflict in the .astro folder or something else that caused Astro to crash, the integration should be fixing it, not us.

For injectTypes, I see it more as a way for integrations to easily add types and sync with our command. And deduplicates the same amount of work to construct and write types.

@florian-lefebvre
Copy link
Member Author

There's always a risk borrowing a folder you don't own and putting stuff there, and I think it should apply here too

It makes sense to me, as an integration author, to want to put codegen files in there since that's where astro does it. otherwise, that means you need to create your own .folder, add it to gitignore etc


As for the rest, I get your point, I guess we could move things outside of .astro/astro instead. I'd like to at least expose the directory .astro/integrations/<normalized> to integrations authors so that they can put stuff in there without conflicting with astro. wdyt?

@bluwy
Copy link
Member

bluwy commented Sep 12, 2024

I think it's fine for integrations to put stuff into .astro, just that we can't guarantee to not break your integration if we decide to add certain file names that could collide with yours. So if integrations want to avoid that risk, the names that they put in there should be unique enough.

For .astro/integrations/, I'm fine with that if it's only documentation that you're encouraged to put your assets there if needed. I'm not so sure about codifying the guarantee or like helping generate the folder. Maybe others having different thoughts on this.

@florian-lefebvre
Copy link
Member Author

Doesn't have to be in the beta so not urgent to answer. @Princesseuh when you have some time I'd like your opinion on that

@Princesseuh
Copy link
Member

I don't see a big need for the PR to be done now, as it seems very unlikely for integrations to conflict with our files. Perhaps in the future if we see a lot of code gen being done. I think this can also somewhat be done in a non-breaking way? It's only the JSON schemas that are breaking

I'm personally in favour of a dedicated .astro/integrations/{integration name} folder with an API for codegen, I think it makes it nicer for both end users and integration authors, since you don't need to manage .gitignore or folder creation and the structure is previsible for debugging (ah, all the files for {integration} are in this folder)

@florian-lefebvre
Copy link
Member Author

florian-lefebvre commented Sep 13, 2024

Alright then if you're both okay with that, I'll do the following:

  • close the language tools PR
  • move dts from .astro/astro to .astro
  • expose the integration dir as URL in astro:config:setup

But yeah it doesn't have to be a 5.0 thing

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: major Change triggers a `major` release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants