CLI: Support Fumadocs UI 16.2.0

This commit is contained in:
Fuma Nama
2025-11-23 11:16:07 +08:00
parent 80579fd71f
commit 897fdef9f6
3 changed files with 21 additions and 33 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@fumadocs/cli': minor
---
Update `customise` command to support Fumadocs UI 16.2.0
+14 -31
View File
@@ -1,12 +1,4 @@
import {
cancel,
confirm,
group,
intro,
log,
outro,
select,
} from '@clack/prompts';
import { cancel, group, intro, log, outro, select } from '@clack/prompts';
import picocolors from 'picocolors';
import {
createComponentInstaller,
@@ -64,14 +56,6 @@ export async function customise(resolver: Resolver, config: LoadedConfig) {
],
});
},
page: async (v) => {
if (v.results.target !== 'docs' || v.results.mode === 'minimal')
return false;
return confirm({
message: 'Do you want to customise the page component too?',
});
},
},
{
onCancel: () => {
@@ -83,29 +67,28 @@ export async function customise(resolver: Resolver, config: LoadedConfig) {
if (result.target === 'docs') {
const targets = [];
let pageAdded = false;
if (result.mode === 'minimal') {
targets.push('layouts/docs-min');
pageAdded = true;
} else {
if (result.page) {
targets.push('layouts/page');
pageAdded = true;
}
targets.push(
result.mode === 'full-default' ? 'layouts/docs' : 'layouts/notebook',
);
}
await install(targets, installer);
const maps: [string, string][] = [
['fumadocs-ui/layouts/docs', '@/components/layout/docs'],
];
if (pageAdded) {
maps.push(['fumadocs-ui/page', '@/components/layout/page']);
}
const maps: [string, string][] =
result.mode === 'full-notebook'
? [
['fumadocs-ui/layouts/notebook', '@/components/layout/notebook'],
[
'fumadocs-ui/layouts/notebook/page',
'@/components/layout/notebook/page',
],
]
: [
['fumadocs-ui/layouts/docs', '@/components/layout/docs'],
['fumadocs-ui/layouts/docs/page', '@/components/layout/docs/page'],
];
printNext(...maps);
}
+2 -2
View File
@@ -63,12 +63,12 @@ export const registry: Registry = {
{
type: 'block',
path: '_registry/layout/docs-min.tsx',
target: 'components/layout/docs.tsx',
target: 'components/layout/docs/index.tsx',
},
{
type: 'block',
path: '_registry/layout/page-min.tsx',
target: 'components/layout/page.tsx',
target: 'components/layout/docs/page.tsx',
},
],
unlisted: true,