Skip to content

Commit

Permalink
Merge pull request #39 from Codehagen/38-feature-contentlayer-to-coll…
Browse files Browse the repository at this point in the history
…ection

38 feature contentlayer to collection
  • Loading branch information
Codehagen authored Jul 29, 2024
2 parents 92820ed + 65bc2e2 commit c2f8c9a
Show file tree
Hide file tree
Showing 53 changed files with 1,523 additions and 4,816 deletions.
27 changes: 27 additions & 0 deletions apps/www/.content-collections/cache/content-collection-config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// content-collections.ts
import { defineCollection, defineConfig } from "@content-collections/core";
import {
createMetaSchema,
createDocSchema,
transformMDX
} from "@fumadocs/content-collections/configuration";
var docs = defineCollection({
name: "docs",
directory: "src/content/docs",
include: "**/*.mdx",
schema: createDocSchema,
transform: transformMDX
});
var metas = defineCollection({
name: "meta",
directory: "src/content/docs",
include: "**/meta.json",
parser: "json",
schema: createMetaSchema
});
var content_collections_default = defineConfig({
collections: [docs, metas]
});
export {
content_collections_default as default
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"content":"# Welcome to Sample Documentation\n\nThis is a basic MDX file to test if Content Collections is working correctly.\n\n## Features\n\n- Easy to use\n- Supports Markdown syntax\n- Can include React components","title":"Sample Documentation","description":"This is a sample MDX file for testing Content Collections","_meta":{"filePath":"sample.mdx","fileName":"sample.mdx","directory":".","extension":"mdx","path":"sample"},"toc":[{"title":"Welcome to Sample Documentation","url":"#welcome-to-sample-documentation","depth":1},{"title":"Features","url":"#features","depth":2}],"structuredData":{"contents":[{"heading":"welcome-to-sample-documentation","content":"This is a basic MDX file to test if Content Collections is working correctly."},{"heading":"features","content":"Easy to use"},{"heading":"features","content":"Supports Markdown syntax"},{"heading":"features","content":"Can include React components"}],"headings":[{"id":"welcome-to-sample-documentation","content":"Welcome to Sample Documentation"},{"id":"features","content":"Features"}]},"body":"var Component=(()=>{var h=Object.create;var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var _=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),j=(e,n)=>{for(var o in n)c(e,o,{get:n[o],enumerable:!0})},r=(e,n,o,l)=>{if(n&&typeof n==\"object\"||typeof n==\"function\")for(let i of p(n))!f.call(e,i)&&i!==o&&c(e,i,{get:()=>n[i],enumerable:!(l=m(n,i))||l.enumerable});return e};var C=(e,n,o)=>(o=e!=null?h(x(e)):{},r(n||!e||!e.__esModule?c(o,\"default\",{value:e,enumerable:!0}):o,e)),M=e=>r(c({},\"__esModule\",{value:!0}),e);var a=_((D,s)=>{s.exports=_jsx_runtime});var w={};j(w,{default:()=>d});var t=C(a());function u(e){let n={h1:\"h1\",h2:\"h2\",li:\"li\",p:\"p\",ul:\"ul\",...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:\"welcome-to-sample-documentation\",children:\"Welcome to Sample Documentation\"}),`\n`,(0,t.jsx)(n.p,{children:\"This is a basic MDX file to test if Content Collections is working correctly.\"}),`\n`,(0,t.jsx)(n.h2,{id:\"features\",children:\"Features\"}),`\n`,(0,t.jsxs)(n.ul,{children:[`\n`,(0,t.jsx)(n.li,{children:\"Easy to use\"}),`\n`,(0,t.jsx)(n.li,{children:\"Supports Markdown syntax\"}),`\n`,(0,t.jsx)(n.li,{children:\"Can include React components\"}),`\n`]})]})}function d(e={}){let{wrapper:n}=e.components||{};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}return M(w);})();\n;return Component;"}
1 change: 1 addition & 0 deletions apps/www/.content-collections/cache/mapping.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"docs":{"sample":["373c0aa717d59dfdc79b41cef8de53e8e4e9678c3926ca7aca090bf0576cd359"]}}
57 changes: 57 additions & 0 deletions apps/www/.content-collections/generated/allDocs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
export default [
{
"content": "# Welcome to Sample Documentation\n\nThis is a basic MDX file to test if Content Collections is working correctly.\n\n## Features\n\n- Easy to use\n- Supports Markdown syntax\n- Can include React components",
"title": "Sample Documentation",
"description": "This is a sample MDX file for testing Content Collections",
"_meta": {
"filePath": "sample.mdx",
"fileName": "sample.mdx",
"directory": ".",
"extension": "mdx",
"path": "sample"
},
"toc": [
{
"title": "Welcome to Sample Documentation",
"url": "#welcome-to-sample-documentation",
"depth": 1
},
{
"title": "Features",
"url": "#features",
"depth": 2
}
],
"structuredData": {
"contents": [
{
"heading": "welcome-to-sample-documentation",
"content": "This is a basic MDX file to test if Content Collections is working correctly."
},
{
"heading": "features",
"content": "Easy to use"
},
{
"heading": "features",
"content": "Supports Markdown syntax"
},
{
"heading": "features",
"content": "Can include React components"
}
],
"headings": [
{
"id": "welcome-to-sample-documentation",
"content": "Welcome to Sample Documentation"
},
{
"id": "features",
"content": "Features"
}
]
},
"body": "var Component=(()=>{var h=Object.create;var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var _=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),j=(e,n)=>{for(var o in n)c(e,o,{get:n[o],enumerable:!0})},r=(e,n,o,l)=>{if(n&&typeof n==\"object\"||typeof n==\"function\")for(let i of p(n))!f.call(e,i)&&i!==o&&c(e,i,{get:()=>n[i],enumerable:!(l=m(n,i))||l.enumerable});return e};var C=(e,n,o)=>(o=e!=null?h(x(e)):{},r(n||!e||!e.__esModule?c(o,\"default\",{value:e,enumerable:!0}):o,e)),M=e=>r(c({},\"__esModule\",{value:!0}),e);var a=_((D,s)=>{s.exports=_jsx_runtime});var w={};j(w,{default:()=>d});var t=C(a());function u(e){let n={h1:\"h1\",h2:\"h2\",li:\"li\",p:\"p\",ul:\"ul\",...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:\"welcome-to-sample-documentation\",children:\"Welcome to Sample Documentation\"}),`\n`,(0,t.jsx)(n.p,{children:\"This is a basic MDX file to test if Content Collections is working correctly.\"}),`\n`,(0,t.jsx)(n.h2,{id:\"features\",children:\"Features\"}),`\n`,(0,t.jsxs)(n.ul,{children:[`\n`,(0,t.jsx)(n.li,{children:\"Easy to use\"}),`\n`,(0,t.jsx)(n.li,{children:\"Supports Markdown syntax\"}),`\n`,(0,t.jsx)(n.li,{children:\"Can include React components\"}),`\n`]})]})}function d(e={}){let{wrapper:n}=e.components||{};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}return M(w);})();\n;return Component;"
}
];
1 change: 1 addition & 0 deletions apps/www/.content-collections/generated/allMetas.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default [];
10 changes: 10 additions & 0 deletions apps/www/.content-collections/generated/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import configuration from "../../content-collections.ts";
import { GetTypeByName } from "@content-collections/core";

