From 6c5a39a9c794760824fdabdf519832b37caa354e Mon Sep 17 00:00:00 2001 From: Fuma Nama Date: Sat, 27 Jan 2024 18:46:55 +0800 Subject: [PATCH] Chore: Rename Git repository to `fumadocs` --- .changeset/large-llamas-glow.md | 10 ++++++++++ apps/docs/app/(home)/docs/page.tsx | 2 +- apps/docs/app/(home)/showcase/page.tsx | 2 +- apps/docs/app/docs/[...slug]/page.tsx | 2 +- apps/docs/app/docs/layout.tsx | 2 +- apps/docs/app/layout.tsx | 2 +- apps/docs/components/preview/index.tsx | 2 +- .../docs/content/docs/headless/utils/git-last-edit.mdx | 2 +- apps/docs/content/docs/mdx/index.mdx | 4 ++-- apps/docs/content/docs/ui/math.mdx | 4 ++-- examples/next-mdx/next.config.mjs | 6 +++--- packages/contentlayer/package.json | 2 +- packages/core/package.json | 2 +- packages/core/src/server/git-api.ts | 2 +- packages/create-app/package.json | 2 +- packages/create-app/template/+content/README.md | 2 +- .../create-app/template/fuma-docs-mdx/next.config.mjs | 4 ++-- packages/mdx/package.json | 2 +- packages/mdx/src/config.ts | 10 ++++------ packages/mdx/src/loader-mdx.ts | 4 ++-- .../webpack-plugins/{next-docs.ts => map-plugin.ts} | 6 +++--- packages/openapi/package.json | 2 +- packages/ui/package.json | 2 +- 23 files changed, 43 insertions(+), 35 deletions(-) create mode 100644 .changeset/large-llamas-glow.md rename packages/mdx/src/webpack-plugins/{next-docs.ts => map-plugin.ts} (76%) diff --git a/.changeset/large-llamas-glow.md b/.changeset/large-llamas-glow.md new file mode 100644 index 000000000..240fc877c --- /dev/null +++ b/.changeset/large-llamas-glow.md @@ -0,0 +1,10 @@ +--- +'fumadocs-contentlayer': patch +'fumadocs-core': patch +'create-fumadocs-app': patch +'fumadocs-mdx': patch +'fumadocs-openapi': patch +'fumadocs-ui': patch +--- + +Rename Git repository to `fumadocs` diff --git a/apps/docs/app/(home)/docs/page.tsx b/apps/docs/app/(home)/docs/page.tsx index 7b0eb33e4..3d99b7fc5 100644 --- a/apps/docs/app/(home)/docs/page.tsx +++ b/apps/docs/app/(home)/docs/page.tsx @@ -33,7 +33,7 @@ export default function DocsPage(): JSX.Element {

diff --git a/apps/docs/app/(home)/showcase/page.tsx b/apps/docs/app/(home)/showcase/page.tsx index a5852fbc8..0601756f7 100644 --- a/apps/docs/app/(home)/showcase/page.tsx +++ b/apps/docs/app/(home)/showcase/page.tsx @@ -84,7 +84,7 @@ export default function Showcase(): JSX.Element {

= { ), children: , - githubUrl: 'https://github.com/fuma-nama/next-docs', + githubUrl: 'https://github.com/fuma-nama/fumadocs', }, sidebar: { defaultOpenLevel: 0, diff --git a/apps/docs/app/layout.tsx b/apps/docs/app/layout.tsx index c1652761a..04f80cf38 100644 --- a/apps/docs/app/layout.tsx +++ b/apps/docs/app/layout.tsx @@ -65,7 +65,7 @@ function Footer(): JSX.Element {
diff --git a/apps/docs/components/preview/index.tsx b/apps/docs/components/preview/index.tsx index 90cdfa841..119f4a978 100644 --- a/apps/docs/components/preview/index.tsx +++ b/apps/docs/components/preview/index.tsx @@ -95,7 +95,7 @@ export default { collapsible className="rounded-xl bg-background px-4" > - + A framework for building documentations diff --git a/apps/docs/content/docs/headless/utils/git-last-edit.mdx b/apps/docs/content/docs/headless/utils/git-last-edit.mdx index 7022b2e32..29382d9bd 100644 --- a/apps/docs/content/docs/headless/utils/git-last-edit.mdx +++ b/apps/docs/content/docs/headless/utils/git-last-edit.mdx @@ -13,7 +13,7 @@ import { resolve } from 'url'; const time = await getGithubLastEdit({ owner: 'fuma-nama', - repo: 'next-docs', + repo: 'fumadocs', // example: "content/docs/index.mdx" path: resolve('content/docs/', page.file.path), }); diff --git a/apps/docs/content/docs/mdx/index.mdx b/apps/docs/content/docs/mdx/index.mdx index b3d73c0ea..b2a1dc88b 100644 --- a/apps/docs/content/docs/mdx/index.mdx +++ b/apps/docs/content/docs/mdx/index.mdx @@ -124,7 +124,7 @@ export const blogs = loader({ You can customise the options passed to the MDX processor. ```js -const withNextDocs = createMDX({ +const withMDX = createMDX({ mdxOptions: { remarkPlugins: [remarkMath], // When order matters @@ -138,7 +138,7 @@ const withNextDocs = createMDX({ The built-in configuration applies a remark plugin that turns `vfile.data` properties into exports, you can define additional properties to be exported. ```js -const withNextDocs = createMDX({ +const withMDX = createMDX({ mdxOptions: { valueToExport: ['dataName'], }, diff --git a/apps/docs/content/docs/ui/math.mdx b/apps/docs/content/docs/ui/math.mdx index b2db0687f..2b1f2108d 100644 --- a/apps/docs/content/docs/ui/math.mdx +++ b/apps/docs/content/docs/ui/math.mdx @@ -21,11 +21,11 @@ Add the remark/rehype plugins you have installed above. The code might be vary depending on your content source, here is an example for Fumadocs MDX: ```ts -import createNextDocs from 'fumadocs-mdx/config'; +import createMDX from 'fumadocs-mdx/config'; import rehypeKatex from 'rehype-katex'; import remarkMath from 'remark-math'; -const withNextDocs = createNextDocs({ +const withMDX = createMDX({ mdxOptions: { remarkPlugins: [remarkMath], // Place it at first so that it won't be changed by rehype-pretty-code diff --git a/examples/next-mdx/next.config.mjs b/examples/next-mdx/next.config.mjs index 541efb1c2..3e44fbc31 100644 --- a/examples/next-mdx/next.config.mjs +++ b/examples/next-mdx/next.config.mjs @@ -1,10 +1,10 @@ -import createNextDocsMDX from 'fumadocs-mdx/config'; +import createMDX from 'fumadocs-mdx/config'; -const withFumaMDX = createNextDocsMDX(); +const withMDX = createMDX(); /** @type {import('next').NextConfig} */ const config = { reactStrictMode: true, }; -export default withFumaMDX(config); +export default withMDX(config); diff --git a/packages/contentlayer/package.json b/packages/contentlayer/package.json index 9fd838a7f..90b523491 100644 --- a/packages/contentlayer/package.json +++ b/packages/contentlayer/package.json @@ -7,7 +7,7 @@ "Docs" ], "homepage": "https://fumadocs.vercel.app", - "repository": "github:fuma-nama/next-docs", + "repository": "github:fuma-nama/fumadocs", "license": "MIT", "author": "Fuma Nama", "type": "module", diff --git a/packages/core/package.json b/packages/core/package.json index e2aa61ba7..24b3ab266 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -7,7 +7,7 @@ "Docs" ], "homepage": "https://fumadocs.vercel.app", - "repository": "github:fuma-nama/next-docs", + "repository": "github:fuma-nama/fumadocs", "license": "MIT", "author": "Fuma Nama", "type": "module", diff --git a/packages/core/src/server/git-api.ts b/packages/core/src/server/git-api.ts index 1e774afaf..e88f86329 100644 --- a/packages/core/src/server/git-api.ts +++ b/packages/core/src/server/git-api.ts @@ -8,7 +8,7 @@ type Response = { export interface GetGithubLastCommitOptions { /** - * Repository name, like "next-docs" + * Repository name, like "fumadocs" */ repo: string; diff --git a/packages/create-app/package.json b/packages/create-app/package.json index f4c0962a3..d8a79d80a 100644 --- a/packages/create-app/package.json +++ b/packages/create-app/package.json @@ -9,7 +9,7 @@ "Docs" ], "homepage": "https://fumadocs.vercel.app", - "repository": "github:fuma-nama/next-docs", + "repository": "github:fuma-nama/fumadocs", "license": "MIT", "author": "Fuma Nama", "type": "module", diff --git a/packages/create-app/template/+content/README.md b/packages/create-app/template/+content/README.md index bb7ff17cb..a7a7e87eb 100644 --- a/packages/create-app/template/+content/README.md +++ b/packages/create-app/template/+content/README.md @@ -1,5 +1,5 @@ This is a Next.js application generated with -[Create Fumadocs](https://github.com/fuma-nama/next-docs). +[Create Fumadocs](https://github.com/fuma-nama/fumadocs). Run development server: diff --git a/packages/create-app/template/fuma-docs-mdx/next.config.mjs b/packages/create-app/template/fuma-docs-mdx/next.config.mjs index 04c762908..3e44fbc31 100644 --- a/packages/create-app/template/fuma-docs-mdx/next.config.mjs +++ b/packages/create-app/template/fuma-docs-mdx/next.config.mjs @@ -1,6 +1,6 @@ -import createNextDocsMDX from 'fumadocs-mdx/config'; +import createMDX from 'fumadocs-mdx/config'; -const withMDX = createNextDocsMDX(); +const withMDX = createMDX(); /** @type {import('next').NextConfig} */ const config = { diff --git a/packages/mdx/package.json b/packages/mdx/package.json index a18f8ff49..2cee8d852 100644 --- a/packages/mdx/package.json +++ b/packages/mdx/package.json @@ -7,7 +7,7 @@ "Docs" ], "homepage": "https://fumadocs.vercel.app", - "repository": "github:fuma-nama/next-docs", + "repository": "github:fuma-nama/fumadocs", "license": "MIT", "author": "Fuma Nama", "exports": { diff --git a/packages/mdx/src/config.ts b/packages/mdx/src/config.ts index 951af1eb7..b1aecb9b7 100644 --- a/packages/mdx/src/config.ts +++ b/packages/mdx/src/config.ts @@ -11,7 +11,7 @@ import { } from 'fumadocs-core/mdx-plugins'; import type { PluggableList } from 'unified'; import type { Configuration } from 'webpack'; -import { NextDocsWebpackPlugin } from './webpack-plugins/next-docs'; +import { MapWebpackPlugin } from './webpack-plugins/map-plugin'; import remarkMdxExport from './mdx-plugins/remark-exports'; import type { LoaderOptions } from './loader'; import type { Options as MDXLoaderOptions } from './loader-mdx'; @@ -34,7 +34,7 @@ type MDXOptions = Omit< type ResolvePlugins = PluggableList | ((v: PluggableList) => PluggableList); -interface NextDocsMDXOptions { +export interface CreateMDXOptions { cwd?: string; mdxOptions?: MDXOptions; @@ -73,7 +73,7 @@ const createMDX = cwd = process.cwd(), rootMapPath = './.map.ts', rootContentPath = './content', - }: NextDocsMDXOptions = {}) => + }: CreateMDXOptions = {}) => (nextConfig: NextConfig = {}) => { const valueToExport = [ 'structuredData', @@ -149,9 +149,7 @@ const createMDX = config.plugins ||= []; - config.plugins.push( - new NextDocsWebpackPlugin({ rootMapFile: _mapPath }), - ); + config.plugins.push(new MapWebpackPlugin({ rootMapFile: _mapPath })); // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- not provided return nextConfig.webpack?.(config, options) ?? config; diff --git a/packages/mdx/src/loader-mdx.ts b/packages/mdx/src/loader-mdx.ts index e20b736d7..09c34bb8f 100644 --- a/packages/mdx/src/loader-mdx.ts +++ b/packages/mdx/src/loader-mdx.ts @@ -13,7 +13,7 @@ export interface Options extends ProcessorOptions { lastModifiedTime?: 'git' | 'none'; } -export interface NextDocsBuildInfo { +interface InternalBuildInfo { __next_docs?: { path: string; /** @@ -69,7 +69,7 @@ export default async function loader( }) .then( (file) => { - const info = this._module?.buildInfo as NextDocsBuildInfo; + const info = this._module?.buildInfo as InternalBuildInfo; info.__next_docs = { path: filePath, diff --git a/packages/mdx/src/webpack-plugins/next-docs.ts b/packages/mdx/src/webpack-plugins/map-plugin.ts similarity index 76% rename from packages/mdx/src/webpack-plugins/next-docs.ts rename to packages/mdx/src/webpack-plugins/map-plugin.ts index 856f6b958..2ea0e4a2d 100644 --- a/packages/mdx/src/webpack-plugins/next-docs.ts +++ b/packages/mdx/src/webpack-plugins/map-plugin.ts @@ -14,7 +14,7 @@ declare const map: Record export { map } `.trim(); -export class NextDocsWebpackPlugin { +export class MapWebpackPlugin { options: Options; constructor(options: Options) { @@ -22,9 +22,9 @@ export class NextDocsWebpackPlugin { } apply(compiler: Compiler): void { - const logger = compiler.getInfrastructureLogger(NextDocsWebpackPlugin.name); + const logger = compiler.getInfrastructureLogger(MapWebpackPlugin.name); - compiler.hooks.beforeCompile.tap(NextDocsWebpackPlugin.name, () => { + compiler.hooks.beforeCompile.tap(MapWebpackPlugin.name, () => { if (firstLoad && !fs.existsSync(this.options.rootMapFile)) { fs.writeFileSync(this.options.rootMapFile, content); logger.info('Created map.ts file for you automatically'); diff --git a/packages/openapi/package.json b/packages/openapi/package.json index 6d6d9d6e6..a82896102 100644 --- a/packages/openapi/package.json +++ b/packages/openapi/package.json @@ -7,7 +7,7 @@ "Docs" ], "homepage": "https://fumadocs.vercel.app", - "repository": "github:fuma-nama/next-docs", + "repository": "github:fuma-nama/fumadocs", "license": "MIT", "author": "Fuma Nama", "type": "module", diff --git a/packages/ui/package.json b/packages/ui/package.json index 5ab7c59da..9a1c941ca 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -7,7 +7,7 @@ "Docs" ], "homepage": "https://fumadocs.vercel.app", - "repository": "github:fuma-nama/next-docs", + "repository": "github:fuma-nama/fumadocs", "license": "MIT", "author": "Fuma Nama", "exports": {