domma-cms 0.1.0

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.
Files changed (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +469 -0
  3. package/admin/css/admin.css +1123 -0
  4. package/admin/index.html +72 -0
  5. package/admin/js/api.js +210 -0
  6. package/admin/js/app.js +270 -0
  7. package/admin/js/config/sidebar-config.js +107 -0
  8. package/admin/js/lib/card.js +63 -0
  9. package/admin/js/lib/image-editor.js +869 -0
  10. package/admin/js/lib/markdown-toolbar.js +421 -0
  11. package/admin/js/templates/dashboard.html +50 -0
  12. package/admin/js/templates/documentation.html +237 -0
  13. package/admin/js/templates/layouts.html +11 -0
  14. package/admin/js/templates/login.html +58 -0
  15. package/admin/js/templates/media.html +16 -0
  16. package/admin/js/templates/navigation.html +50 -0
  17. package/admin/js/templates/page-editor.html +126 -0
  18. package/admin/js/templates/pages.html +18 -0
  19. package/admin/js/templates/plugins.html +12 -0
  20. package/admin/js/templates/settings.html +190 -0
  21. package/admin/js/templates/tutorials.html +233 -0
  22. package/admin/js/templates/user-editor.html +12 -0
  23. package/admin/js/templates/users.html +10 -0
  24. package/admin/js/views/dashboard.js +48 -0
  25. package/admin/js/views/documentation.js +12 -0
  26. package/admin/js/views/index.js +33 -0
  27. package/admin/js/views/layouts.js +49 -0
  28. package/admin/js/views/login.js +254 -0
  29. package/admin/js/views/media.js +240 -0
  30. package/admin/js/views/navigation.js +152 -0
  31. package/admin/js/views/page-editor.js +479 -0
  32. package/admin/js/views/pages.js +64 -0
  33. package/admin/js/views/plugins.js +100 -0
  34. package/admin/js/views/settings.js +64 -0
  35. package/admin/js/views/tutorials.js +12 -0
  36. package/admin/js/views/user-editor.js +88 -0
  37. package/admin/js/views/users.js +73 -0
  38. package/bin/cli.js +334 -0
  39. package/config/auth.json +20 -0
  40. package/config/content.json +10 -0
  41. package/config/navigation.json +63 -0
  42. package/config/plugins.json +47 -0
  43. package/config/presets.json +34 -0
  44. package/config/server.json +6 -0
  45. package/config/site.json +33 -0
  46. package/package.json +67 -0
  47. package/plugins/back-to-top/admin/templates/back-to-top-settings.html +55 -0
  48. package/plugins/back-to-top/admin/views/back-to-top-settings.js +44 -0
  49. package/plugins/back-to-top/config.js +10 -0
  50. package/plugins/back-to-top/plugin.js +24 -0
  51. package/plugins/back-to-top/plugin.json +36 -0
  52. package/plugins/back-to-top/public/inject-body.html +105 -0
  53. package/plugins/cookie-consent/admin/templates/cookie-consent-settings.html +113 -0
  54. package/plugins/cookie-consent/admin/views/cookie-consent-settings.js +73 -0
  55. package/plugins/cookie-consent/config.js +30 -0
  56. package/plugins/cookie-consent/plugin.js +24 -0
  57. package/plugins/cookie-consent/plugin.json +36 -0
  58. package/plugins/cookie-consent/public/inject-body.html +69 -0
  59. package/plugins/custom-css/admin/templates/custom-css.html +17 -0
  60. package/plugins/custom-css/admin/views/custom-css.js +35 -0
  61. package/plugins/custom-css/config.js +1 -0
  62. package/plugins/custom-css/data/custom.css +0 -0
  63. package/plugins/custom-css/plugin.js +63 -0
  64. package/plugins/custom-css/plugin.json +32 -0
  65. package/plugins/custom-css/public/inject-head.html +1 -0
  66. package/plugins/domma-effects/admin/templates/domma-effects.html +488 -0
  67. package/plugins/domma-effects/admin/views/domma-effects.js +56 -0
  68. package/plugins/domma-effects/config.js +9 -0
  69. package/plugins/domma-effects/plugin.js +22 -0
  70. package/plugins/domma-effects/plugin.json +36 -0
  71. package/plugins/domma-effects/public/celebrations/core/canvas.js +111 -0
  72. package/plugins/domma-effects/public/celebrations/core/particles.js +144 -0
  73. package/plugins/domma-effects/public/celebrations/core/physics.js +166 -0
  74. package/plugins/domma-effects/public/celebrations/index.js +535 -0
  75. package/plugins/domma-effects/public/celebrations/themes/christmas.js +1805 -0
  76. package/plugins/domma-effects/public/celebrations/themes/guy-fawkes.js +1477 -0
  77. package/plugins/domma-effects/public/celebrations/themes/halloween.js +1837 -0
  78. package/plugins/domma-effects/public/celebrations/themes/st-andrews.js +1175 -0
  79. package/plugins/domma-effects/public/celebrations/themes/st-davids.js +1258 -0
  80. package/plugins/domma-effects/public/celebrations/themes/st-georges.js +1754 -0
  81. package/plugins/domma-effects/public/celebrations/themes/st-patricks.js +1290 -0
  82. package/plugins/domma-effects/public/celebrations/themes/valentines.js +1361 -0
  83. package/plugins/domma-effects/public/inject-body.html +268 -0
  84. package/plugins/example-analytics/admin/templates/analytics.html +10 -0
  85. package/plugins/example-analytics/admin/views/analytics.js +51 -0
  86. package/plugins/example-analytics/config.js +6 -0
  87. package/plugins/example-analytics/plugin.js +58 -0
  88. package/plugins/example-analytics/plugin.json +27 -0
  89. package/plugins/example-analytics/public/inject-body.html +13 -0
  90. package/plugins/example-analytics/public/inject-head.html +1 -0
  91. package/plugins/example-analytics/stats.json +1 -0
  92. package/plugins/form-builder/admin/templates/form-editor.html +158 -0
  93. package/plugins/form-builder/admin/templates/form-settings.html +29 -0
  94. package/plugins/form-builder/admin/templates/form-submissions.html +30 -0
  95. package/plugins/form-builder/admin/templates/forms-list.html +17 -0
  96. package/plugins/form-builder/admin/views/form-editor.js +817 -0
  97. package/plugins/form-builder/admin/views/form-settings.js +38 -0
  98. package/plugins/form-builder/admin/views/form-submissions.js +295 -0
  99. package/plugins/form-builder/admin/views/forms-list.js +164 -0
  100. package/plugins/form-builder/config.js +9 -0
  101. package/plugins/form-builder/data/forms/contact-details.json +63 -0
  102. package/plugins/form-builder/data/forms/contact.json +52 -0
  103. package/plugins/form-builder/data/submissions/contact-details.json +1 -0
  104. package/plugins/form-builder/data/submissions/contact.json +14 -0
  105. package/plugins/form-builder/email.js +103 -0
  106. package/plugins/form-builder/plugin.js +454 -0
  107. package/plugins/form-builder/plugin.json +56 -0
  108. package/plugins/form-builder/public/inject-body.html +270 -0
  109. package/plugins/form-builder/public/inject-head.html +42 -0
  110. package/public/css/site.css +189 -0
  111. package/public/js/site.js +109 -0
  112. package/scripts/copy-domma.js +48 -0
  113. package/scripts/fresh.js +41 -0
  114. package/scripts/reset.js +124 -0
  115. package/scripts/seed.js +666 -0
  116. package/scripts/setup.js +263 -0
  117. package/server/config.js +56 -0
  118. package/server/middleware/auth.js +97 -0
  119. package/server/routes/api/auth.js +116 -0
  120. package/server/routes/api/layouts.js +25 -0
  121. package/server/routes/api/media.js +93 -0
  122. package/server/routes/api/navigation.js +37 -0
  123. package/server/routes/api/pages.js +118 -0
  124. package/server/routes/api/plugins.js +46 -0
  125. package/server/routes/api/settings.js +25 -0
  126. package/server/routes/api/users.js +110 -0
  127. package/server/routes/public.js +108 -0
  128. package/server/server.js +169 -0
  129. package/server/services/content.js +298 -0
  130. package/server/services/images.js +334 -0
  131. package/server/services/markdown.js +297 -0
  132. package/server/services/plugins.js +246 -0
  133. package/server/services/renderer.js +80 -0
  134. package/server/services/users.js +212 -0
  135. package/server/templates/page.html +78 -0
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Domma CMS — Factory Reset
4
+ * Wipes all content, users, and resets config to defaults.
5
+ * Run: npm run reset
6
+ */
7
+ import { createInterface } from 'node:readline/promises';
8
+ import { readFile, writeFile, readdir, rm, mkdir } from 'node:fs/promises';
9
+ import { existsSync } from 'node:fs';
10
+ import path from 'node:path';
11
+ import { fileURLToPath } from 'node:url';
12
+
13
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
14
+ const ROOT = path.resolve(__dirname, '..');
15
+
16
+ const USERS_DIR = path.join(ROOT, 'content', 'users');
17
+ const PAGES_DIR = path.join(ROOT, 'content', 'pages');
18
+ const MEDIA_DIR = path.join(ROOT, 'content', 'media');
19
+ const SITE_CFG = path.join(ROOT, 'config', 'site.json');
20
+ const NAV_CFG = path.join(ROOT, 'config', 'navigation.json');
21
+ const ENV_FILE = path.join(ROOT, '.env');
22
+
23
+ const DEFAULT_SITE = {
24
+ title: 'My Site',
25
+ tagline: 'Powered by Domma CMS',
26
+ theme: 'charcoal-dark',
27
+ seo: {
28
+ defaultTitle: 'My Site',
29
+ titleSeparator: ' | ',
30
+ defaultDescription: 'A site built with Domma CMS'
31
+ },
32
+ footer: {
33
+ copyright: `© ${new Date().getFullYear()} My Site. All rights reserved.`,
34
+ links: [
35
+ { text: 'Privacy Policy', url: '/privacy' },
36
+ { text: 'Contact', url: '/contact' }
37
+ ]
38
+ }
39
+ };
40
+
41
+ const DEFAULT_NAV = {
42
+ brand: { text: 'My Site', logo: null, url: '/' },
43
+ items: [
44
+ { text: 'Home', url: '/', icon: 'home' },
45
+ { text: 'About', url: '/about', icon: 'info' },
46
+ { text: 'Contact', url: '/contact', icon: 'mail' }
47
+ ],
48
+ variant: 'dark',
49
+ position: 'sticky'
50
+ };
51
+
52
+ // ---------------------------------------------------------------------------
53
+
54
+ async function wipeDir(dir) {
55
+ await rm(dir, { recursive: true, force: true });
56
+ await mkdir(dir, { recursive: true });
57
+ }
58
+
59
+ async function resetEnv() {
60
+ if (!existsSync(ENV_FILE)) return;
61
+ const lines = (await readFile(ENV_FILE, 'utf8')).split('\n');
62
+ const updated = lines.map(l =>
63
+ l.startsWith('JWT_SECRET=')
64
+ ? 'JWT_SECRET=change-me-to-a-64-char-random-string-before-deploying-to-production'
65
+ : l
66
+ );
67
+ await writeFile(ENV_FILE, updated.join('\n'), 'utf8');
68
+ }
69
+
70
+ // ---------------------------------------------------------------------------
71
+
72
+ console.log('');
73
+ console.log(' ┌──────────────────────────────────┐');
74
+ console.log(' │ Domma CMS — Factory Reset │');
75
+ console.log(' └──────────────────────────────────┘');
76
+ console.log('');
77
+ console.log(' This will permanently delete:');
78
+ console.log(' • All user accounts (content/users/)');
79
+ console.log(' • All pages (content/pages/)');
80
+ console.log(' • All media uploads (content/media/)');
81
+ console.log(' • config/site.json (reset to defaults)');
82
+ console.log(' • config/navigation.json (reset to defaults)');
83
+ console.log(' • JWT_SECRET in .env (reset to placeholder)');
84
+ console.log('');
85
+
86
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
87
+ const answer = (await rl.question(' Type "yes" to confirm: ')).trim();
88
+ rl.close();
89
+
90
+ if (answer !== 'yes') {
91
+ console.log('\n Reset cancelled.\n');
92
+ process.exit(0);
93
+ }
94
+
95
+ console.log('');
96
+
97
+ process.stdout.write(' Deleting users…');
98
+ await wipeDir(USERS_DIR);
99
+ console.log(' done.');
100
+
101
+ process.stdout.write(' Deleting pages…');
102
+ await wipeDir(PAGES_DIR);
103
+ console.log(' done.');
104
+
105
+ process.stdout.write(' Deleting media…');
106
+ await wipeDir(MEDIA_DIR);
107
+ console.log(' done.');
108
+
109
+ process.stdout.write(' Resetting config/site.json…');
110
+ await writeFile(SITE_CFG, JSON.stringify(DEFAULT_SITE, null, 4) + '\n', 'utf8');
111
+ console.log(' done.');
112
+
113
+ process.stdout.write(' Resetting config/navigation.json…');
114
+ await writeFile(NAV_CFG, JSON.stringify(DEFAULT_NAV, null, 4) + '\n', 'utf8');
115
+ console.log(' done.');
116
+
117
+ process.stdout.write(' Resetting JWT_SECRET in .env…');
118
+ await resetEnv();
119
+ console.log(' done.');
120
+
121
+ console.log('');
122
+ console.log(' ✓ Factory reset complete.');
123
+ console.log(' Run `npm run setup` to configure a new admin account.');
124
+ console.log('');