export type Doc = GetTypeByName<typeof configuration, "docs">;
export declare const allDocs: Array<Doc>;

export type Meta = GetTypeByName<typeof configuration, "meta">;
export declare const allMetas: Array<Meta>;

export {};
6 changes: 6 additions & 0 deletions apps/www/.content-collections/generated/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// generated by content-collections at Mon Jul 29 2024 19:17:30 GMT+0200 (Central European Summer Time)

import allDocs from "./allDocs.js";
import allMetas from "./allMetas.js";

export { allDocs, allMetas };
26 changes: 26 additions & 0 deletions apps/www/content-collections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defineCollection, defineConfig } from '@content-collections/core';
import {
createMetaSchema,
createDocSchema,
transformMDX,
} from '@fumadocs/content-collections/configuration';

const docs = defineCollection({
name: 'docs',
directory: 'src/content/docs',
include: '**/*.mdx',
schema: createDocSchema,
transform: transformMDX,
});

const metas = defineCollection({
name: 'meta',
directory: 'src/content/docs',
include: '**/meta.json',
parser: 'json',
schema: createMetaSchema,
});

export default defineConfig({
collections: [docs, metas],
});
191 changes: 0 additions & 191 deletions apps/www/contentlayer.config.js

This file was deleted.

13 changes: 2 additions & 11 deletions apps/www/next.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import { fileURLToPath } from "url";
import createJiti from "jiti";
import { createContentlayerPlugin } from "next-contentlayer";

// Import env files to validate at build time. Use jiti so we can load .ts files in here.
createJiti(fileURLToPath(import.meta.url))("./src/env");
import { withContentCollections } from '@content-collections/next';

/** @type {import("next").NextConfig} */
const config = {
Expand All @@ -30,8 +25,4 @@ const config = {
typescript: { ignoreBuildErrors: true },
};

const withContentlayer = createContentlayerPlugin({
// Additional Contentlayer config options
});

export default withContentlayer(config);
export default withContentCollections(config);
Loading

0 comments on commit c2f8c9a

Please sign in to comment.