« get me outta code hell

util: remove findFiles util, adapt traverse - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-08-19 11:51:13 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-08-19 12:24:03 -0300
commit9e4a20224a2cc005775cb99b5ea888c253e48e3a (patch)
tree7757c2b5a269657a760a076fd25e724457c4941b /src/data
parent3b601adf3945a487f4aa07eb8c0f62161460345a (diff)
util: remove findFiles util, adapt traverse
Diffstat (limited to 'src/data')
-rw-r--r--src/data/yaml.js28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 9ebce642..c0058da3 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -30,7 +30,7 @@ import {
 } from '../util/wiki-data.js';
 
 import find, {bindFind} from '../util/find.js';
-import {findFiles} from '../util/io.js';
+import {traverse} from '../util/node-utils.js';
 
 // --> General supporting stuff
 
@@ -739,13 +739,12 @@ export const dataSteps = [
 
   {
     title: `Process album files`,
-    files: async (dataPath) =>
-      (
-        await findFiles(path.join(dataPath, DATA_ALBUM_DIRECTORY), {
-          filter: (f) => path.extname(f) === '.yaml',
-          joinParentDirectory: false,
-        })
-      ).map(file => path.join(DATA_ALBUM_DIRECTORY, file)),
+
+    files: dataPath =>
+      traverse(path.join(dataPath, DATA_ALBUM_DIRECTORY), {
+        filterFile: name => path.extname(name) === '.yaml',
+        prefixPath: DATA_ALBUM_DIRECTORY,
+      }),
 
     documentMode: documentModes.headerAndEntries,
     processHeaderDocument: processAlbumDocument,
@@ -977,13 +976,12 @@ export const dataSteps = [
 
   {
     title: `Process static page files`,
-    files: async (dataPath) =>
-      (
-        await findFiles(path.join(dataPath, DATA_STATIC_PAGE_DIRECTORY), {
-          filter: f => path.extname(f) === '.yaml',
-          joinParentDirectory: false,
-        })
-      ).map(file => path.join(DATA_STATIC_PAGE_DIRECTORY, file)),
+
+    files: dataPath =>
+      traverse(path.join(dataPath, DATA_STATIC_PAGE_DIRECTORY), {
+        filterFile: name => path.extname(name) === '.yaml',
+        prefixPath: DATA_STATIC_PAGE_DIRECTORY,
+      }),
 
     documentMode: documentModes.onePerFile,
     processDocument: processStaticPageDocument,