Open florian-lefebvre opened 1 year ago
π― yes this
I was looking further into astro content collections (and zod
specifically) and actually think we could go both ways:
As an easy way to start with Keystatic, you can introspect the content collection types and (for the most part) convert them into keystatic collections. It would miss some features like field descriptions and labels but it'd be neat for people already using content collections and things like validation rules could mostly come across.
Then, if you're using keystatic schema (or if you migrate from zod types to keystatic to get more UI customisation) it would make sense to go the other way as well, generate content collection types from keystatic. Zod types are useful for validation / etc as well, so I don't think it would actually be limited to astro, although a high level API that exports the content collections definition like you suggest would be very neat.
Adding this to the roadmap πΊοΈ
Awesome! Is the roadmap public?
me, on slack, five minutes ago:
... feels like maybe I should write up a readme on all the stuff we've discussed / planned / ideas, but not thought through fully or implemented yet
without wanting to get too much into "making promises that could change as we learn more" I'm really keen to write something up, yeah, especially to get feedback on design / priorities of things etc. before we actually implement them
will either post something to the docs site, or a discussion, soon and let you know π€
in the meantime by the way @florian-lefebvre I know we've been a bit slow to reply to the issues you've opened in the last week, but it's great getting feedback and questions, please do keep it coming and we will get through the backlog π
thanks!
I will keep creating issues as I have feedbacks π Regarding the roadmap, I think you could use a simple GitHub project so that you avoid duplication and allow the community to contribute/discuss
Came across this today -> https://github.com/gxjansen/Astro-CC2KS. Haven't tried it out, but looks promising.
As mentioned in https://youtu.be/6l2YWCyPsWk, it would be great to have a
keystaticToAstroCollection
utility exported by@keystatic/astro
to translate the Keystatic config to the Astro collections config.Example usage:
I made some experiments at the type level but collections and singletons specific types are lost once past to the config