mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
CLI: add home layout to customise option
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@fumadocs/cli': patch
|
||||
---
|
||||
|
||||
add home layout to customise option
|
||||
@@ -17,6 +17,11 @@ export async function customise(resolver: Resolver, config: Config) {
|
||||
value: 'docs',
|
||||
hint: 'main UI of your docs',
|
||||
},
|
||||
{
|
||||
label: 'Home Layout',
|
||||
value: 'home',
|
||||
hint: 'the navbar for your other pages',
|
||||
},
|
||||
],
|
||||
}),
|
||||
mode: (v) => {
|
||||
@@ -60,12 +65,17 @@ export async function customise(resolver: Resolver, config: Config) {
|
||||
},
|
||||
);
|
||||
|
||||
if (result.target === 'docs' && result.mode) {
|
||||
if (result.page) await add('layouts/page', resolver, config);
|
||||
|
||||
if (result.target === 'docs') {
|
||||
let pageAdded = false;
|
||||
if (result.mode === 'minimal') {
|
||||
await add('layouts/docs-min', resolver, config);
|
||||
pageAdded = true;
|
||||
} else {
|
||||
if (result.page) {
|
||||
await add('layouts/page', resolver, config);
|
||||
pageAdded = true;
|
||||
}
|
||||
|
||||
await add(
|
||||
result.mode === 'full-default' ? 'layouts/docs' : 'layouts/notebook',
|
||||
resolver,
|
||||
@@ -82,7 +92,7 @@ export async function customise(resolver: Resolver, config: Config) {
|
||||
picocolors.greenBright(
|
||||
'`fumadocs-ui/layouts/docs` -> `@/components/layouts/docs`',
|
||||
),
|
||||
result.page || result.mode === 'minimal'
|
||||
pageAdded
|
||||
? picocolors.greenBright(
|
||||
'`fumadocs-ui/page` -> `@/components/layouts/page`',
|
||||
)
|
||||
@@ -90,4 +100,20 @@ export async function customise(resolver: Resolver, config: Config) {
|
||||
].join('\n'),
|
||||
);
|
||||
}
|
||||
|
||||
if (result.target === 'home') {
|
||||
await add('layouts/home', resolver, config);
|
||||
|
||||
log.info(
|
||||
[
|
||||
picocolors.bold('What is Next?'),
|
||||
'You can check the installed components in `components/layouts`.',
|
||||
picocolors.dim('---'),
|
||||
'Open your `layout.tsx` files, replace the imports of components:',
|
||||
picocolors.greenBright(
|
||||
'`fumadocs-ui/layouts/home` -> `@/components/layouts/home`',
|
||||
),
|
||||
].join('\n'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,35 @@ export const registry: Registry = {
|
||||
mapImportPath: contextsMap,
|
||||
unlisted: true,
|
||||
},
|
||||
|
||||
{
|
||||
name: 'layouts/docs',
|
||||
files: ['layouts/docs.tsx'],
|
||||
unlisted: true,
|
||||
mapImportPath: contextsMap,
|
||||
},
|
||||
{
|
||||
name: 'layouts/notebook',
|
||||
files: ['layouts/notebook.tsx'],
|
||||
unlisted: true,
|
||||
mapImportPath: contextsMap,
|
||||
},
|
||||
{
|
||||
name: 'layouts/page',
|
||||
files: [
|
||||
{
|
||||
in: 'page.tsx',
|
||||
out: 'components:layouts/page.tsx',
|
||||
},
|
||||
],
|
||||
mapImportPath: contextsMap,
|
||||
unlisted: true,
|
||||
},
|
||||
{
|
||||
name: 'layouts/home',
|
||||
files: ['layouts/home.tsx'],
|
||||
mapImportPath: contextsMap,
|
||||
unlisted: true,
|
||||
},
|
||||
{
|
||||
name: 'layout/root-toggle',
|
||||
description: 'the UI of Sidebar Tabs',
|
||||
@@ -50,30 +78,6 @@ export const registry: Registry = {
|
||||
files: ['components/layout/language-toggle.tsx'],
|
||||
mapImportPath: contextsMap,
|
||||
},
|
||||
{
|
||||
name: 'layouts/docs',
|
||||
description: 'Replace Docs Layout (Full)',
|
||||
files: ['layouts/docs.tsx'],
|
||||
mapImportPath: contextsMap,
|
||||
},
|
||||
{
|
||||
name: 'layouts/notebook',
|
||||
description: 'Replace Notebook Layout',
|
||||
files: ['layouts/notebook.tsx'],
|
||||
mapImportPath: contextsMap,
|
||||
},
|
||||
{
|
||||
name: 'layouts/home',
|
||||
description: 'Replace Home Layout',
|
||||
files: ['layouts/home.tsx'],
|
||||
mapImportPath: contextsMap,
|
||||
},
|
||||
{
|
||||
name: 'layouts/page',
|
||||
description: 'Replace Page Layout',
|
||||
files: ['components:page.tsx'],
|
||||
mapImportPath: contextsMap,
|
||||
},
|
||||
{ name: 'accordion', files: ['components/accordion.tsx'] },
|
||||
{
|
||||
name: 'github-info',
|
||||
|
||||
Reference in New Issue
Block a user