@lemonadecms/create 0.0.0-stage → 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 (86) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE +21 -0
  3. package/README.md +26 -2
  4. package/bin/create-lemonade.mjs +122 -0
  5. package/dist/catalog.json +604 -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 +4234 -0
  9. package/dist/templates/angular/package.json +61 -0
  10. package/dist/templates/angular/src/app/app.config.server.ts +23 -0
  11. package/dist/templates/angular/src/app/app.config.ts +34 -0
  12. package/dist/templates/angular/src/app/app.ts +9 -0
  13. package/dist/templates/angular/src/app/blog.service.ts +74 -0
  14. package/dist/templates/angular/src/app/journal.html +71 -0
  15. package/dist/templates/angular/src/app/journal.ts +47 -0
  16. package/dist/templates/angular/src/index.html +14 -0
  17. package/dist/templates/angular/src/main.server.ts +5 -0
  18. package/dist/templates/angular/src/main.ts +6 -0
  19. package/dist/templates/angular/src/server.ts +79 -0
  20. package/dist/templates/angular/tsconfig.app.json +8 -0
  21. package/dist/templates/angular/tsconfig.json +21 -0
  22. package/dist/templates/astro/astro.config.mjs +7 -0
  23. package/dist/templates/astro/locks/npm-lock.json.template +5478 -0
  24. package/dist/templates/astro/locks/pnpm-lock.yaml.template +3530 -0
  25. package/dist/templates/astro/package.json +42 -0
  26. package/dist/templates/astro/src/components/BlogView.astro +92 -0
  27. package/dist/templates/astro/src/layouts/Site.astro +23 -0
  28. package/dist/templates/astro/src/pages/articles/[id].astro +13 -0
  29. package/dist/templates/astro/src/pages/index.astro +13 -0
  30. package/dist/templates/astro/src/pages/lemonade/preview/[...path].ts +4 -0
  31. package/dist/templates/astro/src/pages/lemonade/preview.ts +4 -0
  32. package/dist/templates/astro/tsconfig.json +9 -0
  33. package/dist/templates/next/app/articles/[id]/page.tsx +29 -0
  34. package/dist/templates/next/app/data.ts +12 -0
  35. package/dist/templates/next/app/error.tsx +15 -0
  36. package/dist/templates/next/app/layout.tsx +13 -0
  37. package/dist/templates/next/app/lemonade/preview/[[...path]]/route.ts +7 -0
  38. package/dist/templates/next/app/loading.tsx +7 -0
  39. package/dist/templates/next/app/not-found.tsx +8 -0
  40. package/dist/templates/next/app/page.tsx +17 -0
  41. package/dist/templates/next/app/view.tsx +111 -0
  42. package/dist/templates/next/locks/npm-lock.json.template +1158 -0
  43. package/dist/templates/next/locks/pnpm-lock.yaml.template +715 -0
  44. package/dist/templates/next/next-env.d.ts +2 -0
  45. package/dist/templates/next/next.config.mjs +8 -0
  46. package/dist/templates/next/package.json +44 -0
  47. package/dist/templates/next/proxy.ts +19 -0
  48. package/dist/templates/next/tsconfig.json +25 -0
  49. package/dist/templates/nuxt/app/app.vue +1 -0
  50. package/dist/templates/nuxt/app/components/JournalView.vue +75 -0
  51. package/dist/templates/nuxt/app/pages/articles/[id].vue +8 -0
  52. package/dist/templates/nuxt/app/pages/index.vue +8 -0
  53. package/dist/templates/nuxt/locks/npm-lock.json.template +9113 -0
  54. package/dist/templates/nuxt/locks/pnpm-lock.yaml.template +6466 -0
  55. package/dist/templates/nuxt/nuxt.config.ts +27 -0
  56. package/dist/templates/nuxt/package.json +54 -0
  57. package/dist/templates/nuxt/server/api/blog/[id].get.ts +10 -0
  58. package/dist/templates/nuxt/server/api/blog.get.ts +9 -0
  59. package/dist/templates/nuxt/server/middleware/preview.ts +9 -0
  60. package/dist/templates/nuxt/server/utils/cms-environment.ts +15 -0
  61. package/dist/templates/nuxt/tsconfig.json +7 -0
  62. package/dist/templates/shared/GETTING_STARTED.md +29 -0
  63. package/dist/templates/shared/README.md +8 -0
  64. package/dist/templates/shared/env.example.template +11 -0
  65. package/dist/templates/shared/gitignore.template +13 -0
  66. package/dist/templates/shared/model-template.json +75 -0
  67. package/dist/templates/shared/public/blog.css +255 -0
  68. package/dist/templates/shared/public/lemonade.svg +5 -0
  69. package/dist/templates/shared/schema-contract.json +37 -0
  70. package/dist/templates/shared/scripts/cms-tools.mjs +171 -0
  71. package/dist/templates/shared/scripts/environment.mjs +68 -0
  72. package/dist/templates/shared/scripts/run.mjs +122 -0
  73. package/dist/templates/shared/server/blog.d.mts +35 -0
  74. package/dist/templates/shared/server/blog.mjs +159 -0
  75. package/dist/templates/shared/server/config.d.mts +11 -0
  76. package/dist/templates/shared/server/config.mjs +42 -0
  77. package/dist/templates/shared/server/preview.d.mts +4 -0
  78. package/dist/templates/shared/server/preview.mjs +276 -0
  79. package/dist/templates/shared/src/types/cms-models.ts +37 -0
  80. package/package.json +24 -4
  81. package/src/arguments.mjs +55 -0
  82. package/src/catalog.mjs +134 -0
  83. package/src/errors.mjs +10 -0
  84. package/src/generation.mjs +103 -0
  85. package/src/paths.mjs +90 -0
  86. package/src/prompts.mjs +65 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — unreleased
