create-fumadocs-app 12.3.3 → 12.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ import path from "node:path";
3
3
  import fs from "node:fs/promises";
4
4
 
5
5
  // versions.json
6
- var versions_default = { "fumadocs-core": "12.3.3", "fumadocs-ui": "12.3.3", "fumadocs-mdx": "8.2.33", "fumadocs-contentlayer": "1.1.34" };
6
+ var versions_default = { "fumadocs-core": "12.3.5", "fumadocs-ui": "12.3.5", "fumadocs-mdx": "8.2.33", "@fumadocs/content-collections": "1.0.0" };
7
7
 
8
8
  // ../create-app-versions/package.json
9
9
  var package_default = {
@@ -13,22 +13,19 @@ var package_default = {
13
13
  description: "Used to track dependency versions in create-fumadocs-app",
14
14
  license: "MIT",
15
15
  dependencies: {
16
+ "@content-collections/core": "^0.6.0",
17
+ "@content-collections/mdx": "^0.1.3",
18
+ "@content-collections/next": "^0.2.0",
16
19
  "@types/mdx": "^2.0.13",
17
20
  "@types/react": "^18.3.3",
18
21
  "@types/react-dom": "^18.3.0",
19
22
  autoprefixer: "^10.4.19",
20
- contentlayer: "^0.3.4",
21
23
  next: "^14.2.4",
22
- "next-contentlayer": "^0.3.4",
23
24
  postcss: "^8.4.38",
24
25
  react: "^18.3.1",
25
26
  "react-dom": "^18.3.1",
26
27
  tailwindcss: "^3.4.4",
27
28
  typescript: "^5.5.2"
28
- },
29
- overrides: {
30
- unified: "^11.0.4",
31
- "mdx-bundler": "^10.0.1"
32
29
  }
33
30
  };
34
31
 
@@ -140,14 +137,12 @@ function createPackageJson(projectName, { template, tailwindcss }) {
140
137
  typescript: package_default.dependencies.typescript
141
138
  }
142
139
  };
143
- if (template === "contentlayer") {
140
+ if (template === "content-collections") {
144
141
  Object.assign(packageJson.dependencies, {
145
- "fumadocs-contentlayer": versions_default["fumadocs-contentlayer"],
146
- contentlayer: package_default.dependencies.contentlayer,
147
- "next-contentlayer": package_default.dependencies["next-contentlayer"]
148
- });
149
- Object.assign(packageJson, {
150
- overrides: package_default.overrides
142
+ "@fumadocs/content-collections": versions_default["@fumadocs/content-collections"],
143
+ "@content-collections/core": package_default.dependencies["@content-collections/core"],
144
+ "@content-collections/mdx": package_default.dependencies["@content-collections/mdx"],
145
+ "@content-collections/next": package_default.dependencies["@content-collections/next"]
151
146
  });
152
147
  }
153
148
  if (template === "fuma-docs-mdx") {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  create
3
- } from "./chunk-73OMMFUE.js";
3
+ } from "./chunk-MR25BIJ7.js";
4
4
  export {
5
5
  create
6
6
  };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  create,
4
4
  cwd,
5
5
  getPackageManager
6
- } from "./chunk-73OMMFUE.js";
6
+ } from "./chunk-MR25BIJ7.js";
7
7
 
8
8
  // src/index.ts
9
9
  import { existsSync } from "node:fs";
@@ -36,7 +36,7 @@ async function main() {
36
36
  initialValue: "fuma-docs-mdx",
37
37
  options: [
38
38
  { value: "fuma-docs-mdx", label: "Fumadocs MDX" },
39
- { value: "contentlayer", label: "Contentlayer" }
39
+ { value: "content-collections", label: "Content Collections" }
40
40
  ]
41
41
  }),
