File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 steps :
1010 - uses : actions/checkout@v4
1111
12+ - name : Use Node.js LTS
13+ uses : actions/setup-node@v6
14+ with :
15+ node-version : lts/*
16+ check-latest : true
17+
1218 - name : Setup pnpm
1319 uses : pnpm/action-setup@v2
1420 with :
1723 - name : Build project
1824 run : |
1925 pnpm install
20- pnpm build
26+ pnpm build
Original file line number Diff line number Diff line change @@ -10,17 +10,14 @@ jobs:
1010 build :
1111 runs-on : ubuntu-latest
1212
13- strategy :
14- matrix :
15- node-version : [23.x]
16-
1713 steps :
1814 - uses : actions/checkout@v4
1915
20- - name : Use Node.js ${{ matrix.node-version }}
21- uses : actions/setup-node@v4
16+ - name : Use Node.js LTS
17+ uses : actions/setup-node@v6
2218 with :
23- node-version : ${{ matrix.node-version }}
19+ node-version : lts/*
20+ check-latest : true
2421
2522 - name : Setup pnpm
2623 uses : pnpm/action-setup@v2
4239
4340 - name : Build project
4441 run : pnpm build
45-
46- - name : Sync search index
47- run : |
48- pnpm run sync-search
49- env :
50- ORAMA_PRIVATE_API_KEY : ${{ secrets.ORAMA_PRIVATE_API_KEY }}
5142
5243 - name : Generate sitemap
5344 run : |
Original file line number Diff line number Diff line change 1- import { sync } from 'fumadocs-core/search/orama-cloud' ;
2- import * as fs from 'node:fs/promises' ;
3- import { CloudManager } from '@oramacloud/client' ;
4-
5- export const dynamic = 'force-static' ;
6-
7- const updateSearchIndexes = async ( ) : Promise < void > => {
8- const apiKey = process . env . ORAMA_PRIVATE_API_KEY ;
9- const indexId = 'k2hnq39jnt7u8l41bfv0ezhd' ;
10-
11- if ( ! apiKey ) {
12- console . log ( '未找到 Orama 私钥,跳过索引更新' ) ;
13- return ;
14- }
15-
16- try {
17- const content = await fs . readFile ( '.next/server/app/static.json.body' ) ;
18- const records = JSON . parse ( content . toString ( ) ) ;
19-
20- const manager = new CloudManager ( { api_key : apiKey } ) ;
21-
22- await sync ( manager , {
23- index : indexId ,
24- documents : records ,
25- } ) ;
26-
27- console . log ( `搜索索引更新完成:${ records . length } 条记录` ) ;
28- } catch ( error ) {
29- console . error ( '更新搜索索引时发生错误:' , error ) ;
30- }
31- }
32-
33- void updateSearchIndexes ( ) ;
34-
35- export async function GET ( request : Request ) {
36- // ... GET处理逻辑 ...
37- }
1+ import { createFromSource } from 'fumadocs-core/search/server' ;
2+ import { source } from '@/lib/source' ;
383
39- export async function POST ( request : Request ) {
40- // ... POST处理逻辑 ...
41- }
4+ export const revalidate = false ;
5+
6+ const searchApi = createFromSource ( source ) ;
7+
8+ export const GET = searchApi . staticGET ;
Original file line number Diff line number Diff line change 11'use client' ;
22
3- import { OramaClient } from '@oramacloud/client' ;
43import type { SharedProps } from 'fumadocs-ui/components/dialog/search' ;
5- import SearchDialog from 'fumadocs-ui/components/dialog/search-orama' ;
6-
7- const client = new OramaClient ( {
8- endpoint : 'https://cloud.orama.run/v1/indexes/mxspace-no50lj' ,
9- api_key : 'HHIpRwosmxFfAs7l2gsJv5m5A3ew2PRB' ,
10- } ) ;
4+ import SearchDialog from 'fumadocs-ui/components/dialog/search-default' ;
115
126export default function CustomSearchDialog ( props : SharedProps ) {
13- return < SearchDialog { ...props } client = { client } showOrama /> ;
14- }
7+ return < SearchDialog { ...props } type = "static" /> ;
8+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 77 "dev" : " next dev --turbo" ,
88 "start" : " next start" ,
99 "postinstall" : " fumadocs-mdx" ,
10- "sync-search" : " node sync-index.mjs" ,
1110 "preinstall" : " npx only-allow pnpm" ,
1211 "commit" : " cz" ,
1312 "generate-sitemap" : " tsx scripts/generate-sitemap.ts"
1413 },
1514 "dependencies" : {
16- "@orama/orama" : " ^3.1.18" ,
17- "@orama/tokenizers" : " ^3.1.18" ,
18- "@oramacloud/client" : " ^2.1.4" ,
1915 "@tailwindcss/postcss" : " ^4.1.18" ,
2016 "autocorrect-node" : " ^2.14.0" ,
2117 "class-variance-authority" : " ^0.7.1" ,
2218 "clsx" : " ^2.1.1" ,
2319 "commitizen" : " ^4.3.1" ,
2420 "copy-to-clipboard" : " ^3.3.3" ,
2521 "cz-conventional-changelog" : " ^3.3.0" ,
26- "dotenv" : " ^17.2.3" ,
2722 "fast-glob" : " ^3.3.3" ,
2823 "framer-motion" : " ^12.23.26" ,
2924 "fumadocs-core" : " 15.1.2" ,
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments