create-ampless 0.2.0-alpha.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 +38 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +229 -0
  5. package/dist/templates/_shared/RUNBOOK.md +178 -0
  6. package/dist/templates/_shared/amplify/auth/post-confirmation/handler.ts +4 -0
  7. package/dist/templates/_shared/amplify/auth/post-confirmation/resource.ts +6 -0
  8. package/dist/templates/_shared/amplify/auth/resource.ts +8 -0
  9. package/dist/templates/_shared/amplify/backend.ts +29 -0
  10. package/dist/templates/_shared/amplify/data/get-published-post.js +33 -0
  11. package/dist/templates/_shared/amplify/data/list-posts-by-tag.js +52 -0
  12. package/dist/templates/_shared/amplify/data/list-published-posts.js +57 -0
  13. package/dist/templates/_shared/amplify/data/resource.ts +30 -0
  14. package/dist/templates/_shared/amplify/events/dispatcher/handler.ts +4 -0
  15. package/dist/templates/_shared/amplify/events/dispatcher/resource.ts +12 -0
  16. package/dist/templates/_shared/amplify/events/processor-trusted/handler.ts +12 -0
  17. package/dist/templates/_shared/amplify/events/processor-trusted/resource.ts +14 -0
  18. package/dist/templates/_shared/amplify/events/processor-untrusted/handler.ts +10 -0
  19. package/dist/templates/_shared/amplify/events/processor-untrusted/resource.ts +9 -0
  20. package/dist/templates/_shared/amplify/functions/api-key-renewer/handler.ts +4 -0
  21. package/dist/templates/_shared/amplify/functions/api-key-renewer/resource.ts +12 -0
  22. package/dist/templates/_shared/amplify/storage/resource.ts +7 -0
  23. package/dist/templates/_shared/app/(admin)/admin/layout.tsx +4 -0
  24. package/dist/templates/_shared/app/(admin)/admin/media/page.tsx +4 -0
  25. package/dist/templates/_shared/app/(admin)/admin/page.tsx +4 -0
  26. package/dist/templates/_shared/app/(admin)/admin/posts/[postId]/page.tsx +4 -0
  27. package/dist/templates/_shared/app/(admin)/admin/posts/new/page.tsx +4 -0
  28. package/dist/templates/_shared/app/(admin)/admin/posts/page.tsx +4 -0
  29. package/dist/templates/_shared/app/(admin)/admin/sites/[siteId]/page.tsx +5 -0
  30. package/dist/templates/_shared/app/(admin)/admin/sites/[siteId]/theme/page.tsx +6 -0
  31. package/dist/templates/_shared/app/(admin)/admin/sites/page.tsx +5 -0
  32. package/dist/templates/_shared/app/api/media/[...path]/route.ts +5 -0
  33. package/dist/templates/_shared/app/globals.css +114 -0
  34. package/dist/templates/_shared/app/layout.tsx +48 -0
  35. package/dist/templates/_shared/app/login/page.tsx +4 -0
  36. package/dist/templates/_shared/app/providers.tsx +13 -0
  37. package/dist/templates/_shared/app/site/[siteId]/[slug]/page.tsx +10 -0
  38. package/dist/templates/_shared/app/site/[siteId]/feed.xml/route.ts +5 -0
  39. package/dist/templates/_shared/app/site/[siteId]/og/[slug]/route.ts +6 -0
  40. package/dist/templates/_shared/app/site/[siteId]/page.tsx +10 -0
  41. package/dist/templates/_shared/app/site/[siteId]/raw/[slug]/route.ts +5 -0
  42. package/dist/templates/_shared/app/site/[siteId]/sitemap.xml/route.ts +5 -0
  43. package/dist/templates/_shared/app/site/[siteId]/tag/[tag]/page.tsx +10 -0
  44. package/dist/templates/_shared/cms.config.ts +110 -0
  45. package/dist/templates/_shared/components/i18n-provider.tsx +7 -0
  46. package/dist/templates/_shared/components/lightbox-content.tsx +69 -0
  47. package/dist/templates/_shared/components/site-chrome/collapsible-sidebar.tsx +54 -0
  48. package/dist/templates/_shared/components/site-chrome/mobile-menu.tsx +68 -0
  49. package/dist/templates/_shared/components/site-chrome/site-footer.tsx +43 -0
  50. package/dist/templates/_shared/components/site-chrome/site-header.tsx +94 -0
  51. package/dist/templates/_shared/components/site-chrome/site-sidebar.tsx +81 -0
  52. package/dist/templates/_shared/components/tag-list.tsx +25 -0
  53. package/dist/templates/_shared/components.json +21 -0
  54. package/dist/templates/_shared/lib/admin-site-client.ts +10 -0
  55. package/dist/templates/_shared/lib/admin-site.ts +8 -0
  56. package/dist/templates/_shared/lib/admin.ts +24 -0
  57. package/dist/templates/_shared/lib/ampless.ts +23 -0
  58. package/dist/templates/_shared/lib/amplify-server.ts +7 -0
  59. package/dist/templates/_shared/lib/amplify.ts +9 -0
  60. package/dist/templates/_shared/lib/auth-server.ts +11 -0
  61. package/dist/templates/_shared/lib/cn.ts +5 -0
  62. package/dist/templates/_shared/lib/i18n.ts +31 -0
  63. package/dist/templates/_shared/lib/kv-provider.ts +7 -0
  64. package/dist/templates/_shared/lib/media.ts +6 -0
  65. package/dist/templates/_shared/lib/posts-provider.ts +7 -0
  66. package/dist/templates/_shared/lib/posts-public.ts +19 -0
  67. package/dist/templates/_shared/lib/posts.ts +12 -0
  68. package/dist/templates/_shared/lib/seo.ts +8 -0
  69. package/dist/templates/_shared/lib/site-settings.ts +8 -0
  70. package/dist/templates/_shared/lib/storage.ts +7 -0
  71. package/dist/templates/_shared/lib/theme-actions.ts +5 -0
  72. package/dist/templates/_shared/lib/theme-active.ts +8 -0
  73. package/dist/templates/_shared/lib/theme-config.ts +10 -0
  74. package/dist/templates/_shared/lib/upload.ts +6 -0
  75. package/dist/templates/_shared/middleware.ts +13 -0
  76. package/dist/templates/_shared/next.config.mjs +11 -0
  77. package/dist/templates/_shared/package.json +63 -0
  78. package/dist/templates/_shared/postcss.config.mjs +5 -0
  79. package/dist/templates/_shared/themes-registry.ts +38 -0
  80. package/dist/templates/_shared/tsconfig.json +23 -0
  81. package/dist/templates/blog/README.md +52 -0
  82. package/dist/templates/blog/index.ts +29 -0
  83. package/dist/templates/blog/manifest.ts +144 -0
  84. package/dist/templates/blog/pages/feed.ts +31 -0
  85. package/dist/templates/blog/pages/home.tsx +108 -0
  86. package/dist/templates/blog/pages/post.tsx +94 -0
  87. package/dist/templates/blog/pages/sitemap.ts +30 -0
  88. package/dist/templates/blog/pages/tag.tsx +76 -0
  89. package/dist/templates/blog/tokens.css +54 -0
  90. package/dist/templates/corporate/README.md +20 -0
  91. package/dist/templates/corporate/index.ts +25 -0
  92. package/dist/templates/corporate/manifest.ts +94 -0
  93. package/dist/templates/corporate/pages/feed.ts +29 -0
  94. package/dist/templates/corporate/pages/home.tsx +130 -0
  95. package/dist/templates/corporate/pages/post.tsx +96 -0
  96. package/dist/templates/corporate/pages/sitemap.ts +28 -0
  97. package/dist/templates/corporate/pages/tag.tsx +81 -0
  98. package/dist/templates/corporate/tokens.css +47 -0
  99. package/dist/templates/dads/README.md +35 -0
  100. package/dist/templates/dads/index.ts +25 -0
  101. package/dist/templates/dads/manifest.ts +84 -0
  102. package/dist/templates/dads/pages/feed.ts +29 -0
  103. package/dist/templates/dads/pages/home.tsx +126 -0
  104. package/dist/templates/dads/pages/post.tsx +102 -0
  105. package/dist/templates/dads/pages/sitemap.ts +28 -0
  106. package/dist/templates/dads/pages/tag.tsx +86 -0
  107. package/dist/templates/dads/tokens.css +67 -0
  108. package/dist/templates/docs/README.md +27 -0
  109. package/dist/templates/docs/index.ts +25 -0
  110. package/dist/templates/docs/manifest.ts +89 -0
  111. package/dist/templates/docs/pages/feed.ts +29 -0
  112. package/dist/templates/docs/pages/home.tsx +88 -0
  113. package/dist/templates/docs/pages/post.tsx +96 -0
  114. package/dist/templates/docs/pages/sitemap.ts +28 -0
  115. package/dist/templates/docs/pages/tag.tsx +79 -0
  116. package/dist/templates/docs/tokens.css +55 -0
  117. package/dist/templates/landing/README.md +25 -0
  118. package/dist/templates/landing/index.ts +25 -0
  119. package/dist/templates/landing/manifest.ts +118 -0
  120. package/dist/templates/landing/pages/feed.ts +31 -0
  121. package/dist/templates/landing/pages/home.tsx +123 -0
  122. package/dist/templates/landing/pages/post.tsx +95 -0
  123. package/dist/templates/landing/pages/sitemap.ts +28 -0
  124. package/dist/templates/landing/pages/tag.tsx +85 -0
  125. package/dist/templates/landing/tokens.css +47 -0
  126. package/dist/templates/minimal/README.md +52 -0
  127. package/dist/templates/minimal/index.ts +25 -0
  128. package/dist/templates/minimal/manifest.ts +35 -0
  129. package/dist/templates/minimal/pages/feed.ts +31 -0
  130. package/dist/templates/minimal/pages/home.tsx +44 -0
  131. package/dist/templates/minimal/pages/post.tsx +65 -0
  132. package/dist/templates/minimal/pages/sitemap.ts +30 -0
  133. package/dist/templates/minimal/pages/tag.tsx +46 -0
  134. package/dist/templates/minimal/tokens.css +46 -0
  135. package/package.json +41 -0
