create-momentum-app 0.1.4 → 0.1.6
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/index.cjs +1 -1
- package/package.json +1 -1
- package/templates/analog/package.json.tmpl +4 -2
- package/templates/analog/src/types/.gitkeep +0 -0
- package/templates/angular/package.json.tmpl +3 -1
- package/templates/angular/src/app/app.routes.server.ts +4 -5
- package/templates/angular/src/app/app.routes.ts +4 -1
- package/templates/angular/src/app/pages/welcome.ts +99 -0
- package/templates/angular/src/index.html.tmpl +7 -0
- package/templates/angular/src/types/.gitkeep +0 -0
package/index.cjs
CHANGED
|
@@ -95,7 +95,7 @@ const pool = (dbAdapter as PostgresAdapterWithRaw).getPool();` : "",
|
|
|
95
95
|
dbPackage: database === "postgres" ? '"pg": "^8.18.0"' : '"better-sqlite3": "^12.6.0"',
|
|
96
96
|
dbDevPackage: database === "postgres" ? "" : '"@types/better-sqlite3": "^7.6.13",',
|
|
97
97
|
envDbVar: database === "postgres" ? "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/momentum" : "DATABASE_PATH=./data/momentum.db",
|
|
98
|
-
defaultPort:
|
|
98
|
+
defaultPort: "4200",
|
|
99
99
|
externalDependencies: database === "postgres" ? '"pg", "pg-native"' : '"better-sqlite3"'
|
|
100
100
|
};
|
|
101
101
|
console.log();
|
package/package.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "vite build",
|
|
9
|
-
"start": "node dist/analog/server/index.mjs"
|
|
9
|
+
"start": "node dist/analog/server/index.mjs",
|
|
10
|
+
"generate-types": "tsx node_modules/@momentumcms/core/generators/types/generator.cjs src/momentum.config.ts src/types/momentum.generated.ts"
|
|
10
11
|
},
|
|
11
12
|
"dependencies": {
|
|
12
13
|
"@analogjs/platform": "^2.2.3",
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
"vite": "^7.0.0",
|
|
51
52
|
"tailwindcss": "^3.4.19",
|
|
52
53
|
"postcss": "^8.5.6",
|
|
53
|
-
"autoprefixer": "^10.4.24"
|
|
54
|
+
"autoprefixer": "^10.4.24",
|
|
55
|
+
"tsx": "^4.0.0"
|
|
54
56
|
}
|
|
55
57
|
}
|
|
File without changes
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"dev": "ng serve",
|
|
7
7
|
"build": "ng build",
|
|
8
8
|
"start": "node dist/{{projectName}}/server/server.mjs",
|
|
9
|
-
"lint": "ng lint"
|
|
9
|
+
"lint": "ng lint",
|
|
10
|
+
"generate-types": "tsx node_modules/@momentumcms/core/generators/types/generator.cjs src/momentum.config.ts src/types/momentum.generated.ts"
|
|
10
11
|
},
|
|
11
12
|
"dependencies": {
|
|
12
13
|
"@angular/animations": "^21.1.0",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"autoprefixer": "^10.4.21",
|
|
53
54
|
"postcss": "^8.5.4",
|
|
54
55
|
"tailwindcss": "^3.4.17",
|
|
56
|
+
"tsx": "^4.0.0",
|
|
55
57
|
"typescript": "~5.9.2"
|
|
56
58
|
}
|
|
57
59
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { RenderMode, ServerRoute } from '@angular/ssr';
|
|
2
2
|
|
|
3
3
|
export const serverRoutes: ServerRoute[] = [
|
|
4
|
-
//
|
|
5
|
-
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
4
|
+
// Admin routes render client-side — guards need to run without SSR hydration conflict
|
|
5
|
+
{ path: 'admin/**', renderMode: RenderMode.Client },
|
|
6
|
+
// All other routes use server-side rendering
|
|
7
|
+
{ path: '**', renderMode: RenderMode.Server },
|
|
9
8
|
];
|
|
@@ -3,7 +3,10 @@ import { momentumAdminRoutes } from '@momentumcms/admin';
|
|
|
3
3
|
import { Posts } from '../collections/posts';
|
|
4
4
|
|
|
5
5
|
export const routes: Route[] = [
|
|
6
|
-
{
|
|
6
|
+
{
|
|
7
|
+
path: '',
|
|
8
|
+
loadComponent: () => import('./pages/welcome').then((m) => m.WelcomePage),
|
|
9
|
+
},
|
|
7
10
|
...momentumAdminRoutes({
|
|
8
11
|
basePath: '/admin',
|
|
9
12
|
collections: [Posts],
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { RouterLink } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'mcms-welcome-page',
|
|
6
|
+
imports: [RouterLink],
|
|
7
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8
|
+
host: {
|
|
9
|
+
class: 'flex min-h-screen flex-col bg-background text-foreground',
|
|
10
|
+
},
|
|
11
|
+
template: `
|
|
12
|
+
<header class="border-b border-border px-6 py-4">
|
|
13
|
+
<div class="mx-auto flex max-w-4xl items-center justify-between">
|
|
14
|
+
<h1 class="text-xl font-bold tracking-tight">Momentum CMS</h1>
|
|
15
|
+
<a
|
|
16
|
+
routerLink="/admin"
|
|
17
|
+
class="rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90"
|
|
18
|
+
>
|
|
19
|
+
Go to Admin
|
|
20
|
+
</a>
|
|
21
|
+
</div>
|
|
22
|
+
</header>
|
|
23
|
+
|
|
24
|
+
<main class="flex-1 px-6 py-12">
|
|
25
|
+
<div class="mx-auto max-w-4xl space-y-12">
|
|
26
|
+
<section class="space-y-4 text-center">
|
|
27
|
+
<h2 class="text-4xl font-bold tracking-tight">Welcome to Momentum CMS</h2>
|
|
28
|
+
<p class="mx-auto max-w-2xl text-lg text-muted-foreground">
|
|
29
|
+
Your Angular-powered headless CMS is ready. Define collections in TypeScript, get an
|
|
30
|
+
auto-generated Admin UI, REST API, and database schema.
|
|
31
|
+
</p>
|
|
32
|
+
</section>
|
|
33
|
+
|
|
34
|
+
<section class="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
|
35
|
+
<div class="rounded-lg border border-border bg-card p-6 shadow-sm">
|
|
36
|
+
<h3 class="mb-2 text-lg font-semibold text-card-foreground">1. Create Admin Account</h3>
|
|
37
|
+
<p class="mb-4 text-sm text-muted-foreground">
|
|
38
|
+
Head to the admin panel to create your first admin account and start managing content.
|
|
39
|
+
</p>
|
|
40
|
+
<a routerLink="/admin" class="text-sm font-medium text-primary hover:underline">
|
|
41
|
+
Open Admin Panel →
|
|
42
|
+
</a>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div class="rounded-lg border border-border bg-card p-6 shadow-sm">
|
|
46
|
+
<h3 class="mb-2 text-lg font-semibold text-card-foreground">2. Define Collections</h3>
|
|
47
|
+
<p class="mb-4 text-sm text-muted-foreground">
|
|
48
|
+
Edit <code class="rounded bg-muted px-1.5 py-0.5 text-xs">src/collections/</code> to
|
|
49
|
+
define your content types with fields, hooks, and access control.
|
|
50
|
+
</p>
|
|
51
|
+
<code class="block rounded bg-muted px-3 py-2 text-xs text-muted-foreground">
|
|
52
|
+
text('title', { required: true })
|
|
53
|
+
</code>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div class="rounded-lg border border-border bg-card p-6 shadow-sm">
|
|
57
|
+
<h3 class="mb-2 text-lg font-semibold text-card-foreground">3. Generate Types</h3>
|
|
58
|
+
<p class="mb-4 text-sm text-muted-foreground">
|
|
59
|
+
Run the type generator to create TypeScript interfaces from your collection
|
|
60
|
+
definitions.
|
|
61
|
+
</p>
|
|
62
|
+
<code class="block rounded bg-muted px-3 py-2 text-xs text-muted-foreground">
|
|
63
|
+
npm run generate-types
|
|
64
|
+
</code>
|
|
65
|
+
</div>
|
|
66
|
+
</section>
|
|
67
|
+
|
|
68
|
+
<section class="rounded-lg border border-border bg-card p-6 shadow-sm">
|
|
69
|
+
<h3 class="mb-3 text-lg font-semibold text-card-foreground">Quick Reference</h3>
|
|
70
|
+
<div class="grid gap-3 sm:grid-cols-2">
|
|
71
|
+
<div>
|
|
72
|
+
<p class="text-sm font-medium text-card-foreground">Dev Server</p>
|
|
73
|
+
<code class="text-sm text-muted-foreground">npm run dev</code>
|
|
74
|
+
</div>
|
|
75
|
+
<div>
|
|
76
|
+
<p class="text-sm font-medium text-card-foreground">Production Build</p>
|
|
77
|
+
<code class="text-sm text-muted-foreground">npm run build</code>
|
|
78
|
+
</div>
|
|
79
|
+
<div>
|
|
80
|
+
<p class="text-sm font-medium text-card-foreground">Config File</p>
|
|
81
|
+
<code class="text-sm text-muted-foreground">src/momentum.config.ts</code>
|
|
82
|
+
</div>
|
|
83
|
+
<div>
|
|
84
|
+
<p class="text-sm font-medium text-card-foreground">REST API</p>
|
|
85
|
+
<code class="text-sm text-muted-foreground">/api/collections/:slug</code>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</section>
|
|
89
|
+
</div>
|
|
90
|
+
</main>
|
|
91
|
+
|
|
92
|
+
<footer class="border-t border-border px-6 py-4">
|
|
93
|
+
<p class="mx-auto max-w-4xl text-center text-sm text-muted-foreground">
|
|
94
|
+
Powered by Momentum CMS — Built with Angular, Drizzle ORM, and Better Auth
|
|
95
|
+
</p>
|
|
96
|
+
</footer>
|
|
97
|
+
`,
|
|
98
|
+
})
|
|
99
|
+
export class WelcomePage {}
|
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
|
+
<script>
|
|
12
|
+
try {
|
|
13
|
+
var t = localStorage.getItem('mcms-theme');
|
|
14
|
+
if (t === 'dark' || ((!t || t === 'system') && matchMedia('(prefers-color-scheme:dark)').matches))
|
|
15
|
+
document.documentElement.classList.add('dark');
|
|
16
|
+
} catch (e) {}
|
|
17
|
+
</script>
|
|
11
18
|
<app-root></app-root>
|
|
12
19
|
</body>
|
|
13
20
|
</html>
|
|
File without changes
|