Skip to content

Commit 7c5c6f5

Browse files
committed
feat: Fix routes fetching
1 parent 03b210d commit 7c5c6f5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

scripts/joinLlmsFiles.mjs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ const FILES_ROUTES = {
2828
],
2929
};
3030

31-
async function fetchFile(route, file) {
32-
const url = `${route}/${file}`;
31+
async function fetchFile(route) {
3332
try {
34-
const res = await fetch(url);
35-
if (!res.ok) throw new Error(`Failed to fetch ${url}: ${res.status}`);
33+
const res = await fetch(route);
34+
if (!res.ok) throw new Error(`Failed to fetch ${route}: ${res.status}`);
3635
return await res.text();
3736
} catch (err) {
38-
console.error(`Error fetching ${url}:`, err.message);
37+
console.error(`Error fetching ${route}:`, err.message);
3938
return '';
4039
}
4140
}
@@ -45,7 +44,7 @@ async function joinFiles() {
4544
// TODO: Remove HTML from description with replaceAll
4645
for (const [llmsFile, files] of Object.entries(FILES_ROUTES)) {
4746
const contents = await Promise.all(
48-
files.map((route) => fetchFile(route, llmsFile)),
47+
files.map((route) => fetchFile(route)),
4948
);
5049
const joined = contents.filter(Boolean).join('\n\n');
5150
await fs.appendFile(path.join(BUILD_DIR, llmsFile), joined, 'utf8');

0 commit comments

Comments
 (0)