« get me outta code hell

url-spec: STATIC_VERSION 2a - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-21 08:56:59 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-21 08:57:09 -0300
commitc5192d9ece7c94321a18ba3e02a36bc66717be3a (patch)
treebd3aee42f134606e6c9d85d22f6e369f90a8e943
parent9c00d5b47d82da80605d78b762777aeb9a972e21 (diff)
url-spec: STATIC_VERSION 2a
-rw-r--r--src/static/shared-util/README.md2
-rw-r--r--src/url-spec.js14
2 files changed, 11 insertions, 5 deletions
diff --git a/src/static/shared-util/README.md b/src/static/shared-util/README.md
index 92aa77e6..d21c0e6b 100644
--- a/src/static/shared-util/README.md
+++ b/src/static/shared-util/README.md
@@ -6,6 +6,6 @@ Module imports under `src/static/js` may appear to be pointing to files that are
 
 ...is reading a file that doesn't exist here, under `shared-util`. This isn't an error!
 
-This folder (`src/shared-util`) does not actually exist in a build of the website; instead, the folder `src/util` is symlinked in its place. So, all files under `src/util` are actually available at `/shared-util/` online.
+This folder (`src/shared-util`) does not actually exist in a build of the website; instead, the folder `src/util` is symlinked in its place. So, all files under `src/util` are actually available at (e.g.) `/static/shared-util/` online.
 
 The above import would actually import from the bindings in `src/util/sugar.js`.
diff --git a/src/url-spec.js b/src/url-spec.js
index 5bc34407..1f04a906 100644
--- a/src/url-spec.js
+++ b/src/url-spec.js
@@ -1,5 +1,11 @@
 import {withEntries} from '#sugar';
 
+// Static files are all grouped under a `static-${STATIC_VERSION}` folder as
+// part of a build. This is so that multiple builds of a wiki can coexist
+// served from the same server / file system root: older builds' HTML files
+// refer to earlier values of STATIC_VERSION, avoiding name collisions.
+const STATIC_VERSION = '2a';
+
 const genericPaths = {
   root: '',
   path: '<>',
@@ -67,17 +73,17 @@ const urlSpec = {
   },
 
   staticCSS: {
-    prefix: 'static/css/',
+    prefix: `static-${STATIC_VERSION}/css/`,
     paths: genericPaths,
   },
 
   staticJS: {
-    prefix: 'static/js/',
+    prefix: `static-${STATIC_VERSION}/js/`,
     paths: genericPaths,
   },
 
   staticMisc: {
-    prefix: 'static/misc/',
+    prefix: `static-${STATIC_VERSION}/misc/`,
     paths: {
       ...genericPaths,
       icon: 'icons.svg#icon-<>',
@@ -85,7 +91,7 @@ const urlSpec = {
   },
 
   staticSharedUtil: {
-    prefix: 'static/shared-util/',
+    prefix: `static-${STATIC_VERSION}/shared-util/`,
     paths: genericPaths,
   },