domma-cms 1.57.0 → 1.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/bin/lib/public-merge.js +48 -0
- package/bin/update.js +7 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.57.1] - 2026-11-11
|
|
4
|
+
|
|
5
|
+
- An engine update no longer deletes a site's own files in `public/images` (such as `public/images/branding`). Since the engine started shipping `public/images/characters`, the update replaced the whole folder. Now only `public/css` and `public/js` are replaced whole; in any other folder the engine ships, only its own entries are replaced.
|
|
6
|
+
|
|
3
7
|
## [1.57.0] - 2026-11-11
|
|
4
8
|
|
|
5
9
|
- Honour sidebar theme colours in the admin navigation, including the sticky brand header, links, folder labels, hover and selected states, and dividers. Explicit light and dark menu variants keep readable brand titles and header controls.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {cpSync, lstatSync, mkdirSync, readdirSync, rmSync} from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The public/ directories the engine owns outright. Everything else it ships
|
|
6
|
+
* (public/images, say, which carries the character art) is shared with the
|
|
7
|
+
* site, so only the engine's own entries inside it are replaced.
|
|
8
|
+
*/
|
|
9
|
+
export const ENGINE_OWNED_PUBLIC = new Set(['css', 'js']);
|
|
10
|
+
|
|
11
|
+
function isLink(p) {
|
|
12
|
+
try { return lstatSync(p).isSymbolicLink(); } catch { return false; }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function exists(p) {
|
|
16
|
+
try { lstatSync(p); return true; } catch { return false; }
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Replace dest/name with src/name, leaving a symlinked dest alone. */
|
|
20
|
+
function replaceEntry(src, dest) {
|
|
21
|
+
if (isLink(dest)) return;
|
|
22
|
+
if (exists(dest)) rmSync(dest, {recursive: true, force: true});
|
|
23
|
+
cpSync(src, dest, {recursive: true});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Update a site's public/ from the package's public/.
|
|
28
|
+
* Engine-owned directories are replaced whole. Other shipped directories are
|
|
29
|
+
* merged: each entry the package ships replaces the site's entry of that name,
|
|
30
|
+
* and the site's own entries beside them are kept (public/images/branding).
|
|
31
|
+
* A symlinked entry is owned by whatever it points at and is never touched.
|
|
32
|
+
*/
|
|
33
|
+
export function updatePublic(srcRoot, destRoot) {
|
|
34
|
+
mkdirSync(destRoot, {recursive: true});
|
|
35
|
+
for (const name of readdirSync(srcRoot)) {
|
|
36
|
+
const src = path.join(srcRoot, name);
|
|
37
|
+
const dest = path.join(destRoot, name);
|
|
38
|
+
if (isLink(dest)) continue;
|
|
39
|
+
const srcIsDir = lstatSync(src).isDirectory();
|
|
40
|
+
if (!srcIsDir || ENGINE_OWNED_PUBLIC.has(name)) {
|
|
41
|
+
replaceEntry(src, dest);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (exists(dest) && !lstatSync(dest).isDirectory()) rmSync(dest, {force: true});
|
|
45
|
+
mkdirSync(dest, {recursive: true});
|
|
46
|
+
for (const child of readdirSync(src)) replaceEntry(path.join(src, child), path.join(dest, child));
|
|
47
|
+
}
|
|
48
|
+
}
|
package/bin/update.js
CHANGED
|
@@ -17,6 +17,7 @@ import {deepMergeNewKeys} from './lib/config-merge.js';
|
|
|
17
17
|
import {shouldReplacePlugin} from './lib/plugin-version.js';
|
|
18
18
|
import {KEEP_UPDATE_BACKUPS, pruneUpdateBackups} from './lib/backup-retention.js';
|
|
19
19
|
import {pluginBackupFilter} from './lib/plugin-backup.js';
|
|
20
|
+
import {updatePublic} from './lib/public-merge.js';
|
|
20
21
|
import {removeLeftFreeTier} from './lib/left-free-tier.js';
|
|
21
22
|
|
|
22
23
|
// ---------------------------------------------------------------------------
|
|
@@ -215,7 +216,7 @@ export default async function update(_positional, flags) {
|
|
|
215
216
|
info('Upstream directories that would be replaced:');
|
|
216
217
|
for (const dir of UPSTREAM_DIRS) {
|
|
217
218
|
if (dir === 'public') {
|
|
218
|
-
info(` → ${dir}/ (upstream entries only - site-added files are preserved)`);
|
|
219
|
+
info(` → ${dir}/ (css/ and js/ whole; elsewhere upstream entries only - site-added files are preserved)`);
|
|
219
220
|
} else {
|
|
220
221
|
info(` → ${dir}/`);
|
|
221
222
|
}
|
|
@@ -331,20 +332,11 @@ export default async function update(_positional, flags) {
|
|
|
331
332
|
const src = path.join(PACKAGE_ROOT, dir);
|
|
332
333
|
if (!existsSync(src)) continue;
|
|
333
334
|
if (dir === 'public') {
|
|
334
|
-
// public/ is shared ground: upstream ships css/ and
|
|
335
|
-
// add their own subdirs and files (games, images, downloads).
|
|
336
|
-
//
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
const destEntry = path.join(dest, entry);
|
|
340
|
-
let st = null;
|
|
341
|
-
try { st = lstatSync(destEntry); } catch { /* missing */ }
|
|
342
|
-
// A symlinked entry (e.g. a manager-shared public/js) is owned by
|
|
343
|
-
// whatever it points at - replacing it would silently fork it.
|
|
344
|
-
if (st && st.isSymbolicLink()) continue;
|
|
345
|
-
if (st) rmSync(destEntry, {recursive: true, force: true});
|
|
346
|
-
cpSync(path.join(src, entry), destEntry, {recursive: true});
|
|
347
|
-
}
|
|
335
|
+
// public/ is shared ground: upstream ships css/, js/ and images/, but sites
|
|
336
|
+
// add their own subdirs and files (games, images, downloads). css/ and js/
|
|
337
|
+
// are replaced whole; inside other shipped dirs only the package's own
|
|
338
|
+
// entries are replaced, so public/images/branding survives (bin/lib/public-merge.js).
|
|
339
|
+
updatePublic(src, dest);
|
|
348
340
|
continue;
|
|
349
341
|
}
|
|
350
342
|
if (existsSync(dest)) rmSync(dest, {recursive: true, force: true});
|