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

Add support for content collections injection #8

Open
BryceRussell opened this issue Feb 25, 2024 · 1 comment
Open

Add support for content collections injection #8

BryceRussell opened this issue Feb 25, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@BryceRussell
Copy link
Member

BryceRussell commented Feb 25, 2024

Currently, if a theme uses a Content Collection, the theme user has to either clone a template with the Content Collection or manually set it up inside their own project. It would be nice if themes had the ability to automatically inject Content Collections into a project. This could be accomplished using a library like ts-morph to read the content/config.ts file and inject a schema into the collections object

Goals:

  • Automatically generate and seed content collections
  • Automatically inject collection schemas into user's projects

Things to consider:

  • AIK uses recast for codegen, should this be done using ts-morph or recast?
  • Should this be a separate package, so others can use it too?
  • Should the codegen happen directly on the file or inside a Vite plugin behind the scenes, meaning a user will not be able to see the schema inside the config file?

Working prototype using ts-morph: https://github.com/BryceRussell/prototype-inject-collection

@BryceRussell BryceRussell added the enhancement New feature or request label Feb 25, 2024
@BryceRussell BryceRussell added the question Further information is requested label Mar 19, 2024
@BryceRussell BryceRussell self-assigned this Apr 1, 2024
@BryceRussell BryceRussell added the help wanted Extra attention is needed label Apr 5, 2024
@BryceRussell BryceRussell removed their assignment Apr 6, 2024
@Fryuni
Copy link
Member

Fryuni commented May 1, 2024

// Without any extra config
export const idea7 = {
  docs: defineCollection({

  }),
}

// With some config to disable the auto-injection
export const idea7a = {
  darculaColors: darculaColorCollection({

  }),
  docs: defineCollection({

  }),
}

Might come from Fryuni/inox-tools#82 before you notice it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
Status: In Progress
Development

No branches or pull requests

2 participants