-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from thegalactiks/refactor-contentlayer
refactor: move document types in a dedicated dir and add example dir
- Loading branch information
Showing
47 changed files
with
866 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": ["plugin:mdx/recommended"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# dependencies | ||
node_modules/ | ||
|
||
# logs | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
|
||
# environment variables | ||
.env | ||
.env.production | ||
|
||
# macOS-specific files | ||
.DS_Store | ||
|
||
# eslint | ||
.eslintcache | ||
|
||
# Contentlayer | ||
.contentlayer |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
name: Article name | ||
description: Article description | ||
identifier: article | ||
author: person | ||
dateCreated: 1970-01-01 | ||
dateModified: 1970-01-01 | ||
datePublished: 1970-01-01 | ||
keywords: | ||
- keyword | ||
--- | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | ||
|
||
## de Finibus Bonorum et Malorum | ||
|
||
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
elementType: SiteNavigationElement | ||
identifier: navbar | ||
itemListElement: | ||
- name: Homepage | ||
path: / | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
name: Organization name | ||
description: Organization description | ||
identifier: organization | ||
--- | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
name: Homepage | ||
description: Homepage description | ||
identifier: index | ||
dateCreated: 1970-01-01 | ||
--- | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
name: Page title | ||
description: Page description | ||
identifier: page | ||
dateCreated: 1970-01-01 | ||
--- | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
name: Person name | ||
description: Person description | ||
identifier: person | ||
dateCreated: 1970-01-01 | ||
--- | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
name: Place name | ||
description: Place description | ||
identifier: place | ||
dateCreated: 1970-01-01 | ||
--- | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
name: Website name | ||
description: Website description. | ||
identifier: example.com | ||
url: https://example.com/ | ||
dateCreated: 1970-01-01 | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { | ||
ArticleDocumentType, | ||
OrganizationDocumentType, | ||
PageDocumentType, | ||
PersonDocumentType, | ||
PlaceDocumentType, | ||
WebsiteDocumentType, | ||
WebpageElementDocumentType, | ||
} from '@galactiks/contentlayer'; | ||
import { makeSource } from 'contentlayer/source-files'; | ||
|
||
const contentLayerConfig = makeSource({ | ||
contentDirPath: 'content', | ||
documentTypes: [ | ||
ArticleDocumentType, | ||
OrganizationDocumentType, | ||
PageDocumentType, | ||
PersonDocumentType, | ||
PlaceDocumentType, | ||
WebsiteDocumentType, | ||
WebpageElementDocumentType, | ||
], | ||
mdx: {}, | ||
disableImportAliasWarning: true, | ||
}); | ||
|
||
export default contentLayerConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"template": "", | ||
"locales": { | ||
"default": "en", | ||
"available": ["en"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@galactiks/contentlayer-example", | ||
"version": "0.0.0", | ||
"description": "Contentlayer repository example.", | ||
"private": "true", | ||
"scripts": { | ||
"build": "contentlayer build", | ||
"lint": "eslint . --ext mdx --cache" | ||
}, | ||
"dependencies": { | ||
"@galactiks/contentlayer": "workspace:^", | ||
"contentlayer": "0.3.4" | ||
}, | ||
"devDependencies": { | ||
"eslint": "8.56.0", | ||
"eslint-plugin-mdx": "3.1.5", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0" | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "", | ||
"description": "", | ||
"start_url": "", | ||
"icons": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { DocumentTypeDef as ContentlayerDocumentTypeDef } from 'contentlayer/source-files'; | ||
|
||
export enum pageDocumentTypes { | ||
Article = 'articles', | ||
Organization = 'organizations', | ||
Page = 'pages', | ||
Person = 'people', | ||
Place = 'place', | ||
Tag = 'tags', | ||
} | ||
|
||
export enum documentTypes { | ||
Article = pageDocumentTypes.Article, | ||
Organization = pageDocumentTypes.Organization, | ||
Page = pageDocumentTypes.Page, | ||
Person = pageDocumentTypes.Person, | ||
Place = pageDocumentTypes.Place, | ||
Tag = pageDocumentTypes.Tag, | ||
WebPageElement = 'webPageElements', | ||
Website = 'websites', | ||
} | ||
|
||
export type DocumentTypeDef = ContentlayerDocumentTypeDef & { | ||
name: keyof typeof documentTypes; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineDocumentType } from 'contentlayer/source-files'; | ||
import { ContentLayerArticleFields } from '../fields/article.js'; | ||
|
||
export const ArticleDocumentType = defineDocumentType(() => ({ | ||
...ContentLayerArticleFields, | ||
filePathPattern: 'articles/**/*.md?(x)', | ||
contentType: 'mdx', | ||
})); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineDocumentType } from 'contentlayer/source-files'; | ||
import { ContentLayerOrganizationFields } from '../fields/organization.js'; | ||
|
||
export const OrganizationDocumentType = defineDocumentType(() => ({ | ||
...ContentLayerOrganizationFields, | ||
filePathPattern: 'organizations/**/*.md?(x)', | ||
contentType: 'mdx', | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineDocumentType } from 'contentlayer/source-files'; | ||
import { ContentLayerPageFields } from '../fields/page.js'; | ||
|
||
export const PageDocumentType = defineDocumentType(() => ({ | ||
...ContentLayerPageFields, | ||
filePathPattern: 'pages/**/*.md?(x)', | ||
contentType: 'mdx', | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineDocumentType } from 'contentlayer/source-files'; | ||
import { ContentLayerPersonFields } from '../fields/person.js'; | ||
|
||
export const PersonDocumentType = defineDocumentType(() => ({ | ||
...ContentLayerPersonFields, | ||
filePathPattern: 'persons/**/*.md?(x)', | ||
contentType: 'mdx', | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineDocumentType } from 'contentlayer/source-files'; | ||
import { ContentLayerPlaceFields } from '../fields/place.js'; | ||
|
||
export const PlaceDocumentType = defineDocumentType(() => ({ | ||
...ContentLayerPlaceFields, | ||
filePathPattern: 'places/**/*.md?(x)', | ||
contentType: 'mdx', | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineDocumentType } from 'contentlayer/source-files'; | ||
import { ContentLayerWebPageElementFields } from '../fields/webpage-element.js'; | ||
|
||
export const WebpageElementDocumentType = defineDocumentType(() => ({ | ||
...ContentLayerWebPageElementFields, | ||
filePathPattern: 'elements/**/*.md?(x)', | ||
contentType: 'mdx', | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineDocumentType } from 'contentlayer/source-files'; | ||
import { ContentLayerWebsiteFields } from '../fields/website.js'; | ||
|
||
export const WebsiteDocumentType = defineDocumentType(() => ({ | ||
...ContentLayerWebsiteFields, | ||
filePathPattern: 'websites/**/*.md?(x)', | ||
contentType: 'mdx', | ||
})); |
Oops, something went wrong.