« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/data/things/search.js8
-rwxr-xr-xsrc/upd8.js1
2 files changed, 7 insertions, 2 deletions
diff --git a/src/data/things/search.js b/src/data/things/search.js
index ed65cb6b..7dcf5cf9 100644
--- a/src/data/things/search.js
+++ b/src/data/things/search.js
@@ -1,6 +1,6 @@
 'use strict';
 
-import {writeFile} from 'node:fs/promises';
+import {mkdir, writeFile} from 'node:fs/promises';
 import * as path from 'node:path';
 
 import FlexSearch from 'flexsearch';
@@ -86,9 +86,13 @@ export async function writeSearchIndex({
         });
       }));
 
+  const outputDirectory =
+    path.join(wikiCachePath, 'search');
+
   const outputFile =
-    path.join(wikiCachePath, 'search-index.json');
+    path.join(outputDirectory, 'index.json');
 
+  await mkdir(outputDirectory, {recursive: true});
   await writeFile(outputFile, JSON.stringify(searchData));
 
   logInfo`Search index successfully written.`;
diff --git a/src/upd8.js b/src/upd8.js
index 473a9514..3dc01da8 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -2264,6 +2264,7 @@ async function main() {
       dataPath,
       mediaPath,
       mediaCachePath,
+      wikiCachePath,
       queueSize,
       srcRootPath: __dirname,