contentlayerdev / contentlayerdev/contentlayer
Add support for multiple sources
- Vorherrschende Sprache
- TypeScript
- Sterne
- 3.5k
- Forks
- 192
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Currently, Contentlayer looks for a single exported method that is pulled from one particular source. We've received requests to support more than one source within the same configuration. I'm working to get more information on specific use cases.
## Considerations
What are the challenges with this approach?
## Design
What would the API for this look like? Perhaps you could define sources separately and then reference the source at the document level? And include the option for a default source.
Napkin sketch:
```js
const ctfl = makeSource({ type: 'contentful', accessToken: /* ... */ })
const local = makeSource({ type: 'local', path: /* ... */ })
const Page = defineDocumentType({ source: ctfl })
const Post = defineDocumentType({})
export default {
defaultSource: local,
documentTypes: [Page, Post]
}
```
Beitragsleitfaden
Rechercherichtung
Es werden keine Dateien oder Tests genannt. Beginne damit, die vorhandenen makeSource-, defineDocumentType- und configuration-APIs zu lesen, und vergleiche sie dann mit der vorgeschlagenen Skizze auf der Serviette; abgeschlossen ist die Arbeit, wenn die Anwendungsfälle und Herausforderungen gelöst sind und eine abgestimmte API mehrere Quellen, die Auswahl auf Dokumentebene und eine Standardsource unterstützt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- backend-api-design, content
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100