domma-cms 0.2.0 → 0.2.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/README.md +2 -3
- package/bin/cli.js +18 -9
- package/package.json +1 -1
- package/plugins/example-analytics/stats.json +1 -1
- package/scripts/setup.js +12 -9
package/README.md
CHANGED
|
@@ -76,10 +76,9 @@ my-site/
|
|
|
76
76
|
│ └── users/ # User accounts ({uuid}.json)
|
|
77
77
|
│
|
|
78
78
|
├── plugins/ # CMS plugins
|
|
79
|
-
│ ├──
|
|
79
|
+
│ ├── domma-effects/
|
|
80
80
|
│ ├── example-analytics/
|
|
81
|
-
│
|
|
82
|
-
│ └── cookie-consent/
|
|
81
|
+
│ └── form-builder/
|
|
83
82
|
│
|
|
84
83
|
├── public/ # Public frontend assets (CSS, JS)
|
|
85
84
|
├── scripts/ # CLI utilities (setup, reset, seed, etc.)
|
package/bin/cli.js
CHANGED
|
@@ -42,7 +42,7 @@ if (flags.has('--help') || args.includes('-h')) {
|
|
|
42
42
|
Options:
|
|
43
43
|
--no-install Skip npm install
|
|
44
44
|
--no-setup Skip the interactive setup wizard
|
|
45
|
-
--seed
|
|
45
|
+
--no-seed Skip seeding default pages, forms, and collections
|
|
46
46
|
--help Show this help message
|
|
47
47
|
|
|
48
48
|
Example:
|
|
@@ -82,7 +82,7 @@ if (existsSync(target)) {
|
|
|
82
82
|
|
|
83
83
|
const noInstall = flags.has('--no-install');
|
|
84
84
|
const noSetup = flags.has('--no-setup') || noInstall;
|
|
85
|
-
const
|
|
85
|
+
const noSeed = flags.has('--no-seed');
|
|
86
86
|
|
|
87
87
|
// ---------------------------------------------------------------------------
|
|
88
88
|
// Banner
|
|
@@ -207,7 +207,13 @@ const DEFAULT_NAV = {
|
|
|
207
207
|
position: 'sticky'
|
|
208
208
|
};
|
|
209
209
|
|
|
210
|
-
//
|
|
210
|
+
// Plugins enabled by default in a fresh project
|
|
211
|
+
const ENABLED_BY_DEFAULT = new Set([
|
|
212
|
+
'domma-effects',
|
|
213
|
+
'form-builder',
|
|
214
|
+
]);
|
|
215
|
+
|
|
216
|
+
// Discover all plugins and set enabled state accordingly
|
|
211
217
|
const DEFAULT_PLUGINS = {};
|
|
212
218
|
try {
|
|
213
219
|
const pluginsRoot = path.join(target, 'plugins');
|
|
@@ -218,7 +224,7 @@ try {
|
|
|
218
224
|
const manifestPath = path.join(pluginsRoot, name, 'plugin.json');
|
|
219
225
|
try {
|
|
220
226
|
JSON.parse(readFileSync(manifestPath, 'utf8')); // validate manifest exists
|
|
221
|
-
DEFAULT_PLUGINS[name] = {enabled:
|
|
227
|
+
DEFAULT_PLUGINS[name] = {enabled: ENABLED_BY_DEFAULT.has(name), settings: {}};
|
|
222
228
|
} catch { /* no valid plugin.json — skip */
|
|
223
229
|
}
|
|
224
230
|
}
|
|
@@ -237,6 +243,7 @@ done();
|
|
|
237
243
|
|
|
238
244
|
step('Creating content directories');
|
|
239
245
|
mkdirSync(path.join(target, 'content/pages'), {recursive: true});
|
|
246
|
+
mkdirSync(path.join(target, 'content/collections'), {recursive: true});
|
|
240
247
|
mkdirSync(path.join(target, 'content/media'), {recursive: true});
|
|
241
248
|
mkdirSync(path.join(target, 'content/users'), {recursive: true});
|
|
242
249
|
done();
|
|
@@ -328,13 +335,15 @@ if (noSetup) {
|
|
|
328
335
|
}
|
|
329
336
|
|
|
330
337
|
// ---------------------------------------------------------------------------
|
|
331
|
-
//
|
|
338
|
+
// Seed default content (pages, forms, collections)
|
|
332
339
|
// ---------------------------------------------------------------------------
|
|
333
340
|
|
|
334
|
-
if (
|
|
335
|
-
console.log('
|
|
341
|
+
if (noSeed) {
|
|
342
|
+
console.log(' ⚠ Skipping seed (--no-seed).');
|
|
343
|
+
} else {
|
|
344
|
+
console.log(' Seeding default pages, forms and collections…');
|
|
336
345
|
console.log('');
|
|
337
|
-
const result = spawnSync(
|
|
346
|
+
const result = spawnSync(process.execPath, ['scripts/seed.js'], {cwd: target, stdio: 'inherit'});
|
|
338
347
|
if (result.status !== 0) {
|
|
339
348
|
console.error('\n ✗ Seed failed.\n');
|
|
340
349
|
process.exit(result.status ?? 1);
|
|
@@ -354,7 +363,7 @@ console.log('');
|
|
|
354
363
|
console.log(` Next steps:`);
|
|
355
364
|
console.log(` cd ${projectName}`);
|
|
356
365
|
if (noInstall) console.log(` npm install`);
|
|
357
|
-
if (noSetup) console.log(` npm run setup`);
|
|
366
|
+
if (noSetup && !noInstall) console.log(` npm run setup`);
|
|
358
367
|
console.log(` npm run dev`);
|
|
359
368
|
console.log('');
|
|
360
369
|
console.log(` Then open: http://localhost:3050/admin`);
|
package/package.json
CHANGED
package/scripts/setup.js
CHANGED
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
* 3. Set site title and tagline
|
|
12
12
|
* 4. Pick a theme
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import path
|
|
19
|
-
import {
|
|
20
|
-
import bcrypt
|
|
21
|
-
import {
|
|
14
|
+
import {createInterface} from 'node:readline/promises';
|
|
15
|
+
import {randomBytes} from 'node:crypto';
|
|
16
|
+
import {mkdir, readdir, readFile, writeFile} from 'node:fs/promises';
|
|
17
|
+
import {existsSync} from 'node:fs';
|
|
18
|
+
import path from 'node:path';
|
|
19
|
+
import {fileURLToPath} from 'node:url';
|
|
20
|
+
import bcrypt from 'bcryptjs';
|
|
21
|
+
import {v4 as uuidv4} from 'uuid';
|
|
22
22
|
|
|
23
23
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
24
24
|
const ROOT = path.resolve(__dirname, '..');
|
|
@@ -38,7 +38,10 @@ const THEMES = [
|
|
|
38
38
|
'royal-dark', 'royal-light',
|
|
39
39
|
'lemon-dark', 'lemon-light',
|
|
40
40
|
'silver-dark', 'silver-light',
|
|
41
|
-
|
|
41
|
+
'grayve-dark', 'grayve-light',
|
|
42
|
+
'christmas-dark', 'christmas-light',
|
|
43
|
+
'unicorn-dark', 'unicorn-light',
|
|
44
|
+
'dreamy-dark', 'dreamy-light',
|
|
42
45
|
];
|
|
43
46
|
|
|
44
47
|
// ---------------------------------------------------------------------------
|