create-we8 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.
- package/README.md +82 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +97 -0
- package/dist/cli.js.map +1 -0
- package/dist/copy-template.d.ts +12 -0
- package/dist/copy-template.d.ts.map +1 -0
- package/dist/copy-template.js +36 -0
- package/dist/copy-template.js.map +1 -0
- package/dist/files.d.ts +55 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +373 -0
- package/dist/files.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/options.d.ts +78 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +235 -0
- package/dist/options.js.map +1 -0
- package/dist/prompts.d.ts +24 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +66 -0
- package/dist/prompts.js.map +1 -0
- package/dist/scaffold.d.ts +49 -0
- package/dist/scaffold.d.ts.map +1 -0
- package/dist/scaffold.js +178 -0
- package/dist/scaffold.js.map +1 -0
- package/package.json +58 -0
- package/template/.env.example +15 -0
- package/template/README.md +202 -0
- package/template/astro.config.mjs +23 -0
- package/template/package.json +29 -0
- package/template/public/favicon.svg +5 -0
- package/template/src/components/AnswerBlock.astro +31 -0
- package/template/src/components/JsonLd.astro +8 -0
- package/template/src/components/PostCard.astro +24 -0
- package/template/src/components/PostCta.astro +61 -0
- package/template/src/components/ResourceCard.astro +40 -0
- package/template/src/components/SiteFooter.astro +19 -0
- package/template/src/components/SiteHead.astro +36 -0
- package/template/src/components/SiteHeader.astro +34 -0
- package/template/src/layouts/BaseLayout.astro +61 -0
- package/template/src/layouts/PostLayout.astro +128 -0
- package/template/src/lib/data.ts +217 -0
- package/template/src/lib/fixture-backend.ts +84 -0
- package/template/src/lib/fixtures.ts +307 -0
- package/template/src/lib/markdown.ts +66 -0
- package/template/src/lib/seo.ts +191 -0
- package/template/src/lib/types.ts +180 -0
- package/template/src/lib/we8-backend.ts +254 -0
- package/template/src/pages/about.astro +96 -0
- package/template/src/pages/authors/[slug].astro +113 -0
- package/template/src/pages/blog/[slug].astro +28 -0
- package/template/src/pages/blog/index.astro +75 -0
- package/template/src/pages/contact.astro +106 -0
- package/template/src/pages/index.astro +106 -0
- package/template/src/pages/llms.txt.ts +64 -0
- package/template/src/pages/resources/[slug].astro +25 -0
- package/template/src/pages/resources.astro +95 -0
- package/template/src/pages/robots.txt.ts +18 -0
- package/template/src/pages/sitemap.xml.ts +22 -0
- package/template/src/styles/global.css +449 -0
- package/template/test/data-layer.test.ts +312 -0
- package/template/test/seo.test.ts +177 -0
- package/template/tsconfig.json +11 -0
- package/template/vitest.config.ts +18 -0
package/dist/files.js
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every file the scaffolder writes, as pure functions of the answers. Keeping
|
|
3
|
+
* the contents here rather than inside the directory walk means the generated
|
|
4
|
+
* project can be asserted on in tests without a filesystem.
|
|
5
|
+
*
|
|
6
|
+
* The generated worker is deliberately tiny. The app IS the CMS worker: three
|
|
7
|
+
* imports, one registration, one default export. Everything a site changes is
|
|
8
|
+
* configuration, which is why `wrangler.jsonc` is the file with the comments
|
|
9
|
+
* in it and `src/index.ts` is the file with almost nothing.
|
|
10
|
+
*/
|
|
11
|
+
import { generateWranglerConfig } from '@we8/cloudflare';
|
|
12
|
+
import { WE8_VERSION_RANGE } from './options.js';
|
|
13
|
+
/** The CMS version a fresh project reports from `/v1/health`. */
|
|
14
|
+
export const CMS_VERSION = '0.1.0';
|
|
15
|
+
/**
|
|
16
|
+
* Registry ranges normally; `file:` paths into a checkout under
|
|
17
|
+
* `--from-workspace`, which is how this repo proves the scaffolder works
|
|
18
|
+
* before anything is published. npm links a `file:` directory rather than
|
|
19
|
+
* copying it, so a rebuild in the checkout is picked up straight away.
|
|
20
|
+
*/
|
|
21
|
+
export function dependencySpecs(options, workspaceRoot) {
|
|
22
|
+
if (!options.fromWorkspace || !workspaceRoot) {
|
|
23
|
+
return {
|
|
24
|
+
cms: WE8_VERSION_RANGE,
|
|
25
|
+
cloudflare: WE8_VERSION_RANGE,
|
|
26
|
+
astro: WE8_VERSION_RANGE,
|
|
27
|
+
client: WE8_VERSION_RANGE,
|
|
28
|
+
admin: WE8_VERSION_RANGE,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
cms: `file:${workspaceRoot}/packages/cms`,
|
|
33
|
+
cloudflare: `file:${workspaceRoot}/packages/cloudflare`,
|
|
34
|
+
astro: `file:${workspaceRoot}/packages/astro`,
|
|
35
|
+
client: `file:${workspaceRoot}/packages/client`,
|
|
36
|
+
admin: `file:${workspaceRoot}/packages/admin`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** The project manifest. */
|
|
40
|
+
export function projectPackageJson(options, deps) {
|
|
41
|
+
const scripts = {
|
|
42
|
+
dev: 'wrangler dev',
|
|
43
|
+
deploy: 'wrangler deploy',
|
|
44
|
+
'db:migrate': 'we8-cloudflare migrate',
|
|
45
|
+
'db:migrate:remote': 'we8-cloudflare migrate --remote',
|
|
46
|
+
// Local only, always. The pack's seed command has no remote mode.
|
|
47
|
+
'db:seed': 'we8-cloudflare seed',
|
|
48
|
+
doctor: 'we8-cloudflare doctor',
|
|
49
|
+
'doctor:remote': 'we8-cloudflare doctor --remote',
|
|
50
|
+
// Copies the built portal into public/ so the worker serves it at /.
|
|
51
|
+
'admin:bundle': 'node node_modules/@we8/cms/scripts/bundle-admin.mjs --source node_modules/@we8/admin-app/dist --target public',
|
|
52
|
+
typecheck: 'tsc --noEmit',
|
|
53
|
+
};
|
|
54
|
+
if (options.template === 'astro') {
|
|
55
|
+
scripts['site:dev'] = 'npm run dev --workspace site';
|
|
56
|
+
scripts['site:build'] = 'npm run build --workspace site';
|
|
57
|
+
}
|
|
58
|
+
const manifest = {
|
|
59
|
+
name: options.projectName,
|
|
60
|
+
version: '0.1.0',
|
|
61
|
+
private: true,
|
|
62
|
+
type: 'module',
|
|
63
|
+
description: `The we8 CMS backing ${options.siteUrl}.`,
|
|
64
|
+
...(options.template === 'astro' ? { workspaces: ['site'] } : {}),
|
|
65
|
+
scripts,
|
|
66
|
+
dependencies: {
|
|
67
|
+
'@we8/admin-app': deps.admin,
|
|
68
|
+
'@we8/cloudflare': deps.cloudflare,
|
|
69
|
+
'@we8/cms': deps.cms,
|
|
70
|
+
},
|
|
71
|
+
devDependencies: {
|
|
72
|
+
'@cloudflare/workers-types': '^5.20260705.1',
|
|
73
|
+
typescript: '^5.7.3',
|
|
74
|
+
wrangler: '^4.107.0',
|
|
75
|
+
},
|
|
76
|
+
engines: { node: options.template === 'astro' ? '>=22.12.0' : '>=20' },
|
|
77
|
+
};
|
|
78
|
+
return `${JSON.stringify(manifest, null, 2)}\n`;
|
|
79
|
+
}
|
|
80
|
+
/** The worker. */
|
|
81
|
+
export function workerEntry(options) {
|
|
82
|
+
return `/**
|
|
83
|
+
* ${options.projectName}: the we8 CMS worker for ${options.siteUrl}.
|
|
84
|
+
*
|
|
85
|
+
* The app IS the CMS worker. @we8/cms brings the routes, the modules, the
|
|
86
|
+
* embedded auth, and the retention cron; @we8/cloudflare brings the sender
|
|
87
|
+
* that turns form notifications and password resets into real mail. Everything
|
|
88
|
+
* else about this site lives in wrangler.jsonc and in the admin API.
|
|
89
|
+
*
|
|
90
|
+
* The sender registers itself as a no-op unless this worker is configured for
|
|
91
|
+
* it (EMAIL_MODE, the EMAIL binding, EMAIL_FROM), so the line below is safe to
|
|
92
|
+
* leave in place whether or not the site sends mail.
|
|
93
|
+
*
|
|
94
|
+
* To add your own routes, import { app } from '@we8/cms', mount them on it,
|
|
95
|
+
* and export an object of your own instead of re-exporting the default.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
import cms, { registerEmailSender } from '@we8/cms';
|
|
99
|
+
import { cloudflareEmailSender } from '@we8/cloudflare';
|
|
100
|
+
|
|
101
|
+
registerEmailSender(cloudflareEmailSender);
|
|
102
|
+
|
|
103
|
+
export default cms;
|
|
104
|
+
`;
|
|
105
|
+
}
|
|
106
|
+
/** The local secrets template. */
|
|
107
|
+
export function devVarsExample() {
|
|
108
|
+
return `# Copy this to .dev.vars (gitignored) before running \`npm run dev\`.
|
|
109
|
+
|
|
110
|
+
# The secret Better Auth signs sessions with. REQUIRED: with no value set, the
|
|
111
|
+
# admin API refuses every request rather than validating a session it could not
|
|
112
|
+
# have signed. Generate one with:
|
|
113
|
+
# openssl rand -hex 32
|
|
114
|
+
BETTER_AUTH_SECRET=
|
|
115
|
+
|
|
116
|
+
# Optional. Only enforced for forms that switch Turnstile on; unset means
|
|
117
|
+
# Turnstile verification is skipped rather than failed.
|
|
118
|
+
# TURNSTILE_SECRET=
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
121
|
+
/** The project's gitignore. `.dev.vars` is the line that matters. */
|
|
122
|
+
export function gitignore(options) {
|
|
123
|
+
const lines = [
|
|
124
|
+
'node_modules/',
|
|
125
|
+
'dist/',
|
|
126
|
+
'',
|
|
127
|
+
'# Wrangler state, including the local D1 database.',
|
|
128
|
+
'.wrangler/',
|
|
129
|
+
'',
|
|
130
|
+
'# Your secrets. Never commit this.',
|
|
131
|
+
'.dev.vars',
|
|
132
|
+
'',
|
|
133
|
+
'# The bundled admin portal; npm run admin:bundle fills it.',
|
|
134
|
+
'public/*',
|
|
135
|
+
'!public/.gitkeep',
|
|
136
|
+
'',
|
|
137
|
+
'.DS_Store',
|
|
138
|
+
];
|
|
139
|
+
if (options.template === 'astro') {
|
|
140
|
+
lines.push('', "# The site's generated types and its local configuration.", 'site/.astro/', 'site/.env');
|
|
141
|
+
}
|
|
142
|
+
return `${lines.join('\n')}\n`;
|
|
143
|
+
}
|
|
144
|
+
/** The project's tsconfig: enough to typecheck the worker and nothing more. */
|
|
145
|
+
export function tsconfig() {
|
|
146
|
+
return `${JSON.stringify({
|
|
147
|
+
compilerOptions: {
|
|
148
|
+
target: 'ES2022',
|
|
149
|
+
lib: ['ES2022'],
|
|
150
|
+
module: 'ESNext',
|
|
151
|
+
moduleResolution: 'Bundler',
|
|
152
|
+
moduleDetection: 'force',
|
|
153
|
+
types: ['@cloudflare/workers-types'],
|
|
154
|
+
strict: true,
|
|
155
|
+
noEmit: true,
|
|
156
|
+
skipLibCheck: true,
|
|
157
|
+
isolatedModules: true,
|
|
158
|
+
verbatimModuleSyntax: true,
|
|
159
|
+
},
|
|
160
|
+
include: ['src'],
|
|
161
|
+
}, null, 2)}\n`;
|
|
162
|
+
}
|
|
163
|
+
/** The project's wrangler config, from the pack's generator. */
|
|
164
|
+
export function wranglerConfig(options) {
|
|
165
|
+
const emailMode = options.email;
|
|
166
|
+
return generateWranglerConfig({
|
|
167
|
+
workerName: options.projectName,
|
|
168
|
+
databaseName: options.databaseName,
|
|
169
|
+
databaseId: options.databaseId,
|
|
170
|
+
bucketName: options.bucketName,
|
|
171
|
+
siteUrl: options.siteUrl,
|
|
172
|
+
cmsVersion: CMS_VERSION,
|
|
173
|
+
emailMode,
|
|
174
|
+
emailFrom: options.emailFrom,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The README: the whole path from here to a deployed CMS, as commands that can
|
|
179
|
+
* be pasted in order. This is the file a stranger reads first and the only
|
|
180
|
+
* place the ordering constraints (database before migrate, secret before
|
|
181
|
+
* sign-up) are written down in one list.
|
|
182
|
+
*/
|
|
183
|
+
export function readme(options) {
|
|
184
|
+
const { projectName, databaseName, bucketName, template } = options;
|
|
185
|
+
const hasId = Boolean(options.databaseId);
|
|
186
|
+
const lines = [];
|
|
187
|
+
const p = (line = '') => {
|
|
188
|
+
lines.push(line);
|
|
189
|
+
};
|
|
190
|
+
p(`# ${projectName}`);
|
|
191
|
+
p();
|
|
192
|
+
p(`A we8 CMS on Cloudflare Workers: content, forms, analytics, media, SEO, and`);
|
|
193
|
+
p('AEO behind a single-site `/v1` API, with an embedded admin login.');
|
|
194
|
+
if (template === 'astro') {
|
|
195
|
+
p('The Astro starter site is in `site/` and builds from fixtures until you');
|
|
196
|
+
p('point it at this CMS.');
|
|
197
|
+
}
|
|
198
|
+
p();
|
|
199
|
+
p('## From here to a live CMS');
|
|
200
|
+
p();
|
|
201
|
+
p('Each step depends on the one before it.');
|
|
202
|
+
p();
|
|
203
|
+
p('**1. Install.**');
|
|
204
|
+
p();
|
|
205
|
+
p('```');
|
|
206
|
+
p('npm install');
|
|
207
|
+
p('```');
|
|
208
|
+
p();
|
|
209
|
+
p('**2. Sign in to Cloudflare.**');
|
|
210
|
+
p();
|
|
211
|
+
p('```');
|
|
212
|
+
p('npx wrangler login');
|
|
213
|
+
p('```');
|
|
214
|
+
p();
|
|
215
|
+
if (hasId) {
|
|
216
|
+
p('**3. Create the bucket.** The database already exists and its id is in');
|
|
217
|
+
p('`wrangler.jsonc`.');
|
|
218
|
+
p();
|
|
219
|
+
p('```');
|
|
220
|
+
p(`npx wrangler r2 bucket create ${bucketName}`);
|
|
221
|
+
p('```');
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
p('**3. Create the database and the bucket.**');
|
|
225
|
+
p();
|
|
226
|
+
p('```');
|
|
227
|
+
p(`npx wrangler d1 create ${databaseName}`);
|
|
228
|
+
p(`npx wrangler r2 bucket create ${bucketName}`);
|
|
229
|
+
p('```');
|
|
230
|
+
p();
|
|
231
|
+
p('`d1 create` prints a uuid. Paste it into `wrangler.jsonc`, replacing');
|
|
232
|
+
p('`REPLACE_WITH_YOUR_D1_DATABASE_ID`.');
|
|
233
|
+
}
|
|
234
|
+
p();
|
|
235
|
+
p('**4. Set the session secret.** The admin API refuses every request without');
|
|
236
|
+
p('it, so this is not optional.');
|
|
237
|
+
p();
|
|
238
|
+
p('```');
|
|
239
|
+
p('openssl rand -hex 32 # copy the value');
|
|
240
|
+
p('cp .dev.vars.example .dev.vars # paste it into BETTER_AUTH_SECRET');
|
|
241
|
+
p('npx wrangler secret put BETTER_AUTH_SECRET # paste it again, for the deployment');
|
|
242
|
+
p('```');
|
|
243
|
+
p();
|
|
244
|
+
p('**5. Create the schema.**');
|
|
245
|
+
p();
|
|
246
|
+
p('```');
|
|
247
|
+
p('npm run db:migrate # the local database');
|
|
248
|
+
p('npm run db:migrate:remote # the deployed one');
|
|
249
|
+
p('```');
|
|
250
|
+
p();
|
|
251
|
+
p('**6. Check the wiring.**');
|
|
252
|
+
p();
|
|
253
|
+
p('```');
|
|
254
|
+
p('npm run doctor');
|
|
255
|
+
p('```');
|
|
256
|
+
p();
|
|
257
|
+
p('It names anything still missing and prints the command that fixes it.');
|
|
258
|
+
p();
|
|
259
|
+
p('**7. Bundle the admin portal.** The worker serves the portal itself; this');
|
|
260
|
+
p('copies the built app into `public/`. Skip it to run API-only.');
|
|
261
|
+
p();
|
|
262
|
+
p('```');
|
|
263
|
+
p('npm run admin:bundle');
|
|
264
|
+
p('```');
|
|
265
|
+
p();
|
|
266
|
+
p('**8. Run it locally.**');
|
|
267
|
+
p();
|
|
268
|
+
p('```');
|
|
269
|
+
p('npm run dev');
|
|
270
|
+
p('```');
|
|
271
|
+
p();
|
|
272
|
+
p('Then, in another terminal:');
|
|
273
|
+
p();
|
|
274
|
+
p('```');
|
|
275
|
+
p('curl http://localhost:8787/v1/health');
|
|
276
|
+
p('```');
|
|
277
|
+
p();
|
|
278
|
+
p('**9. Deploy.**');
|
|
279
|
+
p();
|
|
280
|
+
p('```');
|
|
281
|
+
p('npm run deploy');
|
|
282
|
+
p('```');
|
|
283
|
+
p();
|
|
284
|
+
p('Before you deploy for real, set `vars.SITE_URL` in `wrangler.jsonc` to your');
|
|
285
|
+
p('public origin. The sitemap, `llms.txt`, and the JSON-LD are all built from');
|
|
286
|
+
p('it, and `npm run doctor:remote` fails a deployment that still says');
|
|
287
|
+
p('`localhost`.');
|
|
288
|
+
p();
|
|
289
|
+
p('**10. Claim the site.** Open `/` in the browser: with the portal bundled,');
|
|
290
|
+
p('the first visit offers to create the owner account. The first account');
|
|
291
|
+
p('becomes the owner, and public sign-up closes behind it (API-only installs');
|
|
292
|
+
p('sign up once at `/api/auth/sign-up/email` instead). Every account after');
|
|
293
|
+
p('that is created by the owner, in the portal under Setup.');
|
|
294
|
+
p();
|
|
295
|
+
p('## Local development data');
|
|
296
|
+
p();
|
|
297
|
+
p('```');
|
|
298
|
+
p('npm run db:seed');
|
|
299
|
+
p('```');
|
|
300
|
+
p();
|
|
301
|
+
p('Loads a working site: settings, an author, a published post, a draft, a');
|
|
302
|
+
p('contact form, and two API keys. It contains plaintext API keys, so it is');
|
|
303
|
+
p('local-only by construction: the command has no remote mode and refuses one.');
|
|
304
|
+
p();
|
|
305
|
+
if (template === 'astro') {
|
|
306
|
+
p('## The site');
|
|
307
|
+
p();
|
|
308
|
+
p('```');
|
|
309
|
+
p('npm run site:dev # the Astro starter on its own port');
|
|
310
|
+
p('npm run site:build');
|
|
311
|
+
p('```');
|
|
312
|
+
p();
|
|
313
|
+
p('It builds from the fixtures in `site/src/lib/fixtures.ts` until you point');
|
|
314
|
+
p('it at this CMS. To do that, copy `site/.env.example` to `site/.env` and');
|
|
315
|
+
p('set:');
|
|
316
|
+
p();
|
|
317
|
+
p('```');
|
|
318
|
+
p('WE8_API_URL=http://localhost:8787');
|
|
319
|
+
p('WE8_PUBLISHABLE_KEY=pk_... # from npm run db:seed, or the admin API');
|
|
320
|
+
p('```');
|
|
321
|
+
p();
|
|
322
|
+
}
|
|
323
|
+
p('## What is bound to what');
|
|
324
|
+
p();
|
|
325
|
+
p('| Name | Kind | Required | What it is |');
|
|
326
|
+
p('| --- | --- | --- | --- |');
|
|
327
|
+
p('| `DB` | D1 | yes | The site\'s database |');
|
|
328
|
+
p('| `MEDIA` | R2 | yes | The site\'s media bucket |');
|
|
329
|
+
p('| `SITE_URL` | var | yes | The site\'s public origin |');
|
|
330
|
+
p('| `CMS_VERSION` | var | yes | Reported by `/v1/health` |');
|
|
331
|
+
p('| `BETTER_AUTH_SECRET` | secret | yes | Signs sessions |');
|
|
332
|
+
p('| `AUTH_URL` | var | no | Where auth builds its URLs; defaults to `SITE_URL` |');
|
|
333
|
+
p('| `TURNSTILE_SECRET` | secret | no | Only for forms that enable Turnstile |');
|
|
334
|
+
p('| `EMAIL_MODE` | var | no | `console` logs mail, `cloudflare` sends it, unset drops it |');
|
|
335
|
+
p('| `EMAIL_FROM` | var | no | The from-address, with `EMAIL_MODE=cloudflare` |');
|
|
336
|
+
p('| `EMAIL` | send_email | no | The Cloudflare Email Service binding |');
|
|
337
|
+
p();
|
|
338
|
+
p('## Sending mail');
|
|
339
|
+
p();
|
|
340
|
+
p('Mail is off until it is configured, and a site with no mail configured is a');
|
|
341
|
+
p('working site: a form submission is stored and returns success whether or');
|
|
342
|
+
p('not a notification went anywhere. To turn it on:');
|
|
343
|
+
p();
|
|
344
|
+
p('1. Onboard the sending domain in the Cloudflare dashboard, under Compute,');
|
|
345
|
+
p(' Email Service, Email Sending.');
|
|
346
|
+
p('2. In `wrangler.jsonc`, uncomment the `send_email` binding and set');
|
|
347
|
+
p(' `vars.EMAIL_MODE` to `"cloudflare"` and `vars.EMAIL_FROM` to an address');
|
|
348
|
+
p(' on that domain.');
|
|
349
|
+
p('3. `npm run doctor` confirms it.');
|
|
350
|
+
p();
|
|
351
|
+
p('## More');
|
|
352
|
+
p();
|
|
353
|
+
p('- `GET /v1/openapi.json` is this API, live and self-describing.');
|
|
354
|
+
p('- The we8 package documentation: https://github.com/reveriext/we8-package');
|
|
355
|
+
p();
|
|
356
|
+
return lines.join('\n');
|
|
357
|
+
}
|
|
358
|
+
/** Everything except the copied template, which is a directory walk rather than a string. */
|
|
359
|
+
export function generatedFiles(options, deps) {
|
|
360
|
+
return [
|
|
361
|
+
{ path: 'package.json', contents: projectPackageJson(options, deps) },
|
|
362
|
+
{ path: 'wrangler.jsonc', contents: wranglerConfig(options) },
|
|
363
|
+
{ path: 'src/index.ts', contents: workerEntry(options) },
|
|
364
|
+
{ path: 'tsconfig.json', contents: tsconfig() },
|
|
365
|
+
{ path: '.dev.vars.example', contents: devVarsExample() },
|
|
366
|
+
// Keeps the asset directory present so wrangler finds it before the first
|
|
367
|
+
// admin:bundle run; the worker serves API-only while it is empty.
|
|
368
|
+
{ path: 'public/.gitkeep', contents: '' },
|
|
369
|
+
{ path: '.gitignore', contents: gitignore(options) },
|
|
370
|
+
{ path: 'README.md', contents: readme(options) },
|
|
371
|
+
];
|
|
372
|
+
}
|
|
373
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,sBAAsB,EAAkB,MAAM,iBAAiB,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAwB,MAAM,cAAc,CAAC;AAEvE,iEAAiE;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC;AAiBnC;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAwB,EAAE,aAA4B;IACpF,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,CAAC,aAAa,EAAE,CAAC;QAC7C,OAAO;YACL,GAAG,EAAE,iBAAiB;YACtB,UAAU,EAAE,iBAAiB;YAC7B,KAAK,EAAE,iBAAiB;YACxB,MAAM,EAAE,iBAAiB;YACzB,KAAK,EAAE,iBAAiB;SACzB,CAAC;IACJ,CAAC;IACD,OAAO;QACL,GAAG,EAAE,QAAQ,aAAa,eAAe;QACzC,UAAU,EAAE,QAAQ,aAAa,sBAAsB;QACvD,KAAK,EAAE,QAAQ,aAAa,iBAAiB;QAC7C,MAAM,EAAE,QAAQ,aAAa,kBAAkB;QAC/C,KAAK,EAAE,QAAQ,aAAa,iBAAiB;KAC9C,CAAC;AACJ,CAAC;AAED,4BAA4B;AAC5B,MAAM,UAAU,kBAAkB,CAAC,OAAwB,EAAE,IA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IS the CMS worker plus configuration, and optionally the Astro starter
|
|
4
|
+
* under `site/`.
|
|
5
|
+
*
|
|
6
|
+
* The module surface is here so the scaffolder can be driven from a script as
|
|
7
|
+
* well as a terminal; `src/cli.ts` is a thin wrapper over it.
|
|
8
|
+
*/
|
|
9
|
+
export { USAGE, WE8_VERSION_RANGE, defaultsFor, directoryName, parseArgs, resolveOptions, toResourceName, type EmailChoice, type ParsedInvocation, type ScaffoldOptions, type TemplateChoice, } from './options.js';
|
|
10
|
+
export { CMS_VERSION, dependencySpecs, devVarsExample, generatedFiles, gitignore, projectPackageJson, readme, tsconfig, workerEntry, wranglerConfig, type DependencySpecs, type GeneratedFile, } from './files.js';
|
|
11
|
+
export { BUNDLED_TEMPLATE_DIR, resolveTemplateDir, resolveWorkspaceRoot, rewriteTemplateManifest, scaffoldProject, type ScaffoldResult, } from './scaffold.js';
|
|
12
|
+
export { promptForAnswers, terminalAsker, type Asker } from './prompts.js';
|
|
13
|
+
/** The published name of this package. */
|
|
14
|
+
export declare const packageName = "create-we8";
|
|
15
|
+
/** The package version line this workspace targets. */
|
|
16
|
+
export declare const packageRelease = "0.1";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,SAAS,EACT,cAAc,EACd,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,MAAM,EACN,QAAQ,EACR,WAAW,EACX,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,eAAe,EACf,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAE3E,0CAA0C;AAC1C,eAAO,MAAM,WAAW,eAAe,CAAC;AAExC,uDAAuD;AACvD,eAAO,MAAM,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `create-we8`: the scaffolder behind `npm create we8`. It assembles a project
|
|
3
|
+
* that IS the CMS worker plus configuration, and optionally the Astro starter
|
|
4
|
+
* under `site/`.
|
|
5
|
+
*
|
|
6
|
+
* The module surface is here so the scaffolder can be driven from a script as
|
|
7
|
+
* well as a terminal; `src/cli.ts` is a thin wrapper over it.
|
|
8
|
+
*/
|
|
9
|
+
export { USAGE, WE8_VERSION_RANGE, defaultsFor, directoryName, parseArgs, resolveOptions, toResourceName, } from './options.js';
|
|
10
|
+
export { CMS_VERSION, dependencySpecs, devVarsExample, generatedFiles, gitignore, projectPackageJson, readme, tsconfig, workerEntry, wranglerConfig, } from './files.js';
|
|
11
|
+
export { BUNDLED_TEMPLATE_DIR, resolveTemplateDir, resolveWorkspaceRoot, rewriteTemplateManifest, scaffoldProject, } from './scaffold.js';
|
|
12
|
+
export { promptForAnswers, terminalAsker } from './prompts.js';
|
|
13
|
+
/** The published name of this package. */
|
|
14
|
+
export const packageName = 'create-we8';
|
|
15
|
+
/** The package version line this workspace targets. */
|
|
16
|
+
export const packageRelease = '0.1';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,SAAS,EACT,cAAc,EACd,cAAc,GAKf,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,MAAM,EACN,QAAQ,EACR,WAAW,EACX,cAAc,GAGf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,eAAe,GAEhB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAc,MAAM,cAAc,CAAC;AAE3E,0CAA0C;AAC1C,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AAExC,uDAAuD;AACvD,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the scaffolder is being asked for: argument parsing, defaults, and the
|
|
3
|
+
* validation both the interactive and the non-interactive paths share.
|
|
4
|
+
*
|
|
5
|
+
* Nothing here touches the filesystem, so the whole decision layer is testable
|
|
6
|
+
* on its own, and the prompts become a way of filling in the same structure
|
|
7
|
+
* rather than a second implementation of it.
|
|
8
|
+
*/
|
|
9
|
+
/** Whether the project also gets the Astro starter under `site/`. */
|
|
10
|
+
export type TemplateChoice = 'astro' | 'none';
|
|
11
|
+
/** How the project sends mail. Mirrors the pack's own modes. */
|
|
12
|
+
export type EmailChoice = 'off' | 'console' | 'cloudflare';
|
|
13
|
+
/** The version line the generated project depends on. */
|
|
14
|
+
export declare const WE8_VERSION_RANGE = "^0.1.0";
|
|
15
|
+
/** Everything the scaffolder needs to write a project. */
|
|
16
|
+
export interface ScaffoldOptions {
|
|
17
|
+
/** Where the project goes, relative to the working directory or absolute. */
|
|
18
|
+
directory: string;
|
|
19
|
+
/** The project, Worker, and package name. */
|
|
20
|
+
projectName: string;
|
|
21
|
+
template: TemplateChoice;
|
|
22
|
+
databaseName: string;
|
|
23
|
+
bucketName: string;
|
|
24
|
+
/** A real D1 id when the user already made the database. */
|
|
25
|
+
databaseId?: string | undefined;
|
|
26
|
+
siteUrl: string;
|
|
27
|
+
email: EmailChoice;
|
|
28
|
+
emailFrom?: string | undefined;
|
|
29
|
+
/** Write into a directory that already has files in it. */
|
|
30
|
+
force: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Link the packages from a local checkout instead of the registry. Internal:
|
|
33
|
+
* this is how the repo tests the scaffolder before anything is published.
|
|
34
|
+
*/
|
|
35
|
+
fromWorkspace: boolean;
|
|
36
|
+
/** The checkout to link from, when fromWorkspace is set. */
|
|
37
|
+
workspaceRoot?: string | undefined;
|
|
38
|
+
/** Run `npm install` in the new project. */
|
|
39
|
+
install: boolean;
|
|
40
|
+
/** Initialise a git repository. */
|
|
41
|
+
git: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** A parse result: either something to do, or something to print. */
|
|
44
|
+
export interface ParsedInvocation {
|
|
45
|
+
mode: 'scaffold' | 'help' | 'version';
|
|
46
|
+
/** Answers given on the command line. Anything absent is prompted for or defaulted. */
|
|
47
|
+
answers: Partial<ScaffoldOptions>;
|
|
48
|
+
/** True when the user asked for no questions. */
|
|
49
|
+
yes: boolean;
|
|
50
|
+
error?: string;
|
|
51
|
+
}
|
|
52
|
+
export declare const USAGE = "create-we8 - scaffold a we8 CMS project on Cloudflare\n\nUsage:\n npm create we8 [directory] [options]\n\nOptions:\n --name <name> Project, Worker, and package name. Defaults to the\n directory name.\n --template <choice> astro (the starter site under site/) or none for a\n headless-only backend. Default: astro\n --headless Shorthand for --template none\n --site-url <url> The site's public origin. Default:\n http://localhost:8787, which is what local dev wants.\n --d1-name <name> D1 database name. Default: <name>\n --d1-id <uuid> The id from `wrangler d1 create`, if it already\n exists. Left as a placeholder otherwise.\n --r2-name <name> R2 bucket name. Default: <name>-media\n --email <mode> off, console, or cloudflare. Default: off\n --email-from <address> Required with --email cloudflare\n --force Write into a directory that is not empty\n --no-install Do not run npm install\n --no-git Do not run git init\n -y, --yes Take the defaults and ask nothing\n -h, --help This\n -v, --version The scaffolder version\n\nAfter it finishes, the README in the new project has the exact next commands.\n";
|
|
53
|
+
/** Turns anything a person types into a name Cloudflare accepts, or an empty string. */
|
|
54
|
+
export declare function toResourceName(input: string): string;
|
|
55
|
+
/** The last segment of a path, as a starting point for the project name. */
|
|
56
|
+
export declare function directoryName(directory: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Reads argv (without node and the script). A positional argument is the
|
|
59
|
+
* directory; an unknown flag is an error, because a silently ignored
|
|
60
|
+
* `--templat` would scaffold the wrong project shape without saying so.
|
|
61
|
+
*/
|
|
62
|
+
export declare function parseArgs(argv: readonly string[]): ParsedInvocation;
|
|
63
|
+
/** The defaults a name implies, so prompts and flags agree on what they mean. */
|
|
64
|
+
export declare function defaultsFor(projectName: string): {
|
|
65
|
+
databaseName: string;
|
|
66
|
+
bucketName: string;
|
|
67
|
+
siteUrl: string;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Fills a partial set of answers out into a complete one, or says what is
|
|
71
|
+
* missing. This is the non-interactive path in full: with `--yes` and a
|
|
72
|
+
* directory, nothing else is required.
|
|
73
|
+
*/
|
|
74
|
+
export declare function resolveOptions(answers: Partial<ScaffoldOptions>, cwd?: string): {
|
|
75
|
+
options?: ScaffoldOptions;
|
|
76
|
+
error?: string;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,qEAAqE;AACrE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9C,gEAAgE;AAChE,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,SAAS,GAAG,YAAY,CAAC;AAE3D,yDAAyD;AACzD,eAAO,MAAM,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