« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/write/build-modes/sort.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/write/build-modes/sort.js')
-rw-r--r--src/write/build-modes/sort.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/write/build-modes/sort.js b/src/write/build-modes/sort.js
new file mode 100644
index 00000000..c444d295
--- /dev/null
+++ b/src/write/build-modes/sort.js
@@ -0,0 +1,37 @@
+export const description = `Update data files in-place to satisfy custom sorting rules`;
+
+export const config = {
+  fileSizes: {
+    applicable: false,
+  },
+
+  languageReloading: {
+    applicable: false,
+  },
+
+  mediaValidation: {
+    applicable: false,
+  },
+
+  search: {
+    applicable: false,
+  },
+
+  thumbs: {
+    applicable: false,
+  },
+
+  webRoutes: {
+    applicable: false,
+  },
+};
+
+export function getCLIOptions() {
+  return {};
+}
+
+export async function go({wikiData, dataPath}) {
+  for (const sortingRule of wikiData.sortingRules) {
+    await sortingRule.apply({wikiData, dataPath});
+  }
+}