domma-cms 1.75.1 → 1.75.2

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.75.2] - 2026-11-18
4
+
5
+ ### Fixed
6
+
7
+ - **Manager-only plugins stay off sites.** A plugin whose plugin.json says `"managerOnly": true` (Site Manager, Customer Registration, Site Wizard) is skipped on a site the Manager runs, or anywhere without Site Manager beside it. A stray copy is not listed, enabled or loaded, and gets no collections, forms or pages. Before this, a hand-copied Site Wizard switched on in a site would still create its SiteDesigns collection.
8
+
3
9
  ## [1.75.1] - 2026-11-18
4
10
 
5
11
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domma-cms",
3
- "version": "1.75.1",
3
+ "version": "1.75.2",
4
4
  "description": "File-based CMS powered by Domma and Fastify. Run npx domma-cms my-site to create a new project.",
5
5
  "type": "module",
6
6
  "main": "server/server.js",
@@ -11,7 +11,7 @@
11
11
  * plugins/{name}/data/ - optional plugin-specific data store
12
12
  */
13
13
  import fs from 'fs/promises';
14
- import {readFileSync} from 'fs';
14
+ import {existsSync, readFileSync} from 'fs';
15
15
  import path from 'path';
16
16
  import matter from 'gray-matter';
17
17
  import {getConfig, saveConfig} from '../config.js';
@@ -238,6 +238,24 @@ export const RETIRED_PLUGINS = Object.freeze({
238
238
  seo: 'Built in since 0.90.0 (server/services/seo) - its data moves to content/seo and config/seo.json.'
239
239
  });
240
240
 
241
+ /**
242
+ * A manager-only plugin (`"managerOnly": true` in plugin.json - Site Manager, Customer Registration, Site Wizard)
243
+ * belongs to the Manager and nowhere else. The Manager never copies one into a site, but a stray copy (a hand copy,
244
+ * an older Manager) must stay inert: not discovered, so not listed, enabled, loaded, injected or given its
245
+ * collections, forms or pages. A site the Manager forked carries `SITE_SLUG`; the Manager has none and has Site
246
+ * Manager beside the plugin. Site Wizard seeded a collection on a new site on 2026-11-18 this way.
247
+ *
248
+ * @param {object} manifest
249
+ * @param {{env?: object, pluginsDir?: string}} [o]
250
+ * @returns {string|null} why it may not run here, or null when it may
251
+ */
252
+ export function managerOnlyRefusal(manifest, {env = process.env, pluginsDir = PLUGINS_DIR} = {}) {
253
+ if (manifest?.managerOnly !== true) return null;
254
+ if (env.SITE_SLUG) return `manager-only, and this is the managed site "${env.SITE_SLUG}"`;
255
+ if (!existsSync(path.join(pluginsDir, 'site-manager', 'plugin.json'))) return 'manager-only, and this is not the Manager';
256
+ return null;
257
+ }
258
+
241
259
  /**
242
260
  * Scan the plugins/ directory and return all valid manifests.
243
261
  * Validates mandatory fields and required files (plugin.js, config.js).
@@ -281,6 +299,13 @@ export async function discoverPlugins() {
281
299
  }
282
300
  if (!valid) continue;
283
301
 
302
+ // Not recorded as a load failure: on a site a manager-only plugin is not there at all, not broken.
303
+ const notHere = managerOnlyRefusal(manifest);
304
+ if (notHere) {
305
+ console.warn(`Plugin "${dir}": ${notHere} - skipping`);
306
+ continue;
307
+ }
308
+
284
309
  // Validate required files
285
310
  const pluginJsPath = path.join(pluginDir, 'plugin.js');
286
311
  const configJsPath = path.join(pluginDir, 'config.js');
@@ -803,6 +828,9 @@ async function walkMdFiles(dir) {
803
828
  export async function setupPlugin(pluginName, services) {
804
829
  const result = {collections: [], forms: [], pages: [], roles: []};
805
830
  const pluginDir = path.join(PLUGINS_DIR, pluginName);
831
+ let ownManifest = null;
832
+ try { ownManifest = JSON.parse(await fs.readFile(path.join(pluginDir, 'plugin.json'), 'utf8')); } catch { /* none */ }
833
+ if (managerOnlyRefusal(ownManifest)) return result;
806
834
 
807
835
  // Collections
808
836
  if (services.collections) {