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

Get a list of collections #386

Open
willthomson opened this issue Jul 3, 2024 · 1 comment
Open

Get a list of collections #386

willthomson opened this issue Jul 3, 2024 · 1 comment
Assignees
Labels
enhancement Feature request

Comments

@willthomson
Copy link
Member

In Registry, we're using collections, one per microsite. On each microsite, we show a 'more domains' dropdown. In order to maintain this list across all microsites automatically, it would be great to get a list of all collections.

This is related to #385, allowing access to the metadata to populate this dropdown.

@willthomson willthomson added the enhancement Feature request label Jul 3, 2024
@stevenle
Copy link
Member

stevenle commented Jul 3, 2024

Root uses vite under the hood, so you can actually use import.meta.glob to get all of the collections in your project. Something like:

const collectionModules = import.meta.glob('/collections/*.schema.ts', {eager: true});
const collectionSchemas = collectionModules.map((module) => module.default);
console.log(collectionSchemas);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request
Projects
None yet
Development

No branches or pull requests

2 participants