« get me outta code hell

sort (build mode) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/write
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-02-22 14:58:23 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-02-22 21:12:24 -0400
commita90bca338d37db3880ef712980a3b5bc91cfd88a (patch)
tree476d634551a1aee8d0267a3643f2dade5a8a28b6 /src/write
parentdcf6dd2d44006628c963e8555d98603109785589 (diff)
sort (build mode)
We'll throw a tantrum over this having the same apparent
commit namespace as `#sort` RIP
Diffstat (limited to 'src/write')
-rw-r--r--src/write/build-modes/index.js1
-rw-r--r--src/write/build-modes/sort.js37
2 files changed, 38 insertions, 0 deletions
diff --git a/src/write/build-modes/index.js b/src/write/build-modes/index.js
index 3ae2cfc6..4b61619d 100644
--- a/src/write/build-modes/index.js
+++ b/src/write/build-modes/index.js
@@ -1,3 +1,4 @@
 export * as 'live-dev-server' from './live-dev-server.js';
 export * as 'repl' from './repl.js';
+export * as 'sort' from './sort.js';
 export * as 'static-build' from './static-build.js';
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});
+  }
+}