@lemonadecms/create 0.0.0-stage → 0.1.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.
Files changed (107) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +21 -0
  3. package/README.md +42 -2
  4. package/bin/create-lemonade.mjs +124 -0
  5. package/dist/catalog.json +772 -0
  6. package/dist/templates/angular/angular.json +54 -0
  7. package/dist/templates/angular/locks/npm-lock.json.template +7079 -0
  8. package/dist/templates/angular/locks/pnpm-lock.yaml.template +4237 -0
  9. package/dist/templates/angular/locks/yarn.lock.template +4899 -0
  10. package/dist/templates/angular/package.json +68 -0
  11. package/dist/templates/angular/src/app/app.config.server.ts +23 -0
  12. package/dist/templates/angular/src/app/app.config.ts +34 -0
  13. package/dist/templates/angular/src/app/app.ts +9 -0
  14. package/dist/templates/angular/src/app/blog.service.ts +74 -0
  15. package/dist/templates/angular/src/app/journal.html +71 -0
  16. package/dist/templates/angular/src/app/journal.ts +47 -0
  17. package/dist/templates/angular/src/index.html +14 -0
  18. package/dist/templates/angular/src/main.server.ts +5 -0
  19. package/dist/templates/angular/src/main.ts +6 -0
  20. package/dist/templates/angular/src/server.ts +79 -0
  21. package/dist/templates/angular/tsconfig.app.json +8 -0
  22. package/dist/templates/angular/tsconfig.json +21 -0
  23. package/dist/templates/angular/vendor/README.md +32 -0
  24. package/dist/templates/angular/vendor/picomatch-4.0.7-lemonade-sec51.1.tgz +0 -0
  25. package/dist/templates/angular/vendor/picomatch-4.0.7.patch +59 -0
  26. package/dist/templates/angular/vendor/provenance.json +29 -0
  27. package/dist/templates/astro/astro.config.mjs +7 -0
  28. package/dist/templates/astro/locks/npm-lock.json.template +5478 -0
  29. package/dist/templates/astro/locks/pnpm-lock.yaml.template +3537 -0
  30. package/dist/templates/astro/locks/yarn.lock.template +4085 -0
  31. package/dist/templates/astro/package.json +51 -0
  32. package/dist/templates/astro/src/components/BlogView.astro +92 -0
  33. package/dist/templates/astro/src/layouts/Site.astro +23 -0
  34. package/dist/templates/astro/src/pages/articles/[id].astro +13 -0
  35. package/dist/templates/astro/src/pages/index.astro +13 -0
  36. package/dist/templates/astro/src/pages/lemonade/preview/[...path].ts +4 -0
  37. package/dist/templates/astro/src/pages/lemonade/preview.ts +4 -0
  38. package/dist/templates/astro/tsconfig.json +9 -0
  39. package/dist/templates/astro/vendor/README.md +32 -0
  40. package/dist/templates/astro/vendor/picomatch-2.3.2-lemonade-sec51.1.tgz +0 -0
  41. package/dist/templates/astro/vendor/picomatch-2.3.2.patch +59 -0
  42. package/dist/templates/astro/vendor/picomatch-4.0.7-lemonade-sec51.1.tgz +0 -0
  43. package/dist/templates/astro/vendor/picomatch-4.0.7.patch +59 -0
  44. package/dist/templates/astro/vendor/provenance.json +43 -0
  45. package/dist/templates/next/app/articles/[id]/page.tsx +29 -0
  46. package/dist/templates/next/app/data.ts +12 -0
  47. package/dist/templates/next/app/error.tsx +15 -0
  48. package/dist/templates/next/app/layout.tsx +13 -0
  49. package/dist/templates/next/app/lemonade/preview/[[...path]]/route.ts +7 -0
  50. package/dist/templates/next/app/loading.tsx +7 -0
  51. package/dist/templates/next/app/not-found.tsx +8 -0
  52. package/dist/templates/next/app/page.tsx +17 -0
  53. package/dist/templates/next/app/view.tsx +111 -0
  54. package/dist/templates/next/locks/npm-lock.json.template +1158 -0
  55. package/dist/templates/next/locks/pnpm-lock.yaml.template +715 -0
  56. package/dist/templates/next/locks/yarn.lock.template +775 -0
  57. package/dist/templates/next/next-env.d.ts +2 -0
  58. package/dist/templates/next/next.config.mjs +8 -0
  59. package/dist/templates/next/package.json +44 -0
  60. package/dist/templates/next/proxy.ts +19 -0
  61. package/dist/templates/next/tsconfig.json +25 -0
  62. package/dist/templates/nuxt/app/app.vue +1 -0
  63. package/dist/templates/nuxt/app/components/JournalView.vue +75 -0
  64. package/dist/templates/nuxt/app/pages/articles/[id].vue +8 -0
  65. package/dist/templates/nuxt/app/pages/index.vue +8 -0
  66. package/dist/templates/nuxt/locks/npm-lock.json.template +9113 -0
  67. package/dist/templates/nuxt/locks/pnpm-lock.yaml.template +6471 -0
  68. package/dist/templates/nuxt/locks/yarn.lock.template +6915 -0
  69. package/dist/templates/nuxt/nuxt.config.ts +27 -0
  70. package/dist/templates/nuxt/package.json +66 -0
  71. package/dist/templates/nuxt/server/api/blog/[id].get.ts +10 -0
  72. package/dist/templates/nuxt/server/api/blog.get.ts +9 -0
  73. package/dist/templates/nuxt/server/middleware/preview.ts +9 -0
  74. package/dist/templates/nuxt/server/utils/cms-environment.ts +15 -0
  75. package/dist/templates/nuxt/tsconfig.json +7 -0
  76. package/dist/templates/nuxt/vendor/README.md +32 -0
  77. package/dist/templates/nuxt/vendor/picomatch-2.3.2-lemonade-sec51.1.tgz +0 -0
  78. package/dist/templates/nuxt/vendor/picomatch-2.3.2.patch +59 -0
  79. package/dist/templates/nuxt/vendor/picomatch-4.0.7-lemonade-sec51.1.tgz +0 -0
  80. package/dist/templates/nuxt/vendor/picomatch-4.0.7.patch +59 -0
  81. package/dist/templates/nuxt/vendor/provenance.json +43 -0
  82. package/dist/templates/shared/GETTING_STARTED.md +29 -0
  83. package/dist/templates/shared/README.md +8 -0
  84. package/dist/templates/shared/env.example.template +11 -0
  85. package/dist/templates/shared/gitignore.template +16 -0
  86. package/dist/templates/shared/model-template.json +75 -0
  87. package/dist/templates/shared/public/blog.css +255 -0
  88. package/dist/templates/shared/public/lemonade.svg +5 -0
  89. package/dist/templates/shared/schema-contract.json +37 -0
  90. package/dist/templates/shared/scripts/cms-tools.mjs +171 -0
  91. package/dist/templates/shared/scripts/environment.mjs +68 -0
  92. package/dist/templates/shared/scripts/run.mjs +122 -0
  93. package/dist/templates/shared/server/blog.d.mts +35 -0
  94. package/dist/templates/shared/server/blog.mjs +159 -0
  95. package/dist/templates/shared/server/config.d.mts +11 -0
  96. package/dist/templates/shared/server/config.mjs +42 -0
  97. package/dist/templates/shared/server/preview.d.mts +4 -0
  98. package/dist/templates/shared/server/preview.mjs +276 -0
  99. package/dist/templates/shared/src/types/cms-models.ts +37 -0
  100. package/dist/templates/shared/yarnrc.yml.template +2 -0
  101. package/package.json +24 -4
  102. package/src/arguments.mjs +75 -0
  103. package/src/catalog.mjs +166 -0
  104. package/src/errors.mjs +10 -0
  105. package/src/generation.mjs +103 -0
  106. package/src/paths.mjs +90 -0
  107. package/src/prompts.mjs +68 -0
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "lemonade-blog",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "engines": {
7
+ "node": "^22.23.5 || ^24.22.3"
8
+ },
9
+ "packageManager": "npm@11.6.2",
10
+ "lemonade": {
11
+ "framework": "astro",
12
+ "contract": 1
13
+ },
14
+ "scripts": {
15
+ "dev": "node scripts/run.mjs dev",
16
+ "check": "node scripts/run.mjs check",
17
+ "build": "node scripts/run.mjs build",
18
+ "start": "node scripts/run.mjs start",
19
+ "cms:setup": "node scripts/cms-tools.mjs setup",
20
+ "cms:check": "node scripts/cms-tools.mjs check",
21
+ "cms:types": "node scripts/cms-tools.mjs types"
22
+ },
23
+ "dependencies": {
24
+ "@lemonadecms/client": "0.2.3",
25
+ "markdown-it": "15.0.3",
26
+ "astro": "7.4.7",
27
+ "@astrojs/node": "11.1.12"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "24.10.1",
31
+ "@types/markdown-it": "14.1.2",
32
+ "@astrojs/check": "0.9.12",
33
+ "typescript": "5.9.3"
34
+ },
35
+ "pnpm": {
36
+ "onlyBuiltDependencies": [
37
+ "@parcel/watcher",
38
+ "esbuild",
39
+ "sharp"
40
+ ],
41
+ "overrides": {
42
+ "picomatch@2.3.2": "file:vendor/picomatch-2.3.2-lemonade-sec51.1.tgz",
43
+ "picomatch@4.0.7": "file:vendor/picomatch-4.0.7-lemonade-sec51.1.tgz"
44
+ }
45
+ },
46
+ "resolutions": {
47
+ "picomatch@npm:^2.0.4": "file:./vendor/picomatch-2.3.2-lemonade-sec51.1.tgz",
48
+ "picomatch@npm:^4.0.4": "file:./vendor/picomatch-4.0.7-lemonade-sec51.1.tgz",
49
+ "picomatch@npm:^4.0.7": "file:./vendor/picomatch-4.0.7-lemonade-sec51.1.tgz"
50
+ }
51
+ }
@@ -0,0 +1,92 @@
1
+ ---
2
+ import { message, type BlogView } from '../../server/blog.mjs';
3
+ interface Props {
4
+ view: BlogView;
5
+ }
6
+ const { view } = Astro.props;
7
+ ---
8
+
9
+ <a class="skip" href="#content">
10
+ Skip to content
11
+ </a>
12
+ <header>
13
+ <a class="brand" href="/">
14
+ <span class="mark" aria-hidden="true"></span>Lemonade journal
15
+ </a>
16
+ <a href="https://app.lemonadecms.com">Studio</a>
17
+ </header>
18
+ <main id="content">
19
+ {view.state !== 'ready' ? (
20
+ <section class="notice" role="status">
21
+ <h1>{message(view.state)}</h1>
22
+ <p>
23
+ {view.state === 'unconfigured'
24
+ ? 'Follow GETTING_STARTED.md and configure your workspace, environment and published read token.'
25
+ : 'Your published content has not been replaced. Try again or check the connection.'}
26
+ </p>
27
+ <a class="button" href="/">
28
+ Return to journal
29
+ </a>
30
+ </section>
31
+ ) : view.article ? (
32
+ <article class="article">
33
+ <a href={`/?page=${view.page}`}>Back to journal</a>
34
+ <h1>{view.article.title}</h1>
35
+ <p class="byline">
36
+ <span>{view.article.author}</span>
37
+ <time>{view.article.date}</time>
38
+ </p>
39
+ {view.article.image && (
40
+ <img class="post-image" src={view.article.image} alt={view.article.imageAlt} />
41
+ )}
42
+ <div class="body" set:html={view.article.bodyHtml} />
43
+ </article>
44
+ ) : (
45
+ <>
46
+ <section class="hero">
47
+ <h1>
48
+ A little room
49
+ <br />
50
+ for good ideas.
51
+ </h1>
52
+ <p>Notes, stories and new perspectives. Published with Lemonade CMS.</p>
53
+ </section>
54
+ {view.posts.length ? (
55
+ <section class="posts" aria-label="Published articles">
56
+ {view.posts.map((post) => (
57
+ <article class="post">
58
+ {post.image && (
59
+ <img class="post-image" src={post.image} alt="" loading="lazy" />
60
+ )}
61
+ <h2>
62
+ <a href={`/articles/${post.id}?page=${view.page}`}>{post.title}</a>
63
+ </h2>
64
+ <p>{post.description}</p>
65
+ <div class="byline">
66
+ <span>{post.author}</span>
67
+ <time>{post.date}</time>
68
+ </div>
69
+ </article>
70
+ ))}
71
+ </section>
72
+ ) : (
73
+ <section class="notice">
74
+ <h2>No published articles yet</h2>
75
+ <p>
76
+ Publish an author and article in the selected Studio environment to begin.
77
+ </p>
78
+ </section>
79
+ )}
80
+ <nav class="pagination" aria-label="Article pages">
81
+ {view.hasPrevious ? (
82
+ <a href={`/?page=${view.page - 1}`}>Previous page</a>
83
+ ) : (
84
+ <span />
85
+ )}
86
+ <span>Page {view.page}</span>
87
+ {view.hasNext ? <a href={`/?page=${view.page + 1}`}>Next page</a> : <span />}
88
+ </nav>
89
+ </>
90
+ )}
91
+ </main>
92
+ <footer>Your ideas, thoughtfully published.</footer>
@@ -0,0 +1,23 @@
1
+ ---
2
+ import type { BlogView } from '../../server/blog.mjs';
3
+ interface Props {
4
+ view: BlogView;
5
+ }
6
+ const { view } = Astro.props;
7
+ ---
8
+
9
+ <!doctype html>
10
+ <html lang={view.locale}>
11
+ <head>
12
+ <meta charset="utf-8" />
13
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
14
+ <title>{view.title}</title>
15
+ <meta name="description" content={view.description} />
16
+ {view.canonical && <link rel="canonical" href={view.canonical} />}
17
+ <link rel="stylesheet" href="/blog.css" />
18
+ <link rel="icon" href="/lemonade.svg" type="image/svg+xml" />
19
+ </head>
20
+ <body>
21
+ <slot />
22
+ </body>
23
+ </html>
@@ -0,0 +1,13 @@
1
+ ---
2
+ import { readBlog, headers } from '../../../server/blog.mjs';
3
+ import Site from '../../layouts/Site.astro';
4
+ import BlogView from '../../components/BlogView.astro';
5
+ const view = await readBlog(Astro.url.href, { id: Astro.params.id });
6
+ Astro.response.status = view.status;
7
+ for (const [key, value] of Object.entries(headers))
8
+ Astro.response.headers.set(key, value);
9
+ ---
10
+
11
+ <Site view={view}>
12
+ <BlogView view={view} />
13
+ </Site>
@@ -0,0 +1,13 @@
1
+ ---
2
+ import { readBlog, headers } from '../../server/blog.mjs';
3
+ import Site from '../layouts/Site.astro';
4
+ import BlogView from '../components/BlogView.astro';
5
+ const view = await readBlog(Astro.url.href);
6
+ Astro.response.status = view.status;
7
+ for (const [key, value] of Object.entries(headers))
8
+ Astro.response.headers.set(key, value);
9
+ ---
10
+
11
+ <Site view={view}>
12
+ <BlogView view={view} />
13
+ </Site>
@@ -0,0 +1,4 @@
1
+ import type { APIRoute } from 'astro';
2
+ import { handlePreview } from '../../../../server/preview.mjs';
3
+ export const ALL: APIRoute = async ({ request }) =>
4
+ (await handlePreview(request)) || new Response('Not found', { status: 404 });
@@ -0,0 +1,4 @@
1
+ import type { APIRoute } from 'astro';
2
+ import { handlePreview } from '../../../server/preview.mjs';
3
+ export const ALL: APIRoute = async ({ request }) =>
4
+ (await handlePreview(request)) || new Response('Not found', { status: 404 });
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "astro/tsconfigs/strict",
3
+ "compilerOptions": {
4
+ "allowJs": true,
5
+ "checkJs": false
6
+ },
7
+ "include": [".astro/types.d.ts", "**/*"],
8
+ "exclude": ["dist"]
9
+ }
@@ -0,0 +1,32 @@
1
+ # Local picomatch security backports
2
+
3
+ These archives contain Lemonade's SEC-51 parser backports for
4
+ [GHSA-fc5q-39xc-vjpf](https://github.com/advisories/GHSA-fc5q-39xc-vjpf), not an
5
+ upstream patched release. Each retains the original package name/version and MIT
6
+ license. No install hook modifies node_modules. Keep this directory with the app.
7
+
8
+ Use the supplied frozen lock (`npm ci` or `pnpm install --frozen-lockfile`). npm
9
+ locks bind each transitive occurrence directly to its local archive/integrity;
10
+ pnpm additionally uses exact-version local overrides. Updating dependencies or
11
+ regenerating locks requires reviewing all picomatch resolutions. Ordinary npm
12
+ audit tools still identify the original upstream versions as affected.
13
+
14
+ Simple single-branch repeated wildcard patterns retain matching behavior without
15
+ nested unbounded quantifiers. Unsafe complex wildcard/capture patterns use
16
+ picomatch's existing literal fallback; their former complex/capture semantics
17
+ are intentionally unavailable. Quoted/escaped stars and ordinary globs retain
18
+ their behavior. The existing explicit `maxExtglobRecursion: false` disables safety;
19
+ never use it with untrusted patterns.
20
+
21
+ `provenance.json` records original npm SRI/SHA-256, parser/patch/output hashes and
22
+ inspected upstream PR heads. The original archives are obtainable from npm's
23
+ `picomatch` registry record for that exact version. Verify their SRI before
24
+ applying the included single-file patches to `package/lib/parse.js`. Every other
25
+ file, including package metadata and license, remains byte-identical. The
26
+ repository's `scripts/security/picomatch_backports.py` rebuilds canonical tar/gzip
27
+ outputs with sorted names, fixed modes, zero timestamps and no links.
28
+
29
+ Upstream PRs 237 and 246 were open and unmerged when inspected. Replace these
30
+ local backports only with a reviewed upstream fix qualified against this app's
31
+ actual framework and both package managers. Regenerate and review locks together;
32
+ do not silently remove the patch or rename its version to bypass an advisory.
@@ -0,0 +1,59 @@
1
+ --- a/lib/parse.js
2
+ +++ b/lib/parse.js
3
+ @@ -280,6 +280,33 @@
4
+ return depth;
5
+ };
6
+
7
+ +// Lemonade SEC-51 backport: preserve simple repeated-star languages without
8
+ +// nesting unbounded quantifiers. Other bare-star shapes use the existing risky
9
+ +// extglob literal fallback. Quoted/escaped/class stars are not wildcard stars.
10
+ +const analyzeSingleStarBranch = (branch, options) => {
11
+ + let quoted = false;
12
+ + let escaped = false;
13
+ + let bracket = false;
14
+ + let wildcard = false;
15
+ +
16
+ + for (let i = 0; i < branch.length; i++) {
17
+ + const ch = branch[i];
18
+ + if (escaped) { escaped = false; continue; }
19
+ + if (ch === '\\') { escaped = true; continue; }
20
+ + if (ch === '"' && !bracket) { quoted = !quoted; continue; }
21
+ + if (quoted) continue;
22
+ + if (ch === '[') { bracket = true; continue; }
23
+ + if (ch === ']' && bracket) { bracket = false; continue; }
24
+ + if (!bracket && ch === '*' && branch[i + 1] !== '(') wildcard = true;
25
+ + }
26
+ +
27
+ + if (!wildcard) return null;
28
+ + if (options.capture === true || branch.includes('**') || /[\\/"?()[\]{}|!+@]/.test(branch)) {
29
+ + return { risky: true };
30
+ + }
31
+ + return { risky: false, collapse: true };
32
+ +};
33
+ +
34
+ const analyzeRepeatedExtglob = (body, options) => {
35
+ if (options.maxExtglobRecursion === false) {
36
+ return { risky: false };
37
+ @@ -311,6 +338,11 @@
38
+ if (repeatedExtglobRecursion(branch) > max) {
39
+ return { risky: true };
40
+ }
41
+ + }
42
+ +
43
+ + if (branches.length === 1) {
44
+ + const single = analyzeSingleStarBranch(branches[0], options);
45
+ + if (single) return single;
46
+ }
47
+
48
+ return { risky: false };
49
+ @@ -536,6 +568,10 @@
50
+ return;
51
+ }
52
+
53
+ + if (analysis.collapse === true && (token.type === 'plus' || token.type === 'star')) {
54
+ + token.close = token.type === 'plus' ? ')' : ')?';
55
+ + }
56
+ +
57
+ let output = token.close + (opts.capture ? ')' : '');
58
+ let rest;
59
+
@@ -0,0 +1,59 @@
1
+ --- a/lib/parse.js
2
+ +++ b/lib/parse.js
3
+ @@ -284,6 +284,33 @@
4
+ return depth;
5
+ };
6
+
7
+ +// Lemonade SEC-51 backport: preserve simple repeated-star languages without
8
+ +// nesting unbounded quantifiers. Other bare-star shapes use the existing risky
9
+ +// extglob literal fallback. Quoted/escaped/class stars are not wildcard stars.
10
+ +const analyzeSingleStarBranch = (branch, options) => {
11
+ + let quoted = false;
12
+ + let escaped = false;
13
+ + let bracket = false;
14
+ + let wildcard = false;
15
+ +
16
+ + for (let i = 0; i < branch.length; i++) {
17
+ + const ch = branch[i];
18
+ + if (escaped) { escaped = false; continue; }
19
+ + if (ch === '\\') { escaped = true; continue; }
20
+ + if (ch === '"' && !bracket) { quoted = !quoted; continue; }
21
+ + if (quoted) continue;
22
+ + if (ch === '[') { bracket = true; continue; }
23
+ + if (ch === ']' && bracket) { bracket = false; continue; }
24
+ + if (!bracket && ch === '*' && branch[i + 1] !== '(') wildcard = true;
25
+ + }
26
+ +
27
+ + if (!wildcard) return null;
28
+ + if (options.capture === true || branch.includes('**') || /[\\/"?()[\]{}|!+@]/.test(branch)) {
29
+ + return { risky: true };
30
+ + }
31
+ + return { risky: false, collapse: true };
32
+ +};
33
+ +
34
+ const analyzeRepeatedExtglob = (body, options) => {
35
+ if (options.maxExtglobRecursion === false) {
36
+ return { risky: false };
37
+ @@ -341,6 +368,11 @@
38
+ return combinable
39
+ ? { risky: true, safeOutput: buildCharClassStar([...new Set(safeChars)]) }
40
+ : { risky: true };
41
+ + }
42
+ +
43
+ + if (branches.length === 1) {
44
+ + const single = analyzeSingleStarBranch(branches[0], options);
45
+ + if (single) return single;
46
+ }
47
+
48
+ return { risky: false };
49
+ @@ -565,6 +597,10 @@
50
+ return;
51
+ }
52
+
53
+ + if (analysis.collapse === true && (token.type === 'plus' || token.type === 'star')) {
54
+ + token.close = token.type === 'plus' ? ')' : ')?';
55
+ + }
56
+ +
57
+ let output = token.close + (opts.capture ? ')' : '');
58
+ let rest;
59
+
@@ -0,0 +1,43 @@
1
+ {
2
+ "advisory": "GHSA-fc5q-39xc-vjpf",
3
+ "upstream_fixes": [
4
+ {
5
+ "url": "https://github.com/micromatch/picomatch/pull/237",
6
+ "head": "1bf0d04563cb9ce568cf36efc5f6b7187d9911d5"
7
+ },
8
+ {
9
+ "url": "https://github.com/micromatch/picomatch/pull/246",
10
+ "head": "f03bec2c02e46f063fbfdc161aae1d0f854b2565"
11
+ }
12
+ ],
13
+ "packages": [
14
+ {
15
+ "name": "picomatch",
16
+ "version": "2.3.2",
17
+ "upstream": "upstream/picomatch-2.3.2.tgz",
18
+ "upstream_sha256": "4c843ba015bec815ac52116162559ab7b4b4efbd3b86f7fcf38f3d770decace6",
19
+ "upstream_integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
20
+ "patch": "patches/picomatch-2.3.2.patch",
21
+ "patch_sha256": "1d0762b3d2d7baa6917dee9f17bbe70eb41f66b37b2fbd7ae52dcd833cdd7f86",
22
+ "original_parser_sha256": "3a91656f440069aa8f8e15c9d695b9f6b2209df1eab2be8127c72cbcca45ff5f",
23
+ "patched_parser_sha256": "9b01b55a8c3de44f8f73d910ae1c56f5d1dd6c2eba19c7f61a62a337ab785816",
24
+ "archive": "archives/picomatch-2.3.2-lemonade-sec51.1.tgz",
25
+ "archive_sha256": "a1bba26d10270d5f1bd36062400aaaebeb4473e3507b61aaba4fb932cb54daa5",
26
+ "archive_integrity": "sha512-7zQO4hSvfvH7CcUPXD8tFo7X0Yh3gUgifS8by7hrbggrQO4yYoCkkY3BopG7HcxQ51dKtrk2a8h5KyBe8SyxKw=="
27
+ },
28
+ {
29
+ "name": "picomatch",
30
+ "version": "4.0.7",
31
+ "upstream": "upstream/picomatch-4.0.7.tgz",
32
+ "upstream_sha256": "697b463be3cdbd9ffc8f4194fd5019a69ddf95875fb703d78b2b115cc9e740a8",
33
+ "upstream_integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
34
+ "patch": "patches/picomatch-4.0.7.patch",
35
+ "patch_sha256": "ed1fe75757af96f132a2adb63d12376994e1d9582e8c6e7dd9741ecae9ddf9bc",
36
+ "original_parser_sha256": "4e1e05447668aa1e94366c5516a2bcd8f5fff800cc92b1d0cd7d77703b8618c4",
37
+ "patched_parser_sha256": "01c40acfda6f7c40a32dd4e6671cbec1c70e22f980cda8b22ea64d948a323c0c",
38
+ "archive": "archives/picomatch-4.0.7-lemonade-sec51.1.tgz",
39
+ "archive_sha256": "a0af57ad2de1444dbb70588db2444e906a47a5bd77c5150905cbfd6de02d636c",
40
+ "archive_integrity": "sha512-jkjudKn+93rODxiTonD3ehUEbHrHtSWpYcdZglbGGSbbc/Aqjz6j3R/1m0uuQJQXqFY/WZTtv9F+ZSM3ZCSrdA=="
41
+ }
42
+ ]
43
+ }
@@ -0,0 +1,29 @@
1
+ import { getBlog, query } from '../../data';
2
+ import { Journal } from '../../view';
3
+ import { notFound } from 'next/navigation';
4
+ export const dynamic = 'force-dynamic';
5
+ export const runtime = 'nodejs';
6
+ type Props = {
7
+ params: Promise<{ id: string }>;
8
+ searchParams: Promise<Record<string, string | string[] | undefined>>;
9
+ };
10
+ async function read(p: Props) {
11
+ const { id } = await p.params;
12
+ return getBlog(
13
+ '/articles/' + encodeURIComponent(id) + query(await p.searchParams),
14
+ id,
15
+ );
16
+ }
17
+ export async function generateMetadata(p: Props) {
18
+ const v = await read(p);
19
+ return {
20
+ title: v.title,
21
+ description: v.description,
22
+ alternates: { canonical: v.canonical },
23
+ };
24
+ }
25
+ export default async function Page(p: Props) {
26
+ const v = await read(p);
27
+ if (v.status === 404) notFound();
28
+ return <Journal view={v} />;
29
+ }
@@ -0,0 +1,12 @@
1
+ import { cache } from 'react';
2
+ import { readBlog } from '../server/blog.mjs';
3
+ export const getBlog = cache(async (path: string, id?: string) =>
4
+ readBlog('http://request.invalid' + path, { id }),
5
+ );
6
+ export function query(values: Record<string, string | string[] | undefined>) {
7
+ const q = new URLSearchParams();
8
+ for (const [key, value] of Object.entries(values))
9
+ if (Array.isArray(value)) for (const item of value) q.append(key, item);
10
+ else if (value !== undefined) q.set(key, value);
11
+ return q.size ? '?' + q.toString() : '';
12
+ }
@@ -0,0 +1,15 @@
1
+ 'use client';
2
+ export default function ErrorView({ reset }: { reset: () => void }) {
3
+ return (
4
+ <main id="content" className="notice">
5
+ <h1>Content is temporarily unavailable</h1>
6
+ <p>Your content has not changed.</p>
7
+ <button className="button" onClick={() => reset()}>
8
+ Try again
9
+ </button>
10
+ <p>
11
+ <a href="/">Return to journal</a>
12
+ </p>
13
+ </main>
14
+ );
15
+ }
@@ -0,0 +1,13 @@
1
+ import { configuration } from '../server/config.mjs';
2
+ import type { ReactNode } from 'react';
3
+ export default function Layout({ children }: { children: ReactNode }) {
4
+ return (
5
+ <html lang={configuration()?.locale || 'en'}>
6
+ <head>
7
+ <link rel="stylesheet" href="/blog.css" />
8
+ <link rel="icon" href="/lemonade.svg" type="image/svg+xml" />
9
+ </head>
10
+ <body>{children}</body>
11
+ </html>
12
+ );
13
+ }
@@ -0,0 +1,7 @@
1
+ import { handlePreview } from '../../../../server/preview.mjs';
2
+ export const runtime = 'nodejs';
3
+ export const dynamic = 'force-dynamic';
4
+ export async function GET(request: Request) {
5
+ return (await handlePreview(request)) || new Response('Not found', { status: 404 });
6
+ }
7
+ export const POST = GET;
@@ -0,0 +1,7 @@
1
+ export default function Loading() {
2
+ return (
3
+ <main id="content">
4
+ <p role="status">Loading published articles…</p>
5
+ </main>
6
+ );
7
+ }
@@ -0,0 +1,8 @@
1
+ export default function NotFound() {
2
+ return (
3
+ <main className="notice">
4
+ <h1>This article is not available.</h1>
5
+ <a href="/">Return to journal</a>
6
+ </main>
7
+ );
8
+ }
@@ -0,0 +1,17 @@
1
+ import { getBlog, query } from './data';
2
+ import { Journal } from './view';
3
+ export const dynamic = 'force-dynamic';
4
+ export const runtime = 'nodejs';
5
+ type Props = { searchParams: Promise<Record<string, string | string[] | undefined>> };
6
+ export async function generateMetadata({ searchParams }: Props) {
7
+ const v = await getBlog('/' + query(await searchParams));
8
+ return {
9
+ title: v.title,
10
+ description: v.description,
11
+ alternates: { canonical: v.canonical },
12
+ };
13
+ }
14
+ export default async function Page({ searchParams }: Props) {
15
+ const v = await getBlog('/' + query(await searchParams));
16
+ return <Journal view={v} />;
17
+ }
@@ -0,0 +1,111 @@
1
+ import type { BlogView } from '../server/blog.mjs';
2
+ import { message } from '../server/blog.mjs';
3
+ export function Journal({ view }: { view: BlogView }) {
4
+ return (
5
+ <>
6
+ <a className="skip" href="#content">
7
+ Skip to content
8
+ </a>
9
+ <header>
10
+ <a className="brand" href="/">
11
+ <span className="mark" aria-hidden="true" />
12
+ Lemonade journal
13
+ </a>
14
+ <a href="https://app.lemonadecms.com">Studio</a>
15
+ </header>
16
+ <main id="content">
17
+ {view.state !== 'ready' ? (
18
+ <section className="notice" role="status">
19
+ <h1>{message(view.state)}</h1>
20
+ <p>
21
+ Check GETTING_STARTED.md and the connection. No demonstration content is
22
+ substituted.
23
+ </p>
24
+ <a className="button" href="/">
25
+ Return to journal
26
+ </a>
27
+ </section>
28
+ ) : view.article ? (
29
+ <article className="article">
30
+ <a href={`/?page=${view.page}`}>Back to journal</a>
31
+ <h1>{view.article.title}</h1>
32
+ <p className="byline">
33
+ <span>{view.article.author}</span>
34
+ <time>{view.article.date}</time>
35
+ </p>
36
+ {view.article.image && (
37
+ <img
38
+ className="post-image"
39
+ src={view.article.image}
40
+ alt={view.article.imageAlt}
41
+ />
42
+ )}
43
+ <div
44
+ className="body"
45
+ dangerouslySetInnerHTML={{ __html: view.article.bodyHtml }}
46
+ />
47
+ </article>
48
+ ) : (
49
+ <>
50
+ <section className="hero">
51
+ <h1>
52
+ A little room
53
+ <br />
54
+ for good ideas.
55
+ </h1>
56
+ <p>Notes, stories and new perspectives. Published with Lemonade CMS.</p>
57
+ </section>
58
+ {view.posts.length ? (
59
+ <section className="posts" aria-label="Published articles">
60
+ {view.posts.map((post) => (
61
+ <article key={post.id} className="post">
62
+ {post.image && (
63
+ <img
64
+ className="post-image"
65
+ src={post.image}
66
+ alt=""
67
+ loading="lazy"
68
+ />
69
+ )}
70
+ <h2>
71
+ <a href={`/articles/${post.id}?page=${view.page}`}>
72
+ {post.title}
73
+ </a>
74
+ </h2>
75
+ <p>{post.description}</p>
76
+ <div className="byline">
77
+ <span>{post.author}</span>
78
+ <time>{post.date}</time>
79
+ </div>
80
+ </article>
81
+ ))}
82
+ </section>
83
+ ) : (
84
+ <section className="notice">
85
+ <h2>No published articles yet</h2>
86
+ <p>
87
+ Publish an author and article in the selected Studio environment to
88
+ begin.
89
+ </p>
90
+ </section>
91
+ )}
92
+ <nav className="pagination" aria-label="Article pages">
93
+ {view.hasPrevious ? (
94
+ <a href={`/?page=${view.page - 1}`}>Previous page</a>
95
+ ) : (
96
+ <span />
97
+ )}
98
+ <span>Page {view.page}</span>
99
+ {view.hasNext ? (
100
+ <a href={`/?page=${view.page + 1}`}>Next page</a>
101
+ ) : (
102
+ <span />
103
+ )}
104
+ </nav>
105
+ </>
106
+ )}
107
+ </main>
108
+ <footer>Your ideas, thoughtfully published.</footer>
109
+ </>
110
+ );
111
+ }