« get me outta code hell

search: output to wikiCachePath/search/index.json - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-03-26 15:34:12 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 12:11:44 -0300
commitd1f036182b17b9e27c986e152949a75187d8eb07 (patch)
tree813c00c9887f56cf8362d9d32a9b21a169ceed3d /src
parentfa969b9dd99d18a3c5f77300a79a9c923ce280ce (diff)
search: output to wikiCachePath/search/index.json
Diffstat (limited to 'src')
-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,