@@ -0,0 +1,30 @@
1
+ import { publicAssetUrl } from '@/lib/storage'
2
+
3
+ interface Ctx {
4
+ siteId: string
5
+ request: Request
6
+ }
7
+
8
+ // /sitemap.xml proxy — plugin-seo regenerates the sitemap on every
9
+ // content event and writes it to `public/plugins/seo/{siteId}/sitemap.xml`.
10
+ export async function minimalSitemapHandler({ siteId }: Ctx): Promise<Response> {
11
+ const url = publicAssetUrl(`public/plugins/seo/${siteId}/sitemap.xml`)
12
+ const upstream = await fetch(url, { cache: 'no-store' })
13
+ if (!upstream.ok) {
14
+ return new Response(
15
+ `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"></urlset>\n`,
16
+ {
17
+ headers: {
18
+ 'Content-Type': 'application/xml; charset=utf-8',
19
+ 'Cache-Control': 'public, max-age=60',
20
+ },
21
+ }
22
+ )
23
+ }
24
+ return new Response(upstream.body, {
25
+ headers: {
26
+ 'Content-Type': 'application/xml; charset=utf-8',
27
+ 'Cache-Control': 'public, max-age=300',
28
+ },
29
+ })
30
+ }
@@ -0,0 +1,46 @@
1
+ import Link from 'next/link'
2
+ import { notFound } from 'next/navigation'
3
+ import { formatDate, type ThemeRouteContext } from 'ampless'
4
+ import { listPostsByTag } from '@/lib/posts-public'
5
+ import { loadSiteSettings } from '@/lib/site-settings'
6
+ import { t } from '@/lib/i18n'
7
+
8
+ export default async function MinimalTag({ params }: ThemeRouteContext<{ tag: string }>) {
9
+ const { siteId, tag } = await params
10
+ const decodedTag = decodeURIComponent(tag)
11
+ const [{ items: posts }, settings] = await Promise.all([
12
+ listPostsByTag(decodedTag, { siteId, limit: 50 }),
13
+ loadSiteSettings(siteId),
14
+ ])
15
+
16
+ if (posts.length === 0) notFound()
17
+
18
+ return (
19
+ <main className="mx-auto max-w-2xl px-6 py-12">
20
+ <nav className="mb-8">
21
+ <Link href="/" className="text-sm text-gray-500 hover:underline">{t('public.home')}</Link>
22
+ </nav>
23
+
24
+ <header className="mb-12 border-b pb-6">
25
+ <p className="text-sm text-gray-500">{t('public.tagLabel')}</p>
26
+ <h1 className="text-4xl font-bold tracking-tight">#{decodedTag}</h1>
27
+ </header>
28
+
29
+ <ul className="space-y-8">
30
+ {posts.map((post) => (
31
+ <li key={post.postId}>
32
+ <Link href={`/${post.slug}`} className="block group">
33
+ <h2 className="text-2xl font-semibold group-hover:underline">{post.title}</h2>
34
+ {post.publishedAt && (
35
+ <time dateTime={post.publishedAt} className="text-sm text-gray-500">
36
+ {formatDate(post.publishedAt, settings.dateFormat, settings.timezone)}
37
+ </time>
38
+ )}
39
+ {post.excerpt && <p className="mt-2 text-gray-700">{post.excerpt}</p>}
40
+ </Link>
41
+ </li>
42
+ ))}
43
+ </ul>
44
+ </main>
45
+ )
46
+ }
@@ -0,0 +1,46 @@
1
+ /* Minimal theme tokens — soft blue accent on warm neutral. Same scoped
2
+ * pattern as templates/blog/tokens.css; see that file for context. */
3
+
4
+ [data-theme='minimal'] {
5
+ --background: oklch(0.99 0.005 90);
6
+ --foreground: oklch(0.18 0.02 250);
7
+ --card: oklch(1 0 0);
8
+ --card-foreground: oklch(0.18 0.02 250);
9
+ --primary: oklch(0.55 0.18 250);
10
+ --primary-foreground: oklch(0.985 0 0);
11
+ --secondary: oklch(0.95 0.01 250);
12
+ --secondary-foreground: oklch(0.25 0.05 250);
13
+ --muted: oklch(0.95 0.01 250);
14
+ --muted-foreground: oklch(0.5 0.02 250);
15
+ --accent: oklch(0.95 0.03 250);
16
+ --accent-foreground: oklch(0.3 0.08 250);
17
+ --destructive: oklch(0.577 0.245 27.325);
18
+ --destructive-foreground: oklch(0.985 0 0);
19
+ --border: oklch(0.9 0.01 250);
20
+ --input: oklch(0.9 0.01 250);
21
+ --ring: oklch(0.55 0.18 250);
22
+ --radius: 0.375rem;
23
+ --ampless-body-font: system-ui, -apple-system, sans-serif;
24
+ }
25
+
26
+ @media (prefers-color-scheme: dark) {
27
+ [data-theme='minimal'] {
28
+ --background: oklch(0.18 0.02 250);
29
+ --foreground: oklch(0.95 0.01 250);
30
+ --card: oklch(0.22 0.02 250);
31
+ --card-foreground: oklch(0.95 0.01 250);
32
+ --primary: oklch(0.75 0.18 250);
33
+ --primary-foreground: oklch(0.18 0.02 250);
34
+ --secondary: oklch(0.28 0.03 250);
35
+ --secondary-foreground: oklch(0.95 0.01 250);
36
+ --muted: oklch(0.28 0.03 250);
37
+ --muted-foreground: oklch(0.7 0.02 250);
38
+ --accent: oklch(0.32 0.05 250);
39
+ --accent-foreground: oklch(0.95 0.01 250);
40
+ --destructive: oklch(0.5 0.2 27);
41
+ --destructive-foreground: oklch(0.985 0 0);
42
+ --border: oklch(0.32 0.03 250);
43
+ --input: oklch(0.32 0.03 250);
44
+ --ring: oklch(0.55 0.18 250);
45
+ }
46
+ }
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "create-ampless",
3
+ "version": "0.2.0-alpha.0",
4
+ "description": "Create a new ampless project",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "create-ampless": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/heavymoons/ampless.git",
20
+ "directory": "packages/create-ampless"
21
+ },
22
+ "homepage": "https://github.com/heavymoons/ampless#readme",
23
+ "bugs": "https://github.com/heavymoons/ampless/issues",
24
+ "dependencies": {
25
+ "@clack/prompts": "^0.9.1",
26
+ "picocolors": "^1.1.1"
27
+ },
28
+ "keywords": [
29
+ "cms",
30
+ "aws",
31
+ "amplify",
32
+ "serverless",
33
+ "create"
34
+ ],
35
+ "scripts": {
36
+ "build": "tsup",
37
+ "dev": "tsup --watch",
38
+ "lint": "tsc --noEmit",
39
+ "test": "vitest run --passWithNoTests"
40
+ }
41
+ }