Skip to content

Commit 9609773

Browse files
committed
Revert "Try fix search again"
1 parent 8347925 commit 9609773

File tree

1 file changed

+13
-43
lines changed

1 file changed

+13
-43
lines changed

web/astro.config.mjs

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import { defineConfig } from 'astro/config';
33
import starlight from '@astrojs/starlight';
44
import mtasaStarlightThemePlugin from '@multitheftauto/starlight-theme-mtasa';
55
import { SITE_TITLE, SITE_URL } from './src/content.constants';
6-
import { readFileSync, writeFileSync, mkdirSync, copyFileSync, existsSync } from 'fs';
7-
import { join } from 'path';
8-
6+
import fs from 'fs';
7+
import path from 'path';
98

109
export default defineConfig({
1110
site: SITE_URL,
@@ -87,7 +86,7 @@ export default defineConfig({
8786
items: [
8887
{label: 'Element types', link: 'Element'},
8988
{label: 'Element tree', link: 'Element_tree'},
90-
{label: 'Entities', link: 'Entity'},
89+
{label: 'Entity', link: 'Entity'},
9190
]
9291
},
9392
{
@@ -107,45 +106,16 @@ export default defineConfig({
107106
plugins: [
108107
{
109108
name: 'override-pagefind-config',
110-
writeBundle: {
111-
sequential: true,
112-
order: 'post',
113-
handler: async () => {
114-
const targetDir = join('dist', 'pagefind');
115-
const sourceDir = join('dist', '_pagefind');
116-
117-
if (!existsSync(targetDir)) mkdirSync(targetDir, { recursive: true });
118-
119-
const filesToCopy = ['pagefind.js', 'pagefind.json', 'pagefind-*.wasm'];
120-
filesToCopy.forEach(pattern => {
121-
try {
122-
const sourcePath = join(sourceDir, pattern.replace('*', ''));
123-
if (existsSync(sourcePath)) {
124-
copyFileSync(
125-
sourcePath,
126-
join(targetDir, pattern.replace('*', ''))
127-
);
128-
}
129-
} catch (error) {
130-
console.warn(`Filed to copy ${pattern}:`, error.message);
131-
}
132-
});
133-
134-
const configPath = join(targetDir, 'pagefind.json');
135-
if (existsSync(configPath)) {
136-
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
137-
config.source = 'pages';
138-
writeFileSync(configPath, JSON.stringify(config));
139-
} else {
140-
writeFileSync(configPath, JSON.stringify({
141-
source: 'pages',
142-
bundlePath: '/pagefind/'
143-
}));
144-
145-
}
109+
closeBundle: async () => {
110+
const configPath = path.join('dist', 'pagefind', 'pagefind.json');
111+
112+
if (fs.existsSync(configPath)) {
113+
let config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
114+
config.source = 'pages';
115+
fs.writeFileSync(configPath, JSON.stringify(config));
146116
}
147-
}
148-
}
149-
]
117+
},
118+
},
119+
],
150120
}
151121
});

0 commit comments

Comments
 (0)