create-fumadocs-app 16.0.34 → 16.0.36
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.
- package/dist/bin.js +3 -3
- package/dist/bin.js.map +1 -1
- package/dist/constants-BA0tQvAa.js +1007 -0
- package/dist/constants-BA0tQvAa.js.map +1 -0
- package/dist/{index-CC4EFQ5p.d.ts → index-CulTgtuF.d.ts} +2 -2
- package/dist/{index-CC4EFQ5p.d.ts.map → index-CulTgtuF.d.ts.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/plugins/biome.d.ts +1 -1
- package/dist/plugins/biome.js +2 -2
- package/dist/plugins/biome.js.map +1 -1
- package/dist/plugins/eslint.d.ts +1 -1
- package/dist/plugins/eslint.js +3 -3
- package/dist/plugins/eslint.js.map +1 -1
- package/dist/plugins/next-use-src.d.ts +1 -1
- package/dist/plugins/next-use-src.js +3 -3
- package/dist/plugins/next-use-src.js.map +1 -1
- package/dist/plugins/orama-cloud.d.ts +1 -1
- package/dist/plugins/orama-cloud.js +2 -1
- package/dist/plugins/orama-cloud.js.map +1 -1
- package/dist/{src-DWqRvlfn.js → src-Cnh1wY20.js} +2 -2
- package/dist/{src-DWqRvlfn.js.map → src-Cnh1wY20.js.map} +1 -1
- package/package.json +2 -2
- package/template/+next+fuma-docs-mdx/package.json +1 -1
- package/template/+next+fuma-docs-mdx+static/README.md +45 -0
- package/template/+next+fuma-docs-mdx+static/app/(home)/layout.tsx +6 -0
- package/template/+next+fuma-docs-mdx+static/app/(home)/page.tsx +16 -0
- package/template/+next+fuma-docs-mdx+static/app/api/search/route.ts +9 -0
- package/template/+next+fuma-docs-mdx+static/app/docs/[[...slug]]/page.tsx +47 -0
- package/template/+next+fuma-docs-mdx+static/app/docs/layout.tsx +11 -0
- package/template/+next+fuma-docs-mdx+static/app/global.css +3 -0
- package/template/+next+fuma-docs-mdx+static/app/layout.tsx +17 -0
- package/template/+next+fuma-docs-mdx+static/app/llms-full.txt/route.ts +10 -0
- package/template/+next+fuma-docs-mdx+static/app/og/docs/[...slug]/route.tsx +27 -0
- package/template/+next+fuma-docs-mdx+static/components/provider.tsx +8 -0
- package/template/+next+fuma-docs-mdx+static/components/search.tsx +46 -0
- package/template/+next+fuma-docs-mdx+static/content/docs/index.mdx +13 -0
- package/template/+next+fuma-docs-mdx+static/content/docs/test.mdx +17 -0
- package/template/+next+fuma-docs-mdx+static/example.gitignore +26 -0
- package/template/+next+fuma-docs-mdx+static/lib/layout.shared.tsx +9 -0
- package/template/+next+fuma-docs-mdx+static/lib/source.ts +26 -0
- package/template/+next+fuma-docs-mdx+static/mdx-components.tsx +9 -0
- package/template/+next+fuma-docs-mdx+static/next.config.mjs +11 -0
- package/template/+next+fuma-docs-mdx+static/package.json +32 -0
- package/template/+next+fuma-docs-mdx+static/postcss.config.mjs +5 -0
- package/template/+next+fuma-docs-mdx+static/source.config.ts +22 -0
- package/template/+next+fuma-docs-mdx+static/tsconfig.json +36 -0
- package/template/react-router/package.json +1 -1
- package/template/react-router-spa/package.json +1 -1
- package/template/tanstack-start/package.json +3 -4
- package/template/tanstack-start/vite.config.ts +0 -4
- package/template/tanstack-start-spa/package.json +4 -4
- package/template/waku/package.json +3 -1
- package/template/waku/src/lib/source.ts +2 -0
- package/dist/constants-CReWPhck.js +0 -150
- package/dist/constants-CReWPhck.js.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
SearchDialog,
|
|
4
|
+
SearchDialogClose,
|
|
5
|
+
SearchDialogContent,
|
|
6
|
+
SearchDialogHeader,
|
|
7
|
+
SearchDialogIcon,
|
|
8
|
+
SearchDialogInput,
|
|
9
|
+
SearchDialogList,
|
|
10
|
+
SearchDialogOverlay,
|
|
11
|
+
type SharedProps,
|
|
12
|
+
} from 'fumadocs-ui/components/dialog/search';
|
|
13
|
+
import { useDocsSearch } from 'fumadocs-core/search/client';
|
|
14
|
+
import { create } from '@orama/orama';
|
|
15
|
+
import { useI18n } from 'fumadocs-ui/contexts/i18n';
|
|
16
|
+
|
|
17
|
+
function initOrama() {
|
|
18
|
+
return create({
|
|
19
|
+
schema: { _: 'string' },
|
|
20
|
+
// https://docs.orama.com/docs/orama-js/supported-languages
|
|
21
|
+
language: 'english',
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function DefaultSearchDialog(props: SharedProps) {
|
|
26
|
+
const { locale } = useI18n(); // (optional) for i18n
|
|
27
|
+
const { search, setSearch, query } = useDocsSearch({
|
|
28
|
+
type: 'static',
|
|
29
|
+
initOrama,
|
|
30
|
+
locale,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<SearchDialog search={search} onSearchChange={setSearch} isLoading={query.isLoading} {...props}>
|
|
35
|
+
<SearchDialogOverlay />
|
|
36
|
+
<SearchDialogContent>
|
|
37
|
+
<SearchDialogHeader>
|
|
38
|
+
<SearchDialogIcon />
|
|
39
|
+
<SearchDialogInput />
|
|
40
|
+
<SearchDialogClose />
|
|
41
|
+
</SearchDialogHeader>
|
|
42
|
+
<SearchDialogList items={query.data !== 'empty' ? query.data : null} />
|
|
43
|
+
</SearchDialogContent>
|
|
44
|
+
</SearchDialog>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hello World
|
|
3
|
+
description: Your first document
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Welcome to the docs! You can start writing documents in `/content/docs`.
|
|
7
|
+
|
|
8
|
+
## What is Next?
|
|
9
|
+
|
|
10
|
+
<Cards>
|
|
11
|
+
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
|
|
12
|
+
<Card title="Learn more about Fumadocs" href="https://fumadocs.dev" />
|
|
13
|
+
</Cards>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Components
|
|
3
|
+
description: Components
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Code Block
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
console.log('Hello World');
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Cards
|
|
13
|
+
|
|
14
|
+
<Cards>
|
|
15
|
+
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
|
|
16
|
+
<Card title="Learn more about Fumadocs" href="https://fumadocs.dev" />
|
|
17
|
+
</Cards>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# deps
|
|
2
|
+
/node_modules
|
|
3
|
+
|
|
4
|
+
# generated content
|
|
5
|
+
.source
|
|
6
|
+
|
|
7
|
+
# test & build
|
|
8
|
+
/coverage
|
|
9
|
+
/.next/
|
|
10
|
+
/out/
|
|
11
|
+
/build
|
|
12
|
+
*.tsbuildinfo
|
|
13
|
+
|
|
14
|
+
# misc
|
|
15
|
+
.DS_Store
|
|
16
|
+
*.pem
|
|
17
|
+
/.pnp
|
|
18
|
+
.pnp.js
|
|
19
|
+
npm-debug.log*
|
|
20
|
+
yarn-debug.log*
|
|
21
|
+
yarn-error.log*
|
|
22
|
+
|
|
23
|
+
# others
|
|
24
|
+
.env*.local
|
|
25
|
+
.vercel
|
|
26
|
+
next-env.d.ts
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { docs } from 'fumadocs-mdx:collections/server';
|
|
2
|
+
import { type InferPageType, loader } from 'fumadocs-core/source';
|
|
3
|
+
|
|
4
|
+
// See https://fumadocs.dev/docs/headless/source-api for more info
|
|
5
|
+
export const source = loader({
|
|
6
|
+
baseUrl: '/docs',
|
|
7
|
+
source: docs.toFumadocsSource(),
|
|
8
|
+
plugins: [],
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export function getPageImage(page: InferPageType<typeof source>) {
|
|
12
|
+
const segments = [...page.slugs, 'image.png'];
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
segments,
|
|
16
|
+
url: `/og/docs/${segments.join('/')}`,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function getLLMText(page: InferPageType<typeof source>) {
|
|
21
|
+
const processed = await page.data.getText('processed');
|
|
22
|
+
|
|
23
|
+
return `# ${page.data.title}
|
|
24
|
+
|
|
25
|
+
${processed}`;
|
|
26
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example-next-static",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "next build",
|
|
7
|
+
"dev": "next dev",
|
|
8
|
+
"start": "serve out",
|
|
9
|
+
"types:check": "fumadocs-mdx && next typegen && tsc --noEmit"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@orama/orama": "^3.1.18",
|
|
13
|
+
"fumadocs-core": "workspace:*",
|
|
14
|
+
"fumadocs-mdx": "workspace:*",
|
|
15
|
+
"fumadocs-ui": "workspace:*",
|
|
16
|
+
"lucide-react": "^0.562.0",
|
|
17
|
+
"next": "16.1.1",
|
|
18
|
+
"react": "^19.2.3",
|
|
19
|
+
"react-dom": "^19.2.3"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@tailwindcss/postcss": "^4.1.18",
|
|
23
|
+
"@types/mdx": "^2.0.13",
|
|
24
|
+
"@types/node": "^24.10.2",
|
|
25
|
+
"@types/react": "^19.2.7",
|
|
26
|
+
"@types/react-dom": "^19.2.3",
|
|
27
|
+
"postcss": "^8.5.6",
|
|
28
|
+
"serve": "^14.2.5",
|
|
29
|
+
"tailwindcss": "^4.1.18",
|
|
30
|
+
"typescript": "^5.9.3"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineConfig, defineDocs, frontmatterSchema, metaSchema } from 'fumadocs-mdx/config';
|
|
2
|
+
|
|
3
|
+
// You can customise Zod schemas for frontmatter and `meta.json` here
|
|
4
|
+
// see https://fumadocs.dev/docs/mdx/collections
|
|
5
|
+
export const docs = defineDocs({
|
|
6
|
+
dir: 'content/docs',
|
|
7
|
+
docs: {
|
|
8
|
+
schema: frontmatterSchema,
|
|
9
|
+
postprocess: {
|
|
10
|
+
includeProcessedMarkdown: true,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
meta: {
|
|
14
|
+
schema: metaSchema,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
mdxOptions: {
|
|
20
|
+
// MDX options
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
6
|
+
"allowJs": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"module": "esnext",
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
"incremental": true,
|
|
18
|
+
"paths": {
|
|
19
|
+
"@/*": ["./*"],
|
|
20
|
+
"fumadocs-mdx:collections/*": [".source/*"]
|
|
21
|
+
},
|
|
22
|
+
"plugins": [
|
|
23
|
+
{
|
|
24
|
+
"name": "next"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"include": [
|
|
29
|
+
"next-env.d.ts",
|
|
30
|
+
"**/*.ts",
|
|
31
|
+
"**/*.tsx",
|
|
32
|
+
".next/types/**/*.ts",
|
|
33
|
+
".next/dev/types/**/*.ts"
|
|
34
|
+
],
|
|
35
|
+
"exclude": ["node_modules"]
|
|
36
|
+
}
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"types:check": "fumadocs-mdx && tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@tanstack/react-router": "1.
|
|
14
|
-
"@tanstack/react-router-devtools": "1.
|
|
15
|
-
"@tanstack/react-start": "1.
|
|
13
|
+
"@tanstack/react-router": "1.144.0",
|
|
14
|
+
"@tanstack/react-router-devtools": "1.144.0",
|
|
15
|
+
"@tanstack/react-start": "1.145.3",
|
|
16
16
|
"fumadocs-core": "workspace:*",
|
|
17
17
|
"fumadocs-mdx": "workspace:*",
|
|
18
18
|
"fumadocs-ui": "workspace:*",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"@types/react": "^19.2.7",
|
|
30
30
|
"@types/react-dom": "^19.2.3",
|
|
31
31
|
"@vitejs/plugin-react": "^5.1.2",
|
|
32
|
-
"nitro": "3.0.1-alpha.1",
|
|
33
32
|
"tailwindcss": "^4.1.18",
|
|
34
33
|
"typescript": "^5.9.3",
|
|
35
34
|
"vite-tsconfig-paths": "^6.0.3"
|
|
@@ -4,7 +4,6 @@ import { defineConfig } from 'vite';
|
|
|
4
4
|
import tsConfigPaths from 'vite-tsconfig-paths';
|
|
5
5
|
import tailwindcss from '@tailwindcss/vite';
|
|
6
6
|
import mdx from 'fumadocs-mdx/vite';
|
|
7
|
-
import { nitro } from 'nitro/vite';
|
|
8
7
|
|
|
9
8
|
export default defineConfig({
|
|
10
9
|
server: {
|
|
@@ -22,8 +21,5 @@ export default defineConfig({
|
|
|
22
21
|
},
|
|
23
22
|
}),
|
|
24
23
|
react(),
|
|
25
|
-
// see https://tanstack.com/start/latest/docs/framework/react/guide/hosting for hosting config
|
|
26
|
-
// we configured nitro by default
|
|
27
|
-
nitro(),
|
|
28
24
|
],
|
|
29
25
|
});
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@orama/orama": "^3.1.18",
|
|
14
|
-
"@tanstack/react-router": "1.
|
|
15
|
-
"@tanstack/react-router-devtools": "1.
|
|
16
|
-
"@tanstack/react-start": "1.
|
|
17
|
-
"@tanstack/start-static-server-functions": "1.
|
|
14
|
+
"@tanstack/react-router": "1.144.0",
|
|
15
|
+
"@tanstack/react-router-devtools": "1.144.0",
|
|
16
|
+
"@tanstack/react-start": "1.145.3",
|
|
17
|
+
"@tanstack/start-static-server-functions": "1.145.3",
|
|
18
18
|
"fumadocs-core": "workspace:*",
|
|
19
19
|
"fumadocs-mdx": "workspace:*",
|
|
20
20
|
"fumadocs-ui": "workspace:*",
|
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
"types:check": "fumadocs-mdx && tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"@fumadocs/ui": "workspace:*",
|
|
13
14
|
"fumadocs-core": "workspace:*",
|
|
14
15
|
"fumadocs-mdx": "workspace:*",
|
|
15
16
|
"fumadocs-ui": "workspace:*",
|
|
17
|
+
"lucide-react": "^0.562.0",
|
|
16
18
|
"react": "^19.2.3",
|
|
17
19
|
"react-dom": "^19.2.3",
|
|
18
20
|
"react-server-dom-webpack": "^19.2.3",
|
|
19
|
-
"waku": "
|
|
21
|
+
"waku": "1.0.0-alpha.0"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
24
|
"@tailwindcss/vite": "^4.1.18",
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { loader } from 'fumadocs-core/source';
|
|
2
|
+
import { lucideIconsPlugin } from 'fumadocs-core/source/lucide-icons';
|
|
2
3
|
import { docs } from 'fumadocs-mdx:collections/server';
|
|
3
4
|
|
|
4
5
|
export const source = loader({
|
|
5
6
|
source: docs.toFumadocsSource(),
|
|
6
7
|
baseUrl: '/docs',
|
|
8
|
+
plugins: [lucideIconsPlugin()],
|
|
7
9
|
});
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import path, { join } from "node:path";
|
|
3
|
-
import { x } from "tinyexec";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
|
|
6
|
-
//#region src/utils.ts
|
|
7
|
-
async function writeFile(file, content) {
|
|
8
|
-
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
9
|
-
await fs.writeFile(file, content);
|
|
10
|
-
}
|
|
11
|
-
async function copy(from, to, options = {}) {
|
|
12
|
-
const { rename = (s) => s, filterDir = () => true, filter = () => true } = options;
|
|
13
|
-
const stats = await fs.stat(from);
|
|
14
|
-
if (stats.isDirectory() && filterDir(from)) {
|
|
15
|
-
const files = await fs.readdir(from);
|
|
16
|
-
await Promise.all(files.map((file) => copy(path.join(from, file), path.join(to, file), options)));
|
|
17
|
-
}
|
|
18
|
-
if (stats.isFile() && filter(from)) {
|
|
19
|
-
to = rename(to);
|
|
20
|
-
await fs.mkdir(path.dirname(to), { recursive: true });
|
|
21
|
-
await fs.copyFile(from, to);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
async function isInGitRepository(cwd) {
|
|
25
|
-
const { exitCode } = await x("git", ["rev-parse", "--is-inside-work-tree"], { nodeOptions: { cwd } });
|
|
26
|
-
return exitCode === 0;
|
|
27
|
-
}
|
|
28
|
-
async function isDefaultBranchSet(cwd) {
|
|
29
|
-
const { exitCode } = await x("git", ["config", "init.defaultBranch"], { nodeOptions: { cwd } });
|
|
30
|
-
return exitCode === 0;
|
|
31
|
-
}
|
|
32
|
-
async function tryGitInit(cwd) {
|
|
33
|
-
const { exitCode } = await x("git", ["--version"]);
|
|
34
|
-
if (exitCode !== 0) return false;
|
|
35
|
-
if (await isInGitRepository(cwd)) return false;
|
|
36
|
-
try {
|
|
37
|
-
await x("git", ["init"], {
|
|
38
|
-
throwOnError: true,
|
|
39
|
-
nodeOptions: { cwd }
|
|
40
|
-
});
|
|
41
|
-
if (!await isDefaultBranchSet(cwd)) await x("git", [
|
|
42
|
-
"checkout",
|
|
43
|
-
"-b",
|
|
44
|
-
"main"
|
|
45
|
-
], {
|
|
46
|
-
throwOnError: true,
|
|
47
|
-
nodeOptions: { cwd }
|
|
48
|
-
});
|
|
49
|
-
await x("git", ["add", "-A"], {
|
|
50
|
-
throwOnError: true,
|
|
51
|
-
nodeOptions: { cwd }
|
|
52
|
-
});
|
|
53
|
-
await x("git", [
|
|
54
|
-
"commit",
|
|
55
|
-
"-m",
|
|
56
|
-
"Initial commit from Create Fumadocs App"
|
|
57
|
-
], {
|
|
58
|
-
throwOnError: true,
|
|
59
|
-
nodeOptions: { cwd }
|
|
60
|
-
});
|
|
61
|
-
return true;
|
|
62
|
-
} catch {
|
|
63
|
-
await fs.rmdir(join(cwd, ".git"), { recursive: true }).catch(() => null);
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function pick(obj, keys) {
|
|
68
|
-
const result = {};
|
|
69
|
-
for (const key of keys) if (key in obj) result[key] = obj[key];
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
//#endregion
|
|
74
|
-
//#region ../create-app-versions/package.json
|
|
75
|
-
var dependencies = {
|
|
76
|
-
"@biomejs/biome": "^2.3.10",
|
|
77
|
-
"@orama/core": "^1.2.15",
|
|
78
|
-
"eslint": "^9.39.2",
|
|
79
|
-
"fumadocs-core": "workspace:*",
|
|
80
|
-
"fumadocs-mdx": "workspace:*",
|
|
81
|
-
"fumadocs-ui": "workspace:*"
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
//#endregion
|
|
85
|
-
//#region ../core/package.json
|
|
86
|
-
var version$2 = "16.4.2";
|
|
87
|
-
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region ../ui/package.json
|
|
90
|
-
var version$1 = "16.4.2";
|
|
91
|
-
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region ../mdx/package.json
|
|
94
|
-
var version = "14.2.4";
|
|
95
|
-
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region src/constants.ts
|
|
98
|
-
const sourceDir = fileURLToPath(new URL(`../`, import.meta.url).href);
|
|
99
|
-
const isCI = Boolean(process.env.CI);
|
|
100
|
-
const templates = [
|
|
101
|
-
{
|
|
102
|
-
value: "+next+fuma-docs-mdx",
|
|
103
|
-
label: "Next.js: Fumadocs MDX",
|
|
104
|
-
hint: "recommended",
|
|
105
|
-
appDir: "",
|
|
106
|
-
rootProviderPath: "app/layout.tsx"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
value: "waku",
|
|
110
|
-
label: "Waku: Fumadocs MDX",
|
|
111
|
-
appDir: "src",
|
|
112
|
-
rootProviderPath: "components/provider.tsx"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
value: "react-router",
|
|
116
|
-
label: "React Router: Fumadocs MDX (not RSC)",
|
|
117
|
-
appDir: "app",
|
|
118
|
-
rootProviderPath: "root.tsx"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
value: "react-router-spa",
|
|
122
|
-
label: "React Router SPA: Fumadocs MDX (not RSC)",
|
|
123
|
-
hint: "SPA mode allows you to host the site statically, compatible with a CDN.",
|
|
124
|
-
appDir: "app",
|
|
125
|
-
rootProviderPath: "root.tsx"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
value: "tanstack-start",
|
|
129
|
-
label: "Tanstack Start: Fumadocs MDX (not RSC)",
|
|
130
|
-
appDir: "src",
|
|
131
|
-
rootProviderPath: "routes/__root.tsx"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
value: "tanstack-start-spa",
|
|
135
|
-
label: "Tanstack Start SPA: Fumadocs MDX (not RSC)",
|
|
136
|
-
hint: "SPA mode allows you to host the site statically, compatible with a CDN.",
|
|
137
|
-
appDir: "src",
|
|
138
|
-
rootProviderPath: "routes/__root.tsx"
|
|
139
|
-
}
|
|
140
|
-
];
|
|
141
|
-
const depVersions = {
|
|
142
|
-
...dependencies,
|
|
143
|
-
"fumadocs-core": version$2,
|
|
144
|
-
"fumadocs-ui": version$1,
|
|
145
|
-
"fumadocs-mdx": version
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
//#endregion
|
|
149
|
-
export { copy as a, writeFile as c, templates as i, isCI as n, pick as o, sourceDir as r, tryGitInit as s, depVersions as t };
|
|
150
|
-
//# sourceMappingURL=constants-CReWPhck.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants-CReWPhck.js","names":["result: Partial<T>","templates: TemplateInfo[]","versionPkg.dependencies","coreVersion","uiVersion","mdxVersion"],"sources":["../src/utils.ts","../../create-app-versions/package.json","../../core/package.json","../../ui/package.json","../../mdx/package.json","../src/constants.ts"],"sourcesContent":["import fs from 'node:fs/promises';\nimport path, { join } from 'node:path';\nimport { x } from 'tinyexec';\n\nexport async function writeFile(file: string, content: string) {\n await fs.mkdir(path.dirname(file), { recursive: true });\n await fs.writeFile(file, content);\n}\n\nexport async function copy(\n from: string,\n to: string,\n options: {\n rename?: (s: string) => string;\n filter?: (s: string) => boolean;\n filterDir?: (dir: string) => boolean;\n } = {},\n): Promise<void> {\n const { rename = (s) => s, filterDir = () => true, filter = () => true } = options;\n const stats = await fs.stat(from);\n\n if (stats.isDirectory() && filterDir(from)) {\n const files = await fs.readdir(from);\n\n await Promise.all(\n files.map((file) => copy(path.join(from, file), path.join(to, file), options)),\n );\n }\n\n if (stats.isFile() && filter(from)) {\n to = rename(to);\n await fs.mkdir(path.dirname(to), { recursive: true });\n await fs.copyFile(from, to);\n }\n}\n\nasync function isInGitRepository(cwd: string) {\n const { exitCode } = await x('git', ['rev-parse', '--is-inside-work-tree'], {\n nodeOptions: { cwd },\n });\n\n return exitCode === 0;\n}\n\nasync function isDefaultBranchSet(cwd: string) {\n const { exitCode } = await x('git', ['config', 'init.defaultBranch'], {\n nodeOptions: { cwd },\n });\n\n return exitCode === 0;\n}\n\n/*\nInitialize a Git repo on the project.\n\nBased on https://github.com/vercel/next.js/blob/canary/packages/create-next-app/helpers/git.ts\n*/\nexport async function tryGitInit(cwd: string): Promise<boolean> {\n const { exitCode } = await x('git', ['--version']);\n if (exitCode !== 0) return false;\n\n if (await isInGitRepository(cwd)) return false;\n\n try {\n await x('git', ['init'], {\n throwOnError: true,\n nodeOptions: { cwd },\n });\n\n if (!(await isDefaultBranchSet(cwd))) {\n await x('git', ['checkout', '-b', 'main'], {\n throwOnError: true,\n nodeOptions: {\n cwd,\n },\n });\n }\n\n await x('git', ['add', '-A'], {\n throwOnError: true,\n nodeOptions: {\n cwd,\n },\n });\n\n await x('git', ['commit', '-m', 'Initial commit from Create Fumadocs App'], {\n throwOnError: true,\n nodeOptions: {\n cwd,\n },\n });\n return true;\n } catch {\n await fs.rmdir(join(cwd, '.git'), { recursive: true }).catch(() => null);\n\n return false;\n }\n}\n\nexport function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result: Partial<T> = {};\n\n for (const key of keys) {\n if (key in obj) {\n result[key] = obj[key];\n }\n }\n\n return result as Pick<T, K>;\n}\n","","","","","import { fileURLToPath } from 'node:url';\nimport versionPkg from '../../create-app-versions/package.json';\nimport { version as coreVersion } from '../../core/package.json';\nimport { version as uiVersion } from '../../ui/package.json';\nimport { version as mdxVersion } from '../../mdx/package.json';\n\nexport const sourceDir = fileURLToPath(new URL(`../`, import.meta.url).href);\n\nexport const isCI = Boolean(process.env.CI);\n\nexport interface TemplateInfo {\n value:\n | '+next+fuma-docs-mdx'\n | 'waku'\n | 'react-router'\n | 'react-router-spa'\n | 'tanstack-start'\n | 'tanstack-start-spa';\n label: string;\n appDir: string;\n /**\n * path to root provider, relative to `appDir``\n */\n rootProviderPath: string;\n hint?: string;\n /**\n * rename files when copying from template\n */\n rename?: (name: string) => string;\n}\n\nexport const templates: TemplateInfo[] = [\n {\n value: '+next+fuma-docs-mdx',\n label: 'Next.js: Fumadocs MDX',\n hint: 'recommended',\n appDir: '',\n rootProviderPath: 'app/layout.tsx',\n },\n {\n value: 'waku',\n label: 'Waku: Fumadocs MDX',\n appDir: 'src',\n rootProviderPath: 'components/provider.tsx',\n },\n {\n value: 'react-router',\n label: 'React Router: Fumadocs MDX (not RSC)',\n appDir: 'app',\n rootProviderPath: 'root.tsx',\n },\n {\n value: 'react-router-spa',\n label: 'React Router SPA: Fumadocs MDX (not RSC)',\n hint: 'SPA mode allows you to host the site statically, compatible with a CDN.',\n appDir: 'app',\n rootProviderPath: 'root.tsx',\n },\n {\n value: 'tanstack-start',\n label: 'Tanstack Start: Fumadocs MDX (not RSC)',\n appDir: 'src',\n rootProviderPath: 'routes/__root.tsx',\n },\n {\n value: 'tanstack-start-spa',\n label: 'Tanstack Start SPA: Fumadocs MDX (not RSC)',\n hint: 'SPA mode allows you to host the site statically, compatible with a CDN.',\n appDir: 'src',\n rootProviderPath: 'routes/__root.tsx',\n },\n];\n\nexport const depVersions = {\n ...versionPkg.dependencies,\n 'fumadocs-core': coreVersion,\n 'fumadocs-ui': uiVersion,\n 'fumadocs-mdx': mdxVersion,\n};\n"],"mappings":";;;;;;AAIA,eAAsB,UAAU,MAAc,SAAiB;AAC7D,OAAM,GAAG,MAAM,KAAK,QAAQ,KAAK,EAAE,EAAE,WAAW,MAAM,CAAC;AACvD,OAAM,GAAG,UAAU,MAAM,QAAQ;;AAGnC,eAAsB,KACpB,MACA,IACA,UAII,EAAE,EACS;CACf,MAAM,EAAE,UAAU,MAAM,GAAG,kBAAkB,MAAM,eAAe,SAAS;CAC3E,MAAM,QAAQ,MAAM,GAAG,KAAK,KAAK;AAEjC,KAAI,MAAM,aAAa,IAAI,UAAU,KAAK,EAAE;EAC1C,MAAM,QAAQ,MAAM,GAAG,QAAQ,KAAK;AAEpC,QAAM,QAAQ,IACZ,MAAM,KAAK,SAAS,KAAK,KAAK,KAAK,MAAM,KAAK,EAAE,KAAK,KAAK,IAAI,KAAK,EAAE,QAAQ,CAAC,CAC/E;;AAGH,KAAI,MAAM,QAAQ,IAAI,OAAO,KA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