42
42
  tailwindcss: () => confirm({ message: "Use Tailwind CSS for styling?" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fumadocs-app",
3
- "version": "12.3.3",
3
+ "version": "12.3.5",
4
4
  "description": "Create a new documentation site with Fumadocs",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -4,6 +4,7 @@
4
4
  # generated content
5
5
  .map.ts
6
6
  .contentlayer
7
+ .content-collections
7
8
 
8
9
  # test & build
9
10
  /coverage
@@ -3,9 +3,9 @@ import { createSearchAPI } from 'fumadocs-core/search/server';
3
3
 
4
4
  export const { GET } = createSearchAPI('advanced', {
5
5
  indexes: getPages().map((page) => ({
6
- id: page.data._id,
7
6
  title: page.data.title,
8
- url: page.url,
9
7
  structuredData: page.data.structuredData,
8
+ id: page.url,
9
+ url: page.url,
10
10
  })),
11
11
  });
@@ -1,31 +1,29 @@
1
- import { Content } from './content';
2
1
  import { getPage, getPages } from '@/app/source';
3
2
  import type { Metadata } from 'next';
4
3
  import { DocsPage, DocsBody } from 'fumadocs-ui/page';
5
4
  import { notFound } from 'next/navigation';
5
+ import { MDXContent } from '@content-collections/mdx/react';
6
+ import defaultMdxComponents from 'fumadocs-ui/mdx';
6
7
 
7
- export default async function Page({
8
- params,
9
- }: {
10
- params: { slug?: string[] };
11
- }) {
8
+ export default function Page({ params }: { params: { slug?: string[] } }) {
12
9
  const page = getPage(params.slug);
13
10
 
14
- if (page == null) {
15
- notFound();
16
- }
11
+ if (!page) notFound();
17
12
 
18
13
  return (
19
- <DocsPage toc={page.data.toc}>
14
+ <DocsPage toc={page.data.toc} full={page.data.full}>
20
15
  <DocsBody>
21
16
  <h1>{page.data.title}</h1>
22
- <Content code={page.data.body.code} />
17
+ <MDXContent
18
+ code={page.data.body}
19
+ components={{ ...defaultMdxComponents }}
20
+ />
23
21
  </DocsBody>
24
22
  </DocsPage>
25
23
  );
26
24
  }
27
25
 
28
- export async function generateStaticParams(): Promise<{ slug: string[] }[]> {
26
+ export function generateStaticParams() {
29
27
  return getPages().map((page) => ({
30
28
  slug: page.slugs,
31
29
  }));
@@ -34,7 +32,7 @@ export async function generateStaticParams(): Promise<{ slug: string[] }[]> {
34
32
  export function generateMetadata({ params }: { params: { slug?: string[] } }) {
35
33
  const page = getPage(params.slug);
36
34
 
37
- if (page == null) notFound();
35
+ if (!page) notFound();
38
36
 
39
37
  return {
40
38
  title: page.data.title,
@@ -0,0 +1,8 @@
1
+ import { allDocs, allMetas } from 'content-collections';
2
+ import { loader } from 'fumadocs-core/source';
3
+ import { createMDXSource } from '@fumadocs/content-collections';
4
+
5
+ export const { getPage, getPages, pageTree } = loader({
6
+ baseUrl: '/docs',
7
+ source: createMDXSource(allDocs, allMetas),
8
+ });
@@ -0,0 +1,25 @@
1
+ import { defineCollection, defineConfig } from '@content-collections/core';
2
+ import {
3
+ createMetaSchema,
4
+ createDocSchema,
5
+ transformMDX,
6
+ } from '@fumadocs/content-collections/configuration';
7
+
8
+ const docs = defineCollection({
9
+ name: 'docs',
10
+ directory: 'content/docs',
11
+ include: '**/*.mdx',
12
+ schema: createDocSchema,
13
+ transform: transformMDX,
14
+ });
15
+
16
+ const metas = defineCollection({
17
+ name: 'meta',
18
+ directory: 'content/docs',
19
+ include: '**/meta.json',
20
+ schema: createMetaSchema,
21
+ });
22
+
23
+ export default defineConfig({
24
+ collections: [docs, metas],
25
+ });
@@ -0,0 +1,8 @@
1
+ import { withContentCollections } from '@content-collections/next';
2
+
3
+ /** @type {import('next').NextConfig} */
4
+ const config = {
5
+ reactStrictMode: true,
6
+ };
7
+
8
+ export default withContentCollections(config);
@@ -16,7 +16,7 @@
16
16
  "incremental": true,
17
17
  "paths": {
18
18
  "@/*": ["./*"],
19
- "contentlayer/generated": ["./.contentlayer/generated"]
19
+ "content-collections": ["./.content-collections/generated"]
20
20
  },
21
21
  "plugins": [
22
22
  {
@@ -1,14 +0,0 @@
1
- 'use client';
2
-
3
- import { useMDXComponent } from 'next-contentlayer/hooks';
4
- import defaultComponents from 'fumadocs-ui/mdx';
5
-
6
- const components = {
7
- ...defaultComponents,
8
- };
9
-
10
- export function Content({ code }: { code: string }) {
11
- const MDX = useMDXComponent(code);
12
-
13
- return <MDX components={components} />;
14
- }
@@ -1,9 +0,0 @@
1
- import { allDocs, allMeta } from 'contentlayer/generated';
2
- import { createContentlayerSource } from 'fumadocs-contentlayer';
3
- import { loader } from 'fumadocs-core/source';
4
-
5
- export const { getPage, pageTree, getPages } = loader({
6
- baseUrl: '/docs',
7
- rootDir: 'docs',
8
- source: createContentlayerSource(allMeta, allDocs),
9
- });
@@ -1,4 +0,0 @@
1
- import { makeSource } from 'contentlayer/source-files';
2
- import { defaultConfig } from 'fumadocs-contentlayer/configuration';
3
-
4
- export default makeSource(defaultConfig);
@@ -1,8 +0,0 @@
1
- /** @type {import('next').NextConfig} */
2
- const config = {
3
- reactStrictMode: true,
4
- };
5
-
6
- const { withContentlayer } = require('next-contentlayer');
7
-
8
- module.exports = withContentlayer(config);