|
1 | 1 | import path from "node:path"; |
2 | | -import { isCancel, log, select, spinner } from "@clack/prompts"; |
| 2 | +import { log } from "@clack/prompts"; |
3 | 3 | import consola from "consola"; |
4 | 4 | import { execa } from "execa"; |
5 | 5 | import fs from "fs-extra"; |
6 | 6 | import pc from "picocolors"; |
7 | 7 | import type { ProjectConfig } from "../../types"; |
8 | | -import { exitCancelled } from "../../utils/errors"; |
9 | 8 | import { getPackageExecutionCommand } from "../../utils/package-runner"; |
10 | 9 |
|
11 | | -type FumadocsTemplate = |
12 | | - | "next-mdx" |
13 | | - | "next-content-collections" |
14 | | - | "react-router-mdx-remote" |
15 | | - | "tanstack-start-mdx-remote"; |
16 | | - |
17 | | -const TEMPLATES = { |
18 | | - "next-mdx": { |
19 | | - label: "Next.js: Fumadocs MDX", |
20 | | - hint: "Recommended template with MDX support", |
21 | | - value: "+next+fuma-docs-mdx", |
22 | | - }, |
23 | | - "next-content-collections": { |
24 | | - label: "Next.js: Content Collections", |
25 | | - hint: "Template using Next.js content collections", |
26 | | - value: "+next+content-collections", |
27 | | - }, |
28 | | - "react-router-mdx-remote": { |
29 | | - label: "React Router: MDX Remote", |
30 | | - hint: "Template for React Router with MDX remote", |
31 | | - value: "react-router", |
32 | | - }, |
33 | | - "tanstack-start-mdx-remote": { |
34 | | - label: "Tanstack Start: MDX Remote", |
35 | | - hint: "Template for Tanstack Start with MDX remote", |
36 | | - value: "tanstack-start", |
37 | | - }, |
38 | | -} as const; |
39 | | - |
40 | 10 | export async function setupFumadocs(config: ProjectConfig) { |
41 | 11 | const { packageManager, projectDir } = config; |
42 | 12 |
|
43 | 13 | try { |
44 | 14 | log.info("Setting up Fumadocs..."); |
45 | 15 |
|
46 | | - const template = await select<FumadocsTemplate>({ |
47 | | - message: "Choose a template", |
48 | | - options: Object.entries(TEMPLATES).map(([key, template]) => ({ |
49 | | - value: key as FumadocsTemplate, |
50 | | - label: template.label, |
51 | | - hint: template.hint, |
52 | | - })), |
53 | | - initialValue: "next-mdx", |
54 | | - }); |
55 | | - |
56 | | - if (isCancel(template)) return exitCancelled("Operation cancelled"); |
57 | | - |
58 | | - const templateArg = TEMPLATES[template].value; |
59 | | - |
60 | | - const commandWithArgs = `create-fumadocs-app@latest fumadocs --template ${templateArg} --src --no-install --pm ${packageManager} --no-eslint --no-git`; |
| 16 | + const commandWithArgs = `create-fumadocs-app@latest fumadocs --src --no-install --pm ${packageManager} --no-eslint --no-biome --no-git`; |
61 | 17 |
|
62 | 18 | const fumadocsInitCommand = getPackageExecutionCommand( |
63 | 19 | packageManager, |
64 | 20 | commandWithArgs, |
65 | 21 | ); |
66 | 22 |
|
67 | | - const s = spinner(); |
68 | | - s.start("Setting up Fumadocs..."); |
69 | | - |
70 | 23 | const appsDir = path.join(projectDir, "apps"); |
71 | 24 | await fs.ensureDir(appsDir); |
72 | 25 |
|
73 | 26 | await execa(fumadocsInitCommand, { |
74 | 27 | cwd: appsDir, |
75 | 28 | env: { CI: "true" }, |
76 | 29 | shell: true, |
| 30 | + stdio: "inherit", |
77 | 31 | }); |
78 | 32 |
|
79 | | - s.stop("Fumadocs setup complete!"); |
80 | | - |
81 | 33 | const fumadocsDir = path.join(projectDir, "apps", "fumadocs"); |
82 | 34 | const packageJsonPath = path.join(fumadocsDir, "package.json"); |
83 | 35 |
|
|
0 commit comments