forked from CodebuffAI/codebuff
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontentlayer.config.ts
More file actions
40 lines (37 loc) · 1.09 KB
/
Copy pathcontentlayer.config.ts
File metadata and controls
40 lines (37 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { defineDocumentType, makeSource } from 'contentlayer/source-files'
import { remarkCodeToCodeDemo } from './src/lib/remark-code-to-codedemo'
export const Doc = defineDocumentType(() => ({
name: 'Doc',
filePathPattern: `**/*.mdx`,
contentType: 'mdx',
fields: {
title: { type: 'string', required: true },
section: { type: 'string', required: true },
tags: { type: 'list', of: { type: 'string' }, required: false },
order: { type: 'number', required: false },
},
computedFields: {
slug: {
type: 'string',
resolve: (doc) => doc._raw.sourceFileName.replace(/\.mdx$/, ''),
},
category: {
type: 'string',
resolve: (doc) => doc._raw.sourceFileDir,
},
},
}))
export default makeSource({
contentDirPath: 'src/content',
documentTypes: [Doc],
contentDirExclude: ['case-studies/_cta.mdx'],
disableImportAliasWarning: true,
mdx: {
remarkPlugins: [[remarkCodeToCodeDemo]],
rehypePlugins: [],
},
onSuccess: async () => {
// This prevents the worker error by not trying to exit the process
return Promise.resolve()
},
})