domma-cms 1.10.36 → 1.10.37
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/plugin-backup.js +40 -0
- package/bin/update.js +6 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.10.37] - 2026-10-27
|
|
4
|
+
|
|
5
|
+
- The updater's backup no longer copies the runtime data of plugins it does not update. A marketplace or site plugin's `data/`, `backups/` and `node_modules/` stay out of `.domma-backups` (its code is still copied); the engine's own plugins are still backed up whole. A File Store's members' uploads were otherwise copied into every one of up to sixteen kept backups.
|
|
6
|
+
|
|
3
7
|
## [1.10.36] - 2026-10-27
|
|
4
8
|
|
|
5
9
|
- Trash folder menus offer Empty Trash with an explicit permanent-deletion confirmation. Clear every message in the server-designated Trash folder, including more than one list page, while retaining the folder and its subfolders. Requires Email Pro 0.10.1.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the update backup takes of plugins/, for the engine updater.
|
|
3
|
+
*
|
|
4
|
+
* The backup is there to undo the update, and the update only ever rewrites
|
|
5
|
+
* the plugins the engine ships (Blog, Mail Reader, ...). Every other plugin -
|
|
6
|
+
* installed from the marketplace or written by the site - is left exactly as
|
|
7
|
+
* it is, so copying its runtime state would back up something the update never
|
|
8
|
+
* touches. And that state can be large: a File Store keeps members' uploads in
|
|
9
|
+
* its data/, and the update backups are kept up to sixteen deep. So:
|
|
10
|
+
*
|
|
11
|
+
* - a plugin the engine ships: copied whole, data/ included (the update
|
|
12
|
+
* replaces its folder, carrying data/ across through memory - the backup
|
|
13
|
+
* is the safety net if that goes wrong);
|
|
14
|
+
* - any other plugin: its code only - no data/, backups/ or node_modules/.
|
|
15
|
+
*
|
|
16
|
+
* @module bin/lib/plugin-backup
|
|
17
|
+
*/
|
|
18
|
+
import path from 'node:path';
|
|
19
|
+
|
|
20
|
+
/** Runtime folders inside a plugin that a plugin the update does not touch never needs backed up. */
|
|
21
|
+
export const STATE_DIRS = ['data', 'backups', 'node_modules'];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A `cpSync` filter for copying `pluginsDir` into the backup.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} pluginsDir the site's plugins/ folder
|
|
27
|
+
* @param {Iterable<string>} shipped names of the plugins the engine package ships
|
|
28
|
+
* @returns {(src: string) => boolean}
|
|
29
|
+
*/
|
|
30
|
+
export function pluginBackupFilter(pluginsDir, shipped) {
|
|
31
|
+
const engine = new Set(shipped);
|
|
32
|
+
const root = path.resolve(pluginsDir);
|
|
33
|
+
return (src) => {
|
|
34
|
+
const rel = path.relative(root, path.resolve(src));
|
|
35
|
+
if (!rel || rel.startsWith('..')) return true;
|
|
36
|
+
const [plugin, second] = rel.split(path.sep);
|
|
37
|
+
if (second === undefined || engine.has(plugin)) return true;
|
|
38
|
+
return !STATE_DIRS.includes(second);
|
|
39
|
+
};
|
|
40
|
+
}
|
package/bin/update.js
CHANGED
|
@@ -16,6 +16,7 @@ import {fileURLToPath} from 'node:url';
|
|
|
16
16
|
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
|
+
import {pluginBackupFilter} from './lib/plugin-backup.js';
|
|
19
20
|
import {removeLeftFreeTier} from './lib/left-free-tier.js';
|
|
20
21
|
|
|
21
22
|
// ---------------------------------------------------------------------------
|
|
@@ -306,10 +307,13 @@ export default async function update(_positional, flags) {
|
|
|
306
307
|
}
|
|
307
308
|
}
|
|
308
309
|
|
|
309
|
-
// Back up plugins
|
|
310
|
+
// Back up plugins/: the engine's own plugins whole (the update replaces them), every other
|
|
311
|
+
// plugin's code only - the update never touches it, and its data/ can be large (bin/lib/plugin-backup.js).
|
|
310
312
|
const pluginsDir = path.join(cwd, 'plugins');
|
|
311
313
|
if (existsSync(pluginsDir)) {
|
|
312
|
-
|
|
314
|
+
const shippedDir = path.join(PACKAGE_ROOT, 'plugins');
|
|
315
|
+
const shipped = existsSync(shippedDir) ? readdirSync(shippedDir, {withFileTypes: true}).filter(e => e.isDirectory()).map(e => e.name) : [];
|
|
316
|
+
cpSync(pluginsDir, path.join(backupPath, 'plugins'), {recursive: true, filter: pluginBackupFilter(pluginsDir, shipped)});
|
|
313
317
|
}
|
|
314
318
|
|
|
315
319
|
done();
|