« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/files/static-page.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/files/static-page.js')
-rw-r--r--src/data/files/static-page.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/data/files/static-page.js b/src/data/files/static-page.js
new file mode 100644
index 00000000..c7622bc8
--- /dev/null
+++ b/src/data/files/static-page.js
@@ -0,0 +1,24 @@
+import * as path from 'node:path';
+
+import {traverse} from '#node-utils';
+import {sortAlphabetically} from '#sort';
+
+export default ({
+  documentModes: {onePerFile},
+  thingConstructors: {StaticPage},
+}) => ({
+  title: `Process static page files`,
+
+  files: dataPath =>
+    traverse(path.join(dataPath, 'static-page'), {
+      filterFile: name => path.extname(name) === '.yaml',
+      prefixPath: 'static-page',
+    }),
+
+  documentMode: onePerFile,
+  documentThing: StaticPage,
+
+  sort({staticPageData}) {
+    sortAlphabetically(staticPageData);
+  },
+});