4
+
5
+ - Offline blog generation for Astro, Nuxt, Next.js and Angular.
6
+ - npm/pnpm lockfiles, explicit Studio setup, bounded published reads and optional
7
+ entry-scoped saved-draft preview.
8
+ - Portable filename and case-insensitive private-configuration guards, with local
9
+ installed-package, concurrency, cancellation and adversarial archive coverage.
10
+ - Initial macOS/Linux qualification; Windows remains explicitly unverified.
11
+
12
+ Publication and native/hosted qualification are separate acceptance steps.
13
+ GitHub Actions is optional for direct npm publication.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lemonade CMS contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,27 @@
1
- # Temporary Holding Version
1
+ # @lemonadecms/create
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A standalone Node initializer for Lemonade CMS blogs in Astro, Nuxt, Next.js and
4
+ Angular. It creates an independent application that you own and deploy yourself.
5
+
6
+ Usage:
7
+
8
+ ```sh
9
+ npx @lemonadecms/create@0.1.0 my-blog --framework astro --package-manager npm
10
+ ```
11
+
12
+ Generation copies local, integrity-checked files only. It performs no network
13
+ requests, dependency installation, Git initialization or CMS changes. Use a new
14
+ directory; existing projects are never merged or overwritten. npm and pnpm outputs
15
+ carry their respective frozen lockfiles. See the generated GETTING_STARTED.md for
16
+ the manual Studio handoff and private configuration.
17
+
18
+ Node 22.23.5+ (22.x) or 24.22.3+ (24.x) is required. Native platform support remains
19
+ limited to the recorded macOS/Linux qualification. **Windows is unverified** for
20
+ the initial release. Portable-path tests do not establish native Windows support.
21
+ No hosted capacity is implied.
22
+
23
+ Internal commands: `npm test`; `npm run prepare:candidate`. Candidate preparation
24
+ uses the reviewed exact source catalog and retains the inspected archive locally.
25
+ The repository source manifest stays private; preparation emits a separate public
26
+ manifest and archive. Neither command publishes anything. Registry publication is
27
+ a separate maintainer action. Public support: hello@lemonadecms.com.
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath } from 'node:url';
3
+ import { resolve, dirname } from 'node:path';
4
+ import { readFile, realpath } from 'node:fs/promises';
5
+ import { parseArguments, supportedRuntime, HELP } from '../src/arguments.mjs';
6
+ import { destination } from '../src/paths.mjs';
7
+ import { loadCatalog, selectedFiles } from '../src/catalog.mjs';
8
+ import { generate } from '../src/generation.mjs';
9
+ import { choose } from '../src/prompts.mjs';
10
+ import { CreateError } from '../src/errors.mjs';
11
+
12
+ export async function run(
13
+ args,
14
+ {
15
+ root = resolve(dirname(fileURLToPath(import.meta.url)), '..'),
16
+ cwd = process.cwd(),
17
+ input = process.stdin,
18
+ output = process.stdout,
19
+ error = process.stderr,
20
+ signal,
21
+ } = {},
22
+ ) {
23
+ let options;
24
+ try {
25
+ options = parseArguments(args);
26
+ const pkg = JSON.parse(await readFile(resolve(root, 'package.json'), 'utf8'));
27
+ if (options.help || options.version) {
28
+ output.write(options.help ? HELP : pkg.version + '\n');
29
+ return 0;
30
+ }
31
+ if (!supportedRuntime())
32
+ throw new CreateError(2, 'Use Node 22.23.5+ (22.x) or 24.22.3+ (24.x).');
33
+ if (!options.json && input.isTTY && output.isTTY)
34
+ options = await choose({ ...options, cwd }, { input, output: error, signal });
35
+ if (!options.directory || !options.framework)
36
+ throw new CreateError(
37
+ 2,
38
+ 'Provide a new directory and --framework in noninteractive mode.',
39
+ );
40
+ const target = await destination(options.directory, cwd);
41
+ const catalog = await loadCatalog(root);
42
+ const files = await selectedFiles(
43
+ root,
44
+ catalog,
45
+ options.framework,
46
+ options.packageManager,
47
+ target.name,
48
+ );
49
+ const result = await generate(
50
+ target.path,
51
+ files,
52
+ {
53
+ version: 1,
54
+ generator: pkg.version,
55
+ template: 'blog',
56
+ revision: catalog.revision,
57
+ framework: options.framework,
58
+ packageManager: options.packageManager,
59
+ },
60
+ { signal },
61
+ );
62
+ const install =
63
+ options.packageManager === 'npm'
64
+ ? 'npm ci --ignore-scripts'
65
+ : 'pnpm install --frozen-lockfile';
66
+ const value = {
67
+ ok: true,
68
+ directory: target.path,
69
+ framework: options.framework,
70
+ template: 'blog',
71
+ files: result.files,
72
+ next: [
73
+ install,
74
+ `${options.packageManager} run cms:setup`,
75
+ `${options.packageManager} run dev`,
76
+ ],
77
+ };
78
+ output.write(
79
+ options.json
80
+ ? JSON.stringify(value) + '\n'
81
+ : `Created your ${options.framework} blog.\n\nOpen ${JSON.stringify(target.path)}, then run:\n ${value.next.join('\n ')}\n\nSee GETTING_STARTED.md to connect your workspace. Nothing was installed or published.\n`,
82
+ );
83
+ return 0;
84
+ } catch (e) {
85
+ const code = e instanceof CreateError ? e.code : 5;
86
+ const message =
87
+ e instanceof CreateError
88
+ ? e.message
89
+ : 'The starter package is unavailable or invalid. Reinstall the reviewed initializer.';
90
+ (options?.json ? output : error).write(
91
+ options?.json
92
+ ? JSON.stringify({ ok: false, code, message }) + '\n'
93
+ : message + '\n',
94
+ );
95
+ return code;
96
+ }
97
+ }
98
+ // Supported Node versions identify the entry point without path/casing guesses.
99
+ // Keep the old-runtime fallback so ordinary unsupported launches reach the
100
+ // existing runtime error rather than becoming silent no-ops.
101
+ let isMain = import.meta.main;
102
+ if (isMain === undefined) {
103
+ const entryPath = process.argv[1]
104
+ ? await realpath(process.argv[1]).catch(() => null)
105
+ : null;
106
+ isMain = Boolean(
107
+ entryPath &&
108
+ entryPath === (await realpath(fileURLToPath(import.meta.url)).catch(() => null)),
109
+ );
110
+ }
111
+ if (isMain) {
112
+ const controller = new AbortController();
113
+ const stop = () => controller.abort();
114
+ process.on('SIGINT', stop);
115
+ process.on('SIGTERM', stop);
116
+ try {
117
+ process.exitCode = await run(process.argv.slice(2), { signal: controller.signal });
118
+ } finally {
119
+ process.removeListener('SIGINT', stop);
120
+ process.removeListener('SIGTERM', stop);
121
+ }
122
+ }