CLI: Expose installer

This commit is contained in:
Fuma Nama
2026-03-11 20:27:45 +08:00
parent 53575600a6
commit b2191f57f7
4 changed files with 31 additions and 10 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@fumadocs/cli': patch
---
Expose installer
+5 -5
View File
@@ -17,12 +17,12 @@
"dist/*"
],
"type": "module",
"main": "./dist/index.js",
"exports": {
"./build": {
"types": "./dist/build/index.d.ts",
"import": "./dist/build/index.js"
}
"./build": "./dist/build/index.js",
"./registry/client": "./dist/registry/client.js",
"./registry/installer": "./dist/registry/installer/index.js",
"./registry/schema": "./dist/registry/schema.js",
"./package.json": "./package.json"
},
"publishConfig": {
"access": "public"
+10 -1
View File
@@ -4,7 +4,12 @@ import { createConfigSchema } from './src/config';
import { z } from 'zod';
export default defineConfig({
entry: ['./src/index.ts', './src/build/index.ts'],
entry: [
'./src/index.ts',
'./src/registry/{client,schema}.ts',
'./src/registry/installer/index.ts',
'./src/build/index.ts',
],
format: 'esm',
dts: true,
fixedExtension: false,
@@ -12,6 +17,10 @@ export default defineConfig({
deps: {
onlyAllowBundle: [],
},
exports: {
enabled: true,
exclude: ['./index'],
},
async onSuccess() {
console.log('JSON schema generated');
await fs.mkdir('dist/schema', { recursive: true });
+11 -4
View File
@@ -4,8 +4,15 @@ import { createContentHighlighter } from '@/search';
test('highlight search results', () => {
const highlighter = createContentHighlighter('hello world helloworld');
expect(highlighter.highlightMarkdown('oops hello, world hello! worldhello'))
.toMatchInlineSnapshot(`"oops <mark>hello</mark>, <mark>world</mark> <mark>hello</mark>! <mark>world</mark><mark>hello</mark>"`);
expect(highlighter.highlightMarkdown('helloworld!!!')).toMatchInlineSnapshot(`"<mark>hello</mark><mark>world</mark>!!!"`);
expect(highlighter.highlightMarkdown('wor ld hello')).toMatchInlineSnapshot(`"wor ld <mark>hello</mark>"`);
expect(
highlighter.highlightMarkdown('oops hello, world hello! worldhello'),
).toMatchInlineSnapshot(
`"oops <mark>hello</mark>, <mark>world</mark> <mark>hello</mark>! <mark>world</mark><mark>hello</mark>"`,
);
expect(highlighter.highlightMarkdown('helloworld!!!')).toMatchInlineSnapshot(
`"<mark>hello</mark><mark>world</mark>!!!"`,
);
expect(highlighter.highlightMarkdown('wor ld hello')).toMatchInlineSnapshot(
`"wor ld <mark>hello</mark>"`,
);
});