@lunora/cli 1.0.0-alpha.2 → 1.0.0-alpha.21
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/dist/bin.mjs +1 -1
- package/dist/index.d.mts +217 -113
- package/dist/index.d.ts +217 -113
- package/dist/index.mjs +7 -7
- package/dist/packem_chunks/handler.mjs +80 -6
- package/dist/packem_chunks/handler10.mjs +1 -1
- package/dist/packem_chunks/handler11.mjs +1 -1
- package/dist/packem_chunks/handler12.mjs +1 -1
- package/dist/packem_chunks/handler13.mjs +1 -1
- package/dist/packem_chunks/handler14.mjs +2 -2
- package/dist/packem_chunks/handler15.mjs +1 -1
- package/dist/packem_chunks/handler16.mjs +5 -3
- package/dist/packem_chunks/handler17.mjs +1 -1
- package/dist/packem_chunks/handler18.mjs +4 -6
- package/dist/packem_chunks/handler19.mjs +3 -3
- package/dist/packem_chunks/handler2.mjs +2 -2
- package/dist/packem_chunks/handler20.mjs +1 -1
- package/dist/packem_chunks/handler21.mjs +2 -2
- package/dist/packem_chunks/handler3.mjs +1 -1
- package/dist/packem_chunks/handler4.mjs +1 -1
- package/dist/packem_chunks/handler5.mjs +2 -2
- package/dist/packem_chunks/handler6.mjs +2 -2
- package/dist/packem_chunks/handler7.mjs +1 -1
- package/dist/packem_chunks/handler8.mjs +1 -1
- package/dist/packem_chunks/handler9.mjs +1 -1
- package/dist/packem_chunks/planDevCommand.mjs +6 -49
- package/dist/packem_chunks/runCodegenCommand.mjs +2 -2
- package/dist/packem_chunks/runDeployCommand.mjs +3 -3
- package/dist/packem_chunks/runInitCommand.mjs +1948 -107
- package/dist/packem_chunks/runMigrateGenerateCommand.mjs +5 -5
- package/dist/packem_chunks/runResetCommand.mjs +4 -4
- package/dist/packem_chunks/runRpcCommand.mjs +1 -1
- package/dist/packem_shared/{COMMANDS-1V_KEx35.mjs → COMMANDS-D3h9Iwvl.mjs} +45 -6
- package/dist/packem_shared/{command-BDXcJCCJ.mjs → command-BC30oSBW.mjs} +1 -1
- package/dist/packem_shared/{runAddCommand-BZGkRnBs.mjs → commands-hl0mRqqg.mjs} +177 -25
- package/dist/packem_shared/{createLogger-CHPNjFw2.mjs → createLogger-B40gPzQo.mjs} +9 -4
- package/dist/packem_shared/detect-package-manager-DYp7n3mJ.mjs +61 -0
- package/dist/packem_shared/{diffSnapshots-RR2ZE8Ya.mjs → diffSnapshots-BeDvvNiF.mjs} +1 -1
- package/dist/packem_shared/{insertSchemaExtension-BuzF6-t2.mjs → insertSchemaExtension-DAqbfr9Z.mjs} +15 -10
- package/dist/packem_shared/{output-format-7gyGR3h8.mjs → output-format-wUvAN6AL.mjs} +1 -1
- package/dist/packem_shared/runAddCommand-vJdgiR5t.mjs +4 -0
- package/dist/packem_shared/{schemaIrToSnapshot-aBTo7TM5.mjs → schemaIrToSnapshot-DdsljJT-.mjs} +1 -1
- package/dist/packem_shared/storage-B7hHSTZP.mjs +84 -0
- package/dist/packem_shared/tui-prompts-M6OWsuyw.mjs +663 -0
- package/package.json +11 -10
- package/skills/lunora-setup-storage/SKILL.md +7 -3
- package/dist/packem_shared/features-ocSSpZtS.mjs +0 -24
- /package/dist/packem_shared/{defaultSpawner-DxI3mebw.mjs → createRecordingSpawner-DxI3mebw.mjs} +0 -0
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, writeFileSync, readdirSync, mkdtempSync,
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, rmSync, mkdtempSync, cpSync, renameSync } from 'node:fs';
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
|
-
import {
|
|
4
|
-
import { detectFramework as detectFramework$1, isInteractive, promptSelect, promptMultiSelect } from '@lunora/config';
|
|
3
|
+
import { detectFramework as detectFramework$1, isInteractive, LUNA_ART, LUNA_NAME, LUNA_SIGNOFF, paintAnswer, BADGES } from '@lunora/config';
|
|
5
4
|
import { walkSync } from '@visulima/fs';
|
|
6
|
-
import {
|
|
5
|
+
import { join as join$1, dirname as dirname$1, basename, resolve, relative } from '@visulima/path';
|
|
7
6
|
import { downloadTemplate } from 'giget';
|
|
7
|
+
import { modify, applyEdits } from 'jsonc-parser';
|
|
8
8
|
import { join, dirname } from 'node:path';
|
|
9
|
-
import { d as defineHandler } from '../packem_shared/command-
|
|
9
|
+
import { d as defineHandler } from '../packem_shared/command-BC30oSBW.mjs';
|
|
10
|
+
import { a as detectInstalledManagers, i as installArgsFor } from '../packem_shared/detect-package-manager-DYp7n3mJ.mjs';
|
|
10
11
|
import MagicString from 'magic-string';
|
|
11
12
|
import { Project, SyntaxKind } from 'ts-morph';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
13
|
+
import { c as resolveTagVersions, d as resolveSourceRef, e as resolveDistTag, r as runAddCommand } from '../packem_shared/commands-hl0mRqqg.mjs';
|
|
14
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-DxI3mebw.mjs';
|
|
15
|
+
import { d as tuiMascot, e as tuiStep, P as PromptCancelledError, f as tuiMoonrise, t as tuiText, g as tuiHeadline, h as tuiInfo, a as tuiSelect, b as tuiConfirm, w as withTuiSpinner, i as tuiNextSteps, j as tuiTasks, k as tuiMultiSelect, l as withTuiBadgeProgress } from '../packem_shared/tui-prompts-M6OWsuyw.mjs';
|
|
16
|
+
import { logStep } from '../packem_shared/createLogger-B40gPzQo.mjs';
|
|
17
|
+
import { E as EMAIL_ITEM, p as promptBucketName, w as withStorageBucketName, M as MAIL_DESTINATION_PROMPT, r as resolveTypedDestination, f as withMailDestination, e as promptAuthProvider, c as promptDatabaseName, g as withAuthDatabaseName } from '../packem_shared/storage-B7hHSTZP.mjs';
|
|
18
|
+
import dns from 'node:dns/promises';
|
|
14
19
|
|
|
15
20
|
const GITHUB_CONTENT = `name: Deploy
|
|
16
21
|
|
|
@@ -20,6 +25,10 @@ on:
|
|
|
20
25
|
pull_request:
|
|
21
26
|
workflow_dispatch:
|
|
22
27
|
|
|
28
|
+
# Prerequisite: commit your pnpm-lock.yaml. \`pnpm install --frozen-lockfile\`
|
|
29
|
+
# (below) and the pnpm cache both require it — run \`pnpm install\` locally and
|
|
30
|
+
# commit the lockfile before pushing, or the first CI run fails.
|
|
31
|
+
#
|
|
23
32
|
# Set these repository secrets (Settings → Secrets and variables → Actions):
|
|
24
33
|
# CLOUDFLARE_API_TOKEN — a Workers-scoped API token
|
|
25
34
|
# CLOUDFLARE_ACCOUNT_ID — your Cloudflare account id
|
|
@@ -66,6 +75,10 @@ jobs:
|
|
|
66
75
|
const GITLAB_CONTENT = `stages:
|
|
67
76
|
- deploy
|
|
68
77
|
|
|
78
|
+
# Prerequisite: commit your pnpm-lock.yaml. \`pnpm install --frozen-lockfile\`
|
|
79
|
+
# (below) requires it — run \`pnpm install\` locally and commit the lockfile
|
|
80
|
+
# before pushing, or the first pipeline fails.
|
|
81
|
+
#
|
|
69
82
|
# Set these as masked CI/CD variables (Settings → CI/CD → Variables):
|
|
70
83
|
# CLOUDFLARE_API_TOKEN — a Workers-scoped API token
|
|
71
84
|
# CLOUDFLARE_ACCOUNT_ID — your Cloudflare account id
|
|
@@ -127,6 +140,9 @@ const scaffoldCiWorkflow = (projectRoot, provider, logger, options = {}) => {
|
|
|
127
140
|
} else {
|
|
128
141
|
logger.success(`--ci ${provider}: wrote ${spec.file}`);
|
|
129
142
|
logger.info(`--ci ${provider}: set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID as ${spec.secretsHint} to enable deploys.`);
|
|
143
|
+
logger.info(
|
|
144
|
+
`--ci ${provider}: run \`pnpm install\` and commit pnpm-lock.yaml before pushing — the pipeline runs \`pnpm install --frozen-lockfile\`.`
|
|
145
|
+
);
|
|
130
146
|
}
|
|
131
147
|
return result;
|
|
132
148
|
} catch (error) {
|
|
@@ -271,26 +287,1422 @@ const patchViteConfig = (source) => {
|
|
|
271
287
|
return { changed: true, code: ms.toString() };
|
|
272
288
|
};
|
|
273
289
|
|
|
290
|
+
const emitStep = async (type, message, answer) => {
|
|
291
|
+
if (isInteractive()) {
|
|
292
|
+
await tuiStep(BADGES[type], message, answer);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
process.stdout.write("\n");
|
|
296
|
+
if (answer === void 0 || answer === "") {
|
|
297
|
+
logStep(type, message);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const dimmed = answer.split("\n").map((line) => paintAnswer(line)).join("\n");
|
|
301
|
+
logStep(type, `${message}
|
|
302
|
+
${dimmed}`);
|
|
303
|
+
};
|
|
304
|
+
const emitMascot = async (logger) => {
|
|
305
|
+
if (isInteractive()) {
|
|
306
|
+
await tuiMascot();
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
logger.info(`
|
|
310
|
+
${LUNA_ART}
|
|
311
|
+
${LUNA_NAME}: ${LUNA_SIGNOFF}`);
|
|
312
|
+
};
|
|
313
|
+
|
|
274
314
|
const STACK_FEATURE_OPTIONS = [
|
|
275
315
|
{ description: "Sign-up / sign-in (asks which provider)", label: "Authentication", value: "auth" },
|
|
276
|
-
{ description: "Cloudflare Email Workers + a dev mail catcher", label: "Transactional email", value: "email" }
|
|
316
|
+
{ description: "Cloudflare Email Workers + a dev mail catcher", label: "Transactional email", value: "email" },
|
|
317
|
+
{ description: "Typed R2 buckets + signed URLs (@lunora/storage)", label: "File storage", value: "storage" },
|
|
318
|
+
{ description: "Token-bucket / sliding-window limits (@lunora/ratelimit)", label: "Rate limiting", value: "ratelimit" },
|
|
319
|
+
{ description: "Scheduled jobs via Cron Triggers (@lunora/scheduler)", label: "Cron jobs", value: "crons" },
|
|
320
|
+
{ description: "Live presence / who's-online over hibernated WebSockets", label: "Presence", value: "presence" },
|
|
321
|
+
{ description: "Snapshot + restore your Durable Object data", label: "Backups", value: "backup" }
|
|
277
322
|
];
|
|
323
|
+
const STACK_FEATURE_VALUES = STACK_FEATURE_OPTIONS.map((option) => option.value);
|
|
324
|
+
const featureItem = (feature) => feature === "email" ? EMAIL_ITEM : feature;
|
|
325
|
+
const parseFeatureList = (raw, warn) => {
|
|
326
|
+
const features = [];
|
|
327
|
+
for (const part of raw.split(",").map((entry) => entry.trim()).filter(Boolean)) {
|
|
328
|
+
if (STACK_FEATURE_VALUES.includes(part)) {
|
|
329
|
+
if (!features.includes(part)) {
|
|
330
|
+
features.push(part);
|
|
331
|
+
}
|
|
332
|
+
} else {
|
|
333
|
+
warn(`init: unknown --add feature "${part}" — expected ${STACK_FEATURE_VALUES.join(" | ")}; skipping.`);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return features;
|
|
337
|
+
};
|
|
338
|
+
const collectAuthFeature = async (deps) => {
|
|
339
|
+
const provider = await promptAuthProvider(deps.select);
|
|
340
|
+
const databaseName = await promptDatabaseName(deps.text, deps.projectName);
|
|
341
|
+
return { label: "auth", names: [provider], transformManifest: (manifest) => withAuthDatabaseName(manifest, databaseName) };
|
|
342
|
+
};
|
|
343
|
+
const collectEmailFeature = async (deps) => {
|
|
344
|
+
const answer = await deps.text(MAIL_DESTINATION_PROMPT, { placeholder: "you@yourdomain.com" });
|
|
345
|
+
const destination = resolveTypedDestination(answer, (message) => {
|
|
346
|
+
deps.logger.warn(message);
|
|
347
|
+
});
|
|
348
|
+
return {
|
|
349
|
+
label: "email",
|
|
350
|
+
names: [EMAIL_ITEM],
|
|
351
|
+
transformManifest: destination === void 0 ? void 0 : (manifest) => withMailDestination(manifest, destination)
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
const collectStorageFeature = async (deps) => {
|
|
355
|
+
const bucketName = await promptBucketName(deps.text, deps.projectName);
|
|
356
|
+
return { label: "storage", names: ["storage"], transformManifest: (manifest) => withStorageBucketName(manifest, bucketName) };
|
|
357
|
+
};
|
|
358
|
+
const FEATURE_COLLECTORS = {
|
|
359
|
+
auth: collectAuthFeature,
|
|
360
|
+
email: collectEmailFeature,
|
|
361
|
+
storage: collectStorageFeature
|
|
362
|
+
};
|
|
278
363
|
const offerRegistryExtras = async (deps) => {
|
|
364
|
+
if (deps.preselected !== void 0 && deps.preselected.length > 0) {
|
|
365
|
+
await deps.applyAll(
|
|
366
|
+
deps.preselected.map((feature) => {
|
|
367
|
+
return { label: feature, names: [featureItem(feature)] };
|
|
368
|
+
})
|
|
369
|
+
);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
279
372
|
if (!deps.interactive) {
|
|
280
|
-
deps.logger.info("tip: add
|
|
373
|
+
deps.logger.info("tip: add features later with `lunora add <auth|email|storage|ratelimit|crons|presence|backup>`.");
|
|
281
374
|
return;
|
|
282
375
|
}
|
|
283
376
|
const picked = await deps.multiSelect("Which features do you want to add?", STACK_FEATURE_OPTIONS, { defaults: [] });
|
|
377
|
+
if (picked.length === 0) {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
const plans = [];
|
|
284
381
|
for (const feature of picked) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
382
|
+
const collect = FEATURE_COLLECTORS[feature];
|
|
383
|
+
plans.push(collect ? await collect(deps) : { label: feature, names: [feature] });
|
|
384
|
+
}
|
|
385
|
+
await deps.applyAll(plans);
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
const LOGO_PATH = "M 259.500 10.552 C 220.080 15.859, 182.424 32.566, 152.500 58.025 C 110.179 94.031, 85.380 137.183, 77.518 188.500 C 75.410 202.255, 74.569 225.677, 75.796 236.466 C 76.757 244.917, 76.683 245.692, 74.518 249.966 C 63.118 272.466, 53.141 303.876, 51.382 322.799 L 50.718 329.943 71.960 320.471 C 83.643 315.262, 93.326 311, 93.478 311 C 93.630 311, 96.547 316.063, 99.959 322.250 C 103.371 328.438, 107.249 334.850, 108.577 336.500 L 110.990 339.500 110.981 336 C 110.977 334.075, 111.499 324.991, 112.143 315.813 L 113.312 299.127 121.406 293.336 C 132.495 285.403, 149.593 271.554, 161 261.268 C 171.556 251.748, 189.116 235, 188.540 235 C 188.337 235, 183.069 238.648, 176.835 243.106 C 142.318 267.789, 68.537 314, 63.646 314 C 61.843 314, 72.791 281.179, 80.905 262.259 C 92.233 235.845, 107.473 212.389, 132.106 183.453 L 138.451 176 148.268 176 C 176.192 176, 197.512 187.154, 212.868 209.797 C 216.470 215.108, 217.035 216.595, 216.477 219.297 C 211.386 243.968, 202.359 274.496, 193.797 296 C 183.898 320.861, 167.147 352.101, 152.395 373.215 L 147.004 380.930 152.891 385.830 C 161.400 392.911, 165.563 396, 166.594 395.998 C 167.092 395.998, 168.772 391.641, 170.327 386.317 C 176.279 365.934, 188.422 338.749, 200.942 317.778 C 223.060 280.731, 256.432 244.369, 294.500 215.836 C 309.956 204.252, 313.937 201.603, 314.719 202.385 C 315.116 202.783, 315.449 213.096, 315.460 225.304 C 315.474 241.855, 315.021 250.405, 313.680 258.924 C 307.009 301.272, 291.175 336.677, 263.112 372 C 255.259 381.883, 227.182 410.673, 218.516 417.727 L 213.532 421.783 223.439 424.880 C 281.705 443.093, 349.165 436.018, 398.616 406.508 C 446.728 377.797, 483.322 331.466, 497.366 281.481 C 503.381 260.075, 504.480 250.741, 504.491 221 C 504.501 191.997, 503.598 184.047, 497.987 163.732 C 484.768 115.871, 452.505 72.708, 407.718 42.964 C 381.051 25.254, 352.818 14.828, 319.695 10.460 C 305.932 8.645, 273.298 8.695, 259.500 10.552";
|
|
389
|
+
const WELCOME_CSS = `/* The welcome page is a full-bleed starter — reset the browser's default
|
|
390
|
+
body margin/padding so it sits flush; everything else is scoped under
|
|
391
|
+
.lunora-welcome (collision-safe). */
|
|
392
|
+
body {
|
|
393
|
+
margin: 0;
|
|
394
|
+
padding: 0;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.lunora-welcome {
|
|
398
|
+
--cyan: hsl(186 84% 56%); --violet: hsl(256 72% 68%); --rose: hsl(330 80% 64%);
|
|
399
|
+
--ribbon: linear-gradient(115deg, var(--cyan), var(--violet) 52%, var(--rose));
|
|
400
|
+
--sans: "Geist Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
401
|
+
--mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
|
|
402
|
+
/* NIGHT (default) */
|
|
403
|
+
--bg: #0e0e11; --surface: hsl(240 12% 8% / 0.72); --surface-2: hsl(240 11% 11% / 0.82);
|
|
404
|
+
--line: hsl(0 0% 100% / 0.08); --line-2: hsl(0 0% 100% / 0.14);
|
|
405
|
+
--t-display: hsl(228 30% 97%); --t-primary: hsl(228 26% 90%); --t-secondary: hsl(228 12% 62%); --t-faint: hsl(228 10% 44%);
|
|
406
|
+
--logo: hsl(228 30% 97%); --accent: var(--violet); --shot-bg: hsl(240 12% 6%);
|
|
407
|
+
--glow-1: hsl(256 80% 52% / 0.30); --glow-2: hsl(196 84% 52% / 0.13); --arc: hsl(256 60% 70% / 0.11);
|
|
408
|
+
|
|
409
|
+
position: relative; min-height: 100vh; background: var(--bg); color: var(--t-primary);
|
|
410
|
+
font-family: var(--sans); line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden;
|
|
411
|
+
transition: background .3s, color .3s;
|
|
412
|
+
}
|
|
413
|
+
.lunora-welcome[data-theme="light"] {
|
|
414
|
+
--bg: hsl(228 32% 97%); --surface: hsl(0 0% 100% / 0.82); --surface-2: hsl(0 0% 100% / 0.95);
|
|
415
|
+
--line: hsl(228 16% 88%); --line-2: hsl(228 14% 80%);
|
|
416
|
+
--t-display: hsl(240 14% 10%); --t-primary: hsl(240 12% 18%); --t-secondary: hsl(235 9% 42%); --t-faint: hsl(235 8% 58%);
|
|
417
|
+
--logo: hsl(240 16% 9%); --accent: hsl(256 58% 56%); --shot-bg: hsl(228 26% 99%);
|
|
418
|
+
--glow-1: hsl(256 80% 60% / 0.14); --glow-2: hsl(196 84% 58% / 0.08); --arc: hsl(256 40% 55% / 0.12);
|
|
419
|
+
}
|
|
420
|
+
.lunora-welcome *, .lunora-welcome *::before, .lunora-welcome *::after { box-sizing: border-box; }
|
|
421
|
+
.lunora-welcome a { color: inherit; text-decoration: none; }
|
|
422
|
+
.lunora-welcome button { font-family: inherit; cursor: pointer; }
|
|
423
|
+
.lunora-welcome ::selection { background: hsl(256 72% 68% / 0.3); }
|
|
424
|
+
.lunora-welcome code { font-family: var(--mono); }
|
|
425
|
+
|
|
426
|
+
/* glow background */
|
|
427
|
+
.lunora-welcome .lw-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
|
|
428
|
+
.lunora-welcome .lw-bg .glow { position: absolute; left: 50%; top: -4%; width: 860px; height: 720px; transform: translateX(-50%);
|
|
429
|
+
border-radius: 50%; background: radial-gradient(circle at 50% 50%, var(--glow-1), var(--glow-2) 40%, transparent 66%); }
|
|
430
|
+
.lunora-welcome .lw-bg .arc { position: absolute; left: 50%; border-radius: 50%; border: 1px solid var(--arc); transform: translateX(-50%); }
|
|
431
|
+
.lunora-welcome .lw-bg .arc.a1 { top: -340px; width: 980px; height: 980px; }
|
|
432
|
+
.lunora-welcome .lw-bg .arc.a2 { top: -240px; width: 720px; height: 720px; opacity: .7; }
|
|
433
|
+
|
|
434
|
+
/* theme toggle */
|
|
435
|
+
.lunora-welcome .lw-toggle { position: fixed; z-index: 5; top: 20px; right: clamp(16px,4vw,36px); display: inline-flex; align-items: center;
|
|
436
|
+
gap: 7px; border: 1px solid var(--line-2); background: var(--surface); backdrop-filter: blur(12px); color: var(--t-secondary);
|
|
437
|
+
font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; padding: 7px 11px; transition: .15s; }
|
|
438
|
+
.lunora-welcome .lw-toggle:hover { color: var(--t-display); border-color: var(--accent); }
|
|
439
|
+
.lunora-welcome .lw-toggle svg { width: 13px; height: 13px; }
|
|
440
|
+
|
|
441
|
+
.lunora-welcome .lw-wrap { position: relative; z-index: 2; width: 100%; max-width: 1080px; margin: 0 auto;
|
|
442
|
+
padding: clamp(44px,8vh,92px) clamp(20px,5vw,48px); display: flex; flex-direction: column; min-height: 100vh; }
|
|
443
|
+
.lunora-welcome .brand { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: clamp(38px,6vh,68px); color: var(--logo); }
|
|
444
|
+
.lunora-welcome .brand svg { width: 54px; height: auto; display: block; }
|
|
445
|
+
.lunora-welcome .brand .word { font-size: 34px; font-weight: 600; letter-spacing: -0.03em; color: var(--t-display); }
|
|
446
|
+
|
|
447
|
+
.lunora-welcome .grid { display: grid; grid-template-columns: 1.06fr 0.94fr; gap: 16px; align-items: stretch; flex: 1; max-height: 580px; }
|
|
448
|
+
@media (max-width: 820px) { .lunora-welcome .grid { grid-template-columns: 1fr; max-height: none; } }
|
|
449
|
+
|
|
450
|
+
.lunora-welcome .card { border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(10px); transition: border-color .2s, background .2s; }
|
|
451
|
+
.lunora-welcome .card:hover { border-color: var(--line-2); background: var(--surface-2); }
|
|
452
|
+
.lunora-welcome .card:hover .arrow { color: var(--accent); transform: translateX(3px); }
|
|
453
|
+
.lunora-welcome .arrow { color: var(--t-faint); transition: color .2s, transform .2s; }
|
|
454
|
+
.lunora-welcome .arrow svg { width: 20px; height: 20px; display: block; }
|
|
455
|
+
.lunora-welcome .ic { display: grid; place-items: center; color: var(--accent);
|
|
456
|
+
border: 1px solid color-mix(in oklab, var(--accent) 36%, transparent); background: color-mix(in oklab, var(--accent) 12%, transparent); }
|
|
457
|
+
.lunora-welcome .ic svg { display: block; }
|
|
458
|
+
|
|
459
|
+
/* left feature card — stretches to fill the box height */
|
|
460
|
+
.lunora-welcome .feature { padding: clamp(18px,2vw,24px); display: flex; flex-direction: column; }
|
|
461
|
+
.lunora-welcome .shot { border: 1px solid var(--line); overflow: hidden; background: var(--shot-bg);
|
|
462
|
+
-webkit-mask-image: linear-gradient(to bottom, #000 56%, transparent 100%); mask-image: linear-gradient(to bottom, #000 56%, transparent 100%); }
|
|
463
|
+
.lunora-welcome .shot .top { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
|
|
464
|
+
.lunora-welcome .shot .wm { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--t-primary); }
|
|
465
|
+
.lunora-welcome .shot .wm i { width: 11px; height: 11px; background: var(--ribbon); -webkit-mask: radial-gradient(circle,#000 60%,transparent 62%); mask: radial-gradient(circle,#000 60%,transparent 62%); }
|
|
466
|
+
.lunora-welcome .shot .search { flex: 1; height: 22px; border: 1px solid var(--line); border-radius: 4px; }
|
|
467
|
+
.lunora-welcome .shot .ver { font-family: var(--mono); font-size: 8px; letter-spacing: .08em; color: var(--t-faint); }
|
|
468
|
+
.lunora-welcome .shot .body { display: grid; grid-template-columns: 92px 1fr; min-height: 224px; }
|
|
469
|
+
.lunora-welcome .shot .nav { border-right: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 11px; }
|
|
470
|
+
.lunora-welcome .shot .nav i, .lunora-welcome .shot .doc i { height: 5px; border-radius: 2px; background: var(--line); }
|
|
471
|
+
.lunora-welcome .shot .doc { padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; }
|
|
472
|
+
.lunora-welcome .shot .doc .h { height: 8px; width: 46%; border-radius: 2px; background: var(--line-2); margin-bottom: 5px; }
|
|
473
|
+
.lunora-welcome .shot .doc .accent { height: 5px; width: 26%; border-radius: 2px; background: var(--accent); }
|
|
474
|
+
.lunora-welcome .feature .info { margin-top: auto; padding-top: clamp(18px,2.4vh,28px); }
|
|
475
|
+
.lunora-welcome .feature .ic { width: 40px; height: 40px; margin-bottom: 15px; }
|
|
476
|
+
.lunora-welcome .feature .ic svg { width: 19px; height: 19px; }
|
|
477
|
+
.lunora-welcome .feature h2 { margin: 0 0 10px; font-size: 19px; font-weight: 600; letter-spacing: -0.015em; color: var(--t-display); }
|
|
478
|
+
.lunora-welcome .feature .row { display: flex; align-items: flex-end; gap: 16px; }
|
|
479
|
+
.lunora-welcome .feature p { margin: 0; color: var(--t-secondary); font-size: 14px; max-width: 50ch; }
|
|
480
|
+
.lunora-welcome .feature .row .arrow { margin-left: auto; }
|
|
481
|
+
|
|
482
|
+
/* right stack — smaller cards, spread to align bottoms with the feature */
|
|
483
|
+
.lunora-welcome .stack { display: flex; flex-direction: column; gap: 16px; height: 100%; }
|
|
484
|
+
.lunora-welcome .mini { flex: 1; padding: 15px 17px; display: flex; align-items: center; gap: 16px; min-height: 0; }
|
|
485
|
+
.lunora-welcome .mini .mc { flex: 1; }
|
|
486
|
+
.lunora-welcome .mini .ic { width: 32px; height: 32px; margin-bottom: 10px; }
|
|
487
|
+
.lunora-welcome .mini .ic svg { width: 16px; height: 16px; }
|
|
488
|
+
.lunora-welcome .mini h3 { margin: 0 0 5px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--t-display); }
|
|
489
|
+
.lunora-welcome .mini p { margin: 0; color: var(--t-secondary); font-size: 12.5px; line-height: 1.45; }
|
|
490
|
+
|
|
491
|
+
.lunora-welcome .lw-foot { text-align: center; padding-top: 26px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--t-faint); }
|
|
492
|
+
|
|
493
|
+
@media (prefers-reduced-motion: reduce) { .lunora-welcome * { transition: none !important; } }
|
|
494
|
+
`;
|
|
495
|
+
const REACT_APP = `import { useEffect, useState } from "react";
|
|
496
|
+
|
|
497
|
+
type Theme = "dark" | "light";
|
|
498
|
+
|
|
499
|
+
export default function App() {
|
|
500
|
+
// Default to "dark" for a stable first paint, then reconcile to the OS
|
|
501
|
+
// preference; the toggle takes over after that.
|
|
502
|
+
const [theme, setTheme] = useState<Theme>("dark");
|
|
503
|
+
|
|
504
|
+
useEffect(() => {
|
|
505
|
+
if (typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: light)").matches) {
|
|
506
|
+
setTheme("light");
|
|
507
|
+
}
|
|
508
|
+
}, []);
|
|
509
|
+
|
|
510
|
+
const isLight = theme === "light";
|
|
511
|
+
|
|
512
|
+
return (
|
|
513
|
+
<div className="lunora-welcome" data-theme={theme}>
|
|
514
|
+
<div className="lw-bg">
|
|
515
|
+
<div className="arc a1" />
|
|
516
|
+
<div className="arc a2" />
|
|
517
|
+
<div className="glow" />
|
|
518
|
+
</div>
|
|
519
|
+
|
|
520
|
+
<button className="lw-toggle" type="button" aria-label="Toggle color theme" onClick={() => setTheme(isLight ? "dark" : "light")}>
|
|
521
|
+
{isLight ? (
|
|
522
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8">
|
|
523
|
+
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
|
|
524
|
+
</svg>
|
|
525
|
+
) : (
|
|
526
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8">
|
|
527
|
+
<circle cx="12" cy="12" r="4" />
|
|
528
|
+
<path d="M12 2v2M12 20v2M4 12H2M22 12h-2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19" />
|
|
529
|
+
</svg>
|
|
530
|
+
)}
|
|
531
|
+
<span>{isLight ? "Ivory" : "Night"}</span>
|
|
532
|
+
</button>
|
|
533
|
+
|
|
534
|
+
<div className="lw-wrap">
|
|
535
|
+
<div className="brand">
|
|
536
|
+
<svg viewBox="0 0 543 446" role="img" aria-label="Lunora">
|
|
537
|
+
<path d="${LOGO_PATH}" fill="currentColor" fillRule="evenodd" />
|
|
538
|
+
</svg>
|
|
539
|
+
<span className="word">Lunora</span>
|
|
540
|
+
</div>
|
|
541
|
+
|
|
542
|
+
<div className="grid">
|
|
543
|
+
<a className="card feature" href="https://lunora.sh/docs">
|
|
544
|
+
<div className="shot" aria-hidden="true">
|
|
545
|
+
<div className="top">
|
|
546
|
+
<span className="wm">
|
|
547
|
+
<i /> Lunora
|
|
548
|
+
</span>
|
|
549
|
+
<span className="search" />
|
|
550
|
+
<span className="ver">v0.1</span>
|
|
551
|
+
</div>
|
|
552
|
+
<div className="body">
|
|
553
|
+
<div className="nav">
|
|
554
|
+
<i style={{ width: "80%" }} />
|
|
555
|
+
<i style={{ width: "60%" }} />
|
|
556
|
+
<i style={{ width: "72%" }} />
|
|
557
|
+
<i style={{ width: "50%" }} />
|
|
558
|
+
<i style={{ width: "66%" }} />
|
|
559
|
+
<i style={{ width: "44%" }} />
|
|
560
|
+
<i style={{ width: "58%" }} />
|
|
561
|
+
</div>
|
|
562
|
+
<div className="doc">
|
|
563
|
+
<span className="h" />
|
|
564
|
+
<i style={{ width: "92%" }} />
|
|
565
|
+
<i style={{ width: "88%" }} />
|
|
566
|
+
<span className="accent" />
|
|
567
|
+
<i style={{ width: "80%" }} />
|
|
568
|
+
<i style={{ width: "90%" }} />
|
|
569
|
+
<i style={{ width: "72%" }} />
|
|
570
|
+
<i style={{ width: "84%" }} />
|
|
571
|
+
<i style={{ width: "78%" }} />
|
|
572
|
+
</div>
|
|
573
|
+
</div>
|
|
574
|
+
</div>
|
|
575
|
+
<div className="info">
|
|
576
|
+
<span className="ic">
|
|
577
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7">
|
|
578
|
+
<path d="M4 5a2 2 0 0 1 2-2h9l5 5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z" />
|
|
579
|
+
<path d="M14 3v5h5" />
|
|
580
|
+
</svg>
|
|
581
|
+
</span>
|
|
582
|
+
<h2>Documentation</h2>
|
|
583
|
+
<div className="row">
|
|
584
|
+
<p>
|
|
585
|
+
Schemas, queries, live subscriptions, sharding, and edge deploy — start to finish. New here or coming from Convex or tRPC,
|
|
586
|
+
you'll have a live app fast.
|
|
587
|
+
</p>
|
|
588
|
+
<span className="arrow">
|
|
589
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
590
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
591
|
+
</svg>
|
|
592
|
+
</span>
|
|
593
|
+
</div>
|
|
594
|
+
</div>
|
|
595
|
+
</a>
|
|
596
|
+
|
|
597
|
+
<div className="stack">
|
|
598
|
+
<a className="card mini" href="https://lunora.sh/blog">
|
|
599
|
+
<div className="mc">
|
|
600
|
+
<span className="ic">
|
|
601
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7">
|
|
602
|
+
<path d="M5 4h11a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a2 2 0 0 1-2-2V5a1 1 0 0 1 1-1zM8 8h7M8 12h7M8 16h4" />
|
|
603
|
+
</svg>
|
|
604
|
+
</span>
|
|
605
|
+
<h3>Blog</h3>
|
|
606
|
+
<p>Product updates, deep dives, and what's new in Lunora.</p>
|
|
607
|
+
</div>
|
|
608
|
+
<span className="arrow">
|
|
609
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
610
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
611
|
+
</svg>
|
|
612
|
+
</span>
|
|
613
|
+
</a>
|
|
614
|
+
<a className="card mini" href="/_lunora">
|
|
615
|
+
<div className="mc">
|
|
616
|
+
<span className="ic">
|
|
617
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7">
|
|
618
|
+
<rect x="3" y="3" width="18" height="18" rx="1" />
|
|
619
|
+
<path d="M3 9h18M9 21V9" />
|
|
620
|
+
</svg>
|
|
621
|
+
</span>
|
|
622
|
+
<h3>Lunora Studio</h3>
|
|
623
|
+
<p>Local admin for schema, data, logs, and advisors.</p>
|
|
624
|
+
</div>
|
|
625
|
+
<span className="arrow">
|
|
626
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
627
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
628
|
+
</svg>
|
|
629
|
+
</span>
|
|
630
|
+
</a>
|
|
631
|
+
<a className="card mini" href="https://lunora.sh/packages">
|
|
632
|
+
<div className="mc">
|
|
633
|
+
<span className="ic">
|
|
634
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7">
|
|
635
|
+
<path d="M12 2 3 7v10l9 5 9-5V7z" />
|
|
636
|
+
<path d="M3 7l9 5 9-5M12 12v10" />
|
|
637
|
+
</svg>
|
|
638
|
+
</span>
|
|
639
|
+
<h3>Cloudflare ecosystem</h3>
|
|
640
|
+
<p>Auth, mail, storage, AI, payments — one deploy.</p>
|
|
641
|
+
</div>
|
|
642
|
+
<span className="arrow">
|
|
643
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
644
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
645
|
+
</svg>
|
|
646
|
+
</span>
|
|
647
|
+
</a>
|
|
648
|
+
</div>
|
|
649
|
+
</div>
|
|
650
|
+
|
|
651
|
+
<div className="lw-foot">Running on Lunora · Vite + React</div>
|
|
652
|
+
</div>
|
|
653
|
+
</div>
|
|
654
|
+
);
|
|
655
|
+
}
|
|
656
|
+
`;
|
|
657
|
+
const VUE_APP = `<script setup lang="ts">
|
|
658
|
+
import { onMounted, ref } from "vue";
|
|
659
|
+
|
|
660
|
+
// Default to "dark" for a stable first paint, then reconcile to the OS
|
|
661
|
+
// preference; the toggle takes over after that.
|
|
662
|
+
const theme = ref<"dark" | "light">("dark");
|
|
663
|
+
|
|
664
|
+
onMounted(() => {
|
|
665
|
+
if (window.matchMedia("(prefers-color-scheme: light)").matches) {
|
|
666
|
+
theme.value = "light";
|
|
290
667
|
}
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
const toggle = (): void => {
|
|
671
|
+
theme.value = theme.value === "light" ? "dark" : "light";
|
|
672
|
+
};
|
|
673
|
+
<\/script>
|
|
674
|
+
|
|
675
|
+
<template>
|
|
676
|
+
<div class="lunora-welcome" :data-theme="theme">
|
|
677
|
+
<div class="lw-bg">
|
|
678
|
+
<div class="arc a1" />
|
|
679
|
+
<div class="arc a2" />
|
|
680
|
+
<div class="glow" />
|
|
681
|
+
</div>
|
|
682
|
+
|
|
683
|
+
<button class="lw-toggle" type="button" aria-label="Toggle color theme" @click="toggle">
|
|
684
|
+
<svg v-if="theme === 'light'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
685
|
+
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
|
|
686
|
+
</svg>
|
|
687
|
+
<svg v-else viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
688
|
+
<circle cx="12" cy="12" r="4" />
|
|
689
|
+
<path d="M12 2v2M12 20v2M4 12H2M22 12h-2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19" />
|
|
690
|
+
</svg>
|
|
691
|
+
<span>{{ theme === "light" ? "Ivory" : "Night" }}</span>
|
|
692
|
+
</button>
|
|
693
|
+
|
|
694
|
+
<div class="lw-wrap">
|
|
695
|
+
<div class="brand">
|
|
696
|
+
<svg viewBox="0 0 543 446" role="img" aria-label="Lunora">
|
|
697
|
+
<path d="${LOGO_PATH}" fill="currentColor" fill-rule="evenodd" />
|
|
698
|
+
</svg>
|
|
699
|
+
<span class="word">Lunora</span>
|
|
700
|
+
</div>
|
|
701
|
+
|
|
702
|
+
<div class="grid">
|
|
703
|
+
<a class="card feature" href="https://lunora.sh/docs">
|
|
704
|
+
<div class="shot" aria-hidden="true">
|
|
705
|
+
<div class="top">
|
|
706
|
+
<span class="wm"><i /> Lunora</span>
|
|
707
|
+
<span class="search" />
|
|
708
|
+
<span class="ver">v0.1</span>
|
|
709
|
+
</div>
|
|
710
|
+
<div class="body">
|
|
711
|
+
<div class="nav">
|
|
712
|
+
<i style="width: 80%" />
|
|
713
|
+
<i style="width: 60%" />
|
|
714
|
+
<i style="width: 72%" />
|
|
715
|
+
<i style="width: 50%" />
|
|
716
|
+
<i style="width: 66%" />
|
|
717
|
+
<i style="width: 44%" />
|
|
718
|
+
<i style="width: 58%" />
|
|
719
|
+
</div>
|
|
720
|
+
<div class="doc">
|
|
721
|
+
<span class="h" />
|
|
722
|
+
<i style="width: 92%" />
|
|
723
|
+
<i style="width: 88%" />
|
|
724
|
+
<span class="accent" />
|
|
725
|
+
<i style="width: 80%" />
|
|
726
|
+
<i style="width: 90%" />
|
|
727
|
+
<i style="width: 72%" />
|
|
728
|
+
<i style="width: 84%" />
|
|
729
|
+
<i style="width: 78%" />
|
|
730
|
+
</div>
|
|
731
|
+
</div>
|
|
732
|
+
</div>
|
|
733
|
+
<div class="info">
|
|
734
|
+
<span class="ic">
|
|
735
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
736
|
+
<path d="M4 5a2 2 0 0 1 2-2h9l5 5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z" />
|
|
737
|
+
<path d="M14 3v5h5" />
|
|
738
|
+
</svg>
|
|
739
|
+
</span>
|
|
740
|
+
<h2>Documentation</h2>
|
|
741
|
+
<div class="row">
|
|
742
|
+
<p>
|
|
743
|
+
Schemas, queries, live subscriptions, sharding, and edge deploy — start to finish. New here or coming from Convex or tRPC,
|
|
744
|
+
you'll have a live app fast.
|
|
745
|
+
</p>
|
|
746
|
+
<span class="arrow">
|
|
747
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
748
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
749
|
+
</svg>
|
|
750
|
+
</span>
|
|
751
|
+
</div>
|
|
752
|
+
</div>
|
|
753
|
+
</a>
|
|
754
|
+
|
|
755
|
+
<div class="stack">
|
|
756
|
+
<a class="card mini" href="https://lunora.sh/blog">
|
|
757
|
+
<div class="mc">
|
|
758
|
+
<span class="ic">
|
|
759
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
760
|
+
<path d="M5 4h11a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a2 2 0 0 1-2-2V5a1 1 0 0 1 1-1zM8 8h7M8 12h7M8 16h4" />
|
|
761
|
+
</svg>
|
|
762
|
+
</span>
|
|
763
|
+
<h3>Blog</h3>
|
|
764
|
+
<p>Product updates, deep dives, and what's new in Lunora.</p>
|
|
765
|
+
</div>
|
|
766
|
+
<span class="arrow">
|
|
767
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
768
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
769
|
+
</svg>
|
|
770
|
+
</span>
|
|
771
|
+
</a>
|
|
772
|
+
<a class="card mini" href="/_lunora">
|
|
773
|
+
<div class="mc">
|
|
774
|
+
<span class="ic">
|
|
775
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
776
|
+
<rect x="3" y="3" width="18" height="18" rx="1" />
|
|
777
|
+
<path d="M3 9h18M9 21V9" />
|
|
778
|
+
</svg>
|
|
779
|
+
</span>
|
|
780
|
+
<h3>Lunora Studio</h3>
|
|
781
|
+
<p>Local admin for schema, data, logs, and advisors.</p>
|
|
782
|
+
</div>
|
|
783
|
+
<span class="arrow">
|
|
784
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
785
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
786
|
+
</svg>
|
|
787
|
+
</span>
|
|
788
|
+
</a>
|
|
789
|
+
<a class="card mini" href="https://lunora.sh/packages">
|
|
790
|
+
<div class="mc">
|
|
791
|
+
<span class="ic">
|
|
792
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
793
|
+
<path d="M12 2 3 7v10l9 5 9-5V7z" />
|
|
794
|
+
<path d="M3 7l9 5 9-5M12 12v10" />
|
|
795
|
+
</svg>
|
|
796
|
+
</span>
|
|
797
|
+
<h3>Cloudflare ecosystem</h3>
|
|
798
|
+
<p>Auth, mail, storage, AI, payments — one deploy.</p>
|
|
799
|
+
</div>
|
|
800
|
+
<span class="arrow">
|
|
801
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
802
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
803
|
+
</svg>
|
|
804
|
+
</span>
|
|
805
|
+
</a>
|
|
806
|
+
</div>
|
|
807
|
+
</div>
|
|
808
|
+
|
|
809
|
+
<div class="lw-foot">Running on Lunora · Vite + Vue</div>
|
|
810
|
+
</div>
|
|
811
|
+
</div>
|
|
812
|
+
</template>
|
|
813
|
+
`;
|
|
814
|
+
const SOLID_APP = `import { createSignal, onMount } from "solid-js";
|
|
815
|
+
|
|
816
|
+
export default function App() {
|
|
817
|
+
// Default to "dark" for a stable first paint, then reconcile to the OS
|
|
818
|
+
// preference; the toggle takes over after that.
|
|
819
|
+
const [theme, setTheme] = createSignal<"dark" | "light">("dark");
|
|
820
|
+
|
|
821
|
+
onMount(() => {
|
|
822
|
+
if (window.matchMedia("(prefers-color-scheme: light)").matches) {
|
|
823
|
+
setTheme("light");
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
|
|
827
|
+
const isLight = () => theme() === "light";
|
|
828
|
+
|
|
829
|
+
return (
|
|
830
|
+
<div class="lunora-welcome" data-theme={theme()}>
|
|
831
|
+
<div class="lw-bg">
|
|
832
|
+
<div class="arc a1" />
|
|
833
|
+
<div class="arc a2" />
|
|
834
|
+
<div class="glow" />
|
|
835
|
+
</div>
|
|
836
|
+
|
|
837
|
+
<button class="lw-toggle" type="button" aria-label="Toggle color theme" onClick={() => setTheme(isLight() ? "dark" : "light")}>
|
|
838
|
+
{isLight() ? (
|
|
839
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
840
|
+
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
|
|
841
|
+
</svg>
|
|
842
|
+
) : (
|
|
843
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
844
|
+
<circle cx="12" cy="12" r="4" />
|
|
845
|
+
<path d="M12 2v2M12 20v2M4 12H2M22 12h-2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19" />
|
|
846
|
+
</svg>
|
|
847
|
+
)}
|
|
848
|
+
<span>{isLight() ? "Ivory" : "Night"}</span>
|
|
849
|
+
</button>
|
|
850
|
+
|
|
851
|
+
<div class="lw-wrap">
|
|
852
|
+
<div class="brand">
|
|
853
|
+
<svg viewBox="0 0 543 446" role="img" aria-label="Lunora">
|
|
854
|
+
<path d="${LOGO_PATH}" fill="currentColor" fill-rule="evenodd" />
|
|
855
|
+
</svg>
|
|
856
|
+
<span class="word">Lunora</span>
|
|
857
|
+
</div>
|
|
858
|
+
|
|
859
|
+
<div class="grid">
|
|
860
|
+
<a class="card feature" href="https://lunora.sh/docs">
|
|
861
|
+
<div class="shot" aria-hidden="true">
|
|
862
|
+
<div class="top">
|
|
863
|
+
<span class="wm">
|
|
864
|
+
<i /> Lunora
|
|
865
|
+
</span>
|
|
866
|
+
<span class="search" />
|
|
867
|
+
<span class="ver">v0.1</span>
|
|
868
|
+
</div>
|
|
869
|
+
<div class="body">
|
|
870
|
+
<div class="nav">
|
|
871
|
+
<i style={{ width: "80%" }} />
|
|
872
|
+
<i style={{ width: "60%" }} />
|
|
873
|
+
<i style={{ width: "72%" }} />
|
|
874
|
+
<i style={{ width: "50%" }} />
|
|
875
|
+
<i style={{ width: "66%" }} />
|
|
876
|
+
<i style={{ width: "44%" }} />
|
|
877
|
+
<i style={{ width: "58%" }} />
|
|
878
|
+
</div>
|
|
879
|
+
<div class="doc">
|
|
880
|
+
<span class="h" />
|
|
881
|
+
<i style={{ width: "92%" }} />
|
|
882
|
+
<i style={{ width: "88%" }} />
|
|
883
|
+
<span class="accent" />
|
|
884
|
+
<i style={{ width: "80%" }} />
|
|
885
|
+
<i style={{ width: "90%" }} />
|
|
886
|
+
<i style={{ width: "72%" }} />
|
|
887
|
+
<i style={{ width: "84%" }} />
|
|
888
|
+
<i style={{ width: "78%" }} />
|
|
889
|
+
</div>
|
|
890
|
+
</div>
|
|
891
|
+
</div>
|
|
892
|
+
<div class="info">
|
|
893
|
+
<span class="ic">
|
|
894
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
895
|
+
<path d="M4 5a2 2 0 0 1 2-2h9l5 5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z" />
|
|
896
|
+
<path d="M14 3v5h5" />
|
|
897
|
+
</svg>
|
|
898
|
+
</span>
|
|
899
|
+
<h2>Documentation</h2>
|
|
900
|
+
<div class="row">
|
|
901
|
+
<p>
|
|
902
|
+
Schemas, queries, live subscriptions, sharding, and edge deploy — start to finish. New here or coming from Convex or tRPC,
|
|
903
|
+
you'll have a live app fast.
|
|
904
|
+
</p>
|
|
905
|
+
<span class="arrow">
|
|
906
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
907
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
908
|
+
</svg>
|
|
909
|
+
</span>
|
|
910
|
+
</div>
|
|
911
|
+
</div>
|
|
912
|
+
</a>
|
|
913
|
+
|
|
914
|
+
<div class="stack">
|
|
915
|
+
<a class="card mini" href="https://lunora.sh/blog">
|
|
916
|
+
<div class="mc">
|
|
917
|
+
<span class="ic">
|
|
918
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
919
|
+
<path d="M5 4h11a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a2 2 0 0 1-2-2V5a1 1 0 0 1 1-1zM8 8h7M8 12h7M8 16h4" />
|
|
920
|
+
</svg>
|
|
921
|
+
</span>
|
|
922
|
+
<h3>Blog</h3>
|
|
923
|
+
<p>Product updates, deep dives, and what's new in Lunora.</p>
|
|
924
|
+
</div>
|
|
925
|
+
<span class="arrow">
|
|
926
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
927
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
928
|
+
</svg>
|
|
929
|
+
</span>
|
|
930
|
+
</a>
|
|
931
|
+
<a class="card mini" href="/_lunora">
|
|
932
|
+
<div class="mc">
|
|
933
|
+
<span class="ic">
|
|
934
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
935
|
+
<rect x="3" y="3" width="18" height="18" rx="1" />
|
|
936
|
+
<path d="M3 9h18M9 21V9" />
|
|
937
|
+
</svg>
|
|
938
|
+
</span>
|
|
939
|
+
<h3>Lunora Studio</h3>
|
|
940
|
+
<p>Local admin for schema, data, logs, and advisors.</p>
|
|
941
|
+
</div>
|
|
942
|
+
<span class="arrow">
|
|
943
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
944
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
945
|
+
</svg>
|
|
946
|
+
</span>
|
|
947
|
+
</a>
|
|
948
|
+
<a class="card mini" href="https://lunora.sh/packages">
|
|
949
|
+
<div class="mc">
|
|
950
|
+
<span class="ic">
|
|
951
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
952
|
+
<path d="M12 2 3 7v10l9 5 9-5V7z" />
|
|
953
|
+
<path d="M3 7l9 5 9-5M12 12v10" />
|
|
954
|
+
</svg>
|
|
955
|
+
</span>
|
|
956
|
+
<h3>Cloudflare ecosystem</h3>
|
|
957
|
+
<p>Auth, mail, storage, AI, payments — one deploy.</p>
|
|
958
|
+
</div>
|
|
959
|
+
<span class="arrow">
|
|
960
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
961
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
962
|
+
</svg>
|
|
963
|
+
</span>
|
|
964
|
+
</a>
|
|
965
|
+
</div>
|
|
966
|
+
</div>
|
|
967
|
+
|
|
968
|
+
<div class="lw-foot">Running on Lunora · Vite + Solid</div>
|
|
969
|
+
</div>
|
|
970
|
+
</div>
|
|
971
|
+
);
|
|
972
|
+
}
|
|
973
|
+
`;
|
|
974
|
+
const SVELTE_APP = `<script lang="ts">
|
|
975
|
+
import { onMount } from "svelte";
|
|
976
|
+
|
|
977
|
+
// Default to "dark" for a stable first paint, then reconcile to the OS
|
|
978
|
+
// preference; the toggle takes over after that.
|
|
979
|
+
let theme = $state<"dark" | "light">("dark");
|
|
980
|
+
const isLight = $derived(theme === "light");
|
|
981
|
+
|
|
982
|
+
onMount(() => {
|
|
983
|
+
if (window.matchMedia("(prefers-color-scheme: light)").matches) {
|
|
984
|
+
theme = "light";
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
|
|
988
|
+
const toggle = (): void => {
|
|
989
|
+
theme = theme === "light" ? "dark" : "light";
|
|
990
|
+
};
|
|
991
|
+
<\/script>
|
|
992
|
+
|
|
993
|
+
<div class="lunora-welcome" data-theme={theme}>
|
|
994
|
+
<div class="lw-bg">
|
|
995
|
+
<div class="arc a1"></div>
|
|
996
|
+
<div class="arc a2"></div>
|
|
997
|
+
<div class="glow"></div>
|
|
998
|
+
</div>
|
|
999
|
+
|
|
1000
|
+
<button class="lw-toggle" type="button" aria-label="Toggle color theme" onclick={toggle}>
|
|
1001
|
+
{#if isLight}
|
|
1002
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
1003
|
+
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
|
|
1004
|
+
</svg>
|
|
1005
|
+
{:else}
|
|
1006
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
1007
|
+
<circle cx="12" cy="12" r="4" />
|
|
1008
|
+
<path d="M12 2v2M12 20v2M4 12H2M22 12h-2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19" />
|
|
1009
|
+
</svg>
|
|
1010
|
+
{/if}
|
|
1011
|
+
<span>{isLight ? "Ivory" : "Night"}</span>
|
|
1012
|
+
</button>
|
|
1013
|
+
|
|
1014
|
+
<div class="lw-wrap">
|
|
1015
|
+
<div class="brand">
|
|
1016
|
+
<svg viewBox="0 0 543 446" role="img" aria-label="Lunora">
|
|
1017
|
+
<path d="${LOGO_PATH}" fill="currentColor" fill-rule="evenodd" />
|
|
1018
|
+
</svg>
|
|
1019
|
+
<span class="word">Lunora</span>
|
|
1020
|
+
</div>
|
|
1021
|
+
|
|
1022
|
+
<div class="grid">
|
|
1023
|
+
<a class="card feature" href="https://lunora.sh/docs">
|
|
1024
|
+
<div class="shot" aria-hidden="true">
|
|
1025
|
+
<div class="top">
|
|
1026
|
+
<span class="wm"><i></i> Lunora</span>
|
|
1027
|
+
<span class="search"></span>
|
|
1028
|
+
<span class="ver">v0.1</span>
|
|
1029
|
+
</div>
|
|
1030
|
+
<div class="body">
|
|
1031
|
+
<div class="nav">
|
|
1032
|
+
<i style="width: 80%"></i>
|
|
1033
|
+
<i style="width: 60%"></i>
|
|
1034
|
+
<i style="width: 72%"></i>
|
|
1035
|
+
<i style="width: 50%"></i>
|
|
1036
|
+
<i style="width: 66%"></i>
|
|
1037
|
+
<i style="width: 44%"></i>
|
|
1038
|
+
<i style="width: 58%"></i>
|
|
1039
|
+
</div>
|
|
1040
|
+
<div class="doc">
|
|
1041
|
+
<span class="h"></span>
|
|
1042
|
+
<i style="width: 92%"></i>
|
|
1043
|
+
<i style="width: 88%"></i>
|
|
1044
|
+
<span class="accent"></span>
|
|
1045
|
+
<i style="width: 80%"></i>
|
|
1046
|
+
<i style="width: 90%"></i>
|
|
1047
|
+
<i style="width: 72%"></i>
|
|
1048
|
+
<i style="width: 84%"></i>
|
|
1049
|
+
<i style="width: 78%"></i>
|
|
1050
|
+
</div>
|
|
1051
|
+
</div>
|
|
1052
|
+
</div>
|
|
1053
|
+
<div class="info">
|
|
1054
|
+
<span class="ic">
|
|
1055
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1056
|
+
<path d="M4 5a2 2 0 0 1 2-2h9l5 5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z" />
|
|
1057
|
+
<path d="M14 3v5h5" />
|
|
1058
|
+
</svg>
|
|
1059
|
+
</span>
|
|
1060
|
+
<h2>Documentation</h2>
|
|
1061
|
+
<div class="row">
|
|
1062
|
+
<p>
|
|
1063
|
+
Schemas, queries, live subscriptions, sharding, and edge deploy — start to finish. New here or coming from Convex or tRPC,
|
|
1064
|
+
you'll have a live app fast.
|
|
1065
|
+
</p>
|
|
1066
|
+
<span class="arrow">
|
|
1067
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1068
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1069
|
+
</svg>
|
|
1070
|
+
</span>
|
|
1071
|
+
</div>
|
|
1072
|
+
</div>
|
|
1073
|
+
</a>
|
|
1074
|
+
|
|
1075
|
+
<div class="stack">
|
|
1076
|
+
<a class="card mini" href="https://lunora.sh/blog">
|
|
1077
|
+
<div class="mc">
|
|
1078
|
+
<span class="ic">
|
|
1079
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1080
|
+
<path d="M5 4h11a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a2 2 0 0 1-2-2V5a1 1 0 0 1 1-1zM8 8h7M8 12h7M8 16h4" />
|
|
1081
|
+
</svg>
|
|
1082
|
+
</span>
|
|
1083
|
+
<h3>Blog</h3>
|
|
1084
|
+
<p>Product updates, deep dives, and what's new in Lunora.</p>
|
|
1085
|
+
</div>
|
|
1086
|
+
<span class="arrow">
|
|
1087
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1088
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1089
|
+
</svg>
|
|
1090
|
+
</span>
|
|
1091
|
+
</a>
|
|
1092
|
+
<a class="card mini" href="/_lunora">
|
|
1093
|
+
<div class="mc">
|
|
1094
|
+
<span class="ic">
|
|
1095
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1096
|
+
<rect x="3" y="3" width="18" height="18" rx="1" />
|
|
1097
|
+
<path d="M3 9h18M9 21V9" />
|
|
1098
|
+
</svg>
|
|
1099
|
+
</span>
|
|
1100
|
+
<h3>Lunora Studio</h3>
|
|
1101
|
+
<p>Local admin for schema, data, logs, and advisors.</p>
|
|
1102
|
+
</div>
|
|
1103
|
+
<span class="arrow">
|
|
1104
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1105
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1106
|
+
</svg>
|
|
1107
|
+
</span>
|
|
1108
|
+
</a>
|
|
1109
|
+
<a class="card mini" href="https://lunora.sh/packages">
|
|
1110
|
+
<div class="mc">
|
|
1111
|
+
<span class="ic">
|
|
1112
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1113
|
+
<path d="M12 2 3 7v10l9 5 9-5V7z" />
|
|
1114
|
+
<path d="M3 7l9 5 9-5M12 12v10" />
|
|
1115
|
+
</svg>
|
|
1116
|
+
</span>
|
|
1117
|
+
<h3>Cloudflare ecosystem</h3>
|
|
1118
|
+
<p>Auth, mail, storage, AI, payments — one deploy.</p>
|
|
1119
|
+
</div>
|
|
1120
|
+
<span class="arrow">
|
|
1121
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1122
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1123
|
+
</svg>
|
|
1124
|
+
</span>
|
|
1125
|
+
</a>
|
|
1126
|
+
</div>
|
|
1127
|
+
</div>
|
|
1128
|
+
|
|
1129
|
+
<div class="lw-foot">Running on Lunora · Vite + Svelte</div>
|
|
1130
|
+
</div>
|
|
1131
|
+
</div>
|
|
1132
|
+
`;
|
|
1133
|
+
const VANILLA_MAIN = `import "./style.css";
|
|
1134
|
+
|
|
1135
|
+
import { LunoraClient } from "lunorash/client";
|
|
1136
|
+
|
|
1137
|
+
import { api } from "#lunora/_generated/api.js";
|
|
1138
|
+
|
|
1139
|
+
// \`@lunora/vite\` runs the Worker on the same origin as Vite, so default to
|
|
1140
|
+
// \`location.origin\`. Point \`VITE_LUNORA_URL\` at a deployed Worker to develop
|
|
1141
|
+
// the client against production data.
|
|
1142
|
+
const url = (import.meta.env.VITE_LUNORA_URL as string | undefined) ?? globalThis.location.origin;
|
|
1143
|
+
const client = new LunoraClient({ url });
|
|
1144
|
+
|
|
1145
|
+
const MOON_ICON = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" /></svg>';
|
|
1146
|
+
const SUN_ICON =
|
|
1147
|
+
'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4 12H2M22 12h-2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19" /></svg>';
|
|
1148
|
+
|
|
1149
|
+
const welcomeHtml = \`
|
|
1150
|
+
<div class="lw-bg">
|
|
1151
|
+
<div class="arc a1"></div>
|
|
1152
|
+
<div class="arc a2"></div>
|
|
1153
|
+
<div class="glow"></div>
|
|
1154
|
+
</div>
|
|
1155
|
+
|
|
1156
|
+
<button class="lw-toggle" type="button" aria-label="Toggle color theme"></button>
|
|
1157
|
+
|
|
1158
|
+
<div class="lw-wrap">
|
|
1159
|
+
<div class="brand">
|
|
1160
|
+
<svg viewBox="0 0 543 446" role="img" aria-label="Lunora">
|
|
1161
|
+
<path d="${LOGO_PATH}" fill="currentColor" fill-rule="evenodd" />
|
|
1162
|
+
</svg>
|
|
1163
|
+
<span class="word">Lunora</span>
|
|
1164
|
+
</div>
|
|
1165
|
+
|
|
1166
|
+
<div class="grid">
|
|
1167
|
+
<a class="card feature" href="https://lunora.sh/docs">
|
|
1168
|
+
<div class="shot" aria-hidden="true">
|
|
1169
|
+
<div class="top">
|
|
1170
|
+
<span class="wm"><i></i> Lunora</span>
|
|
1171
|
+
<span class="search"></span>
|
|
1172
|
+
<span class="ver">v0.1</span>
|
|
1173
|
+
</div>
|
|
1174
|
+
<div class="body">
|
|
1175
|
+
<div class="nav">
|
|
1176
|
+
<i style="width: 80%"></i>
|
|
1177
|
+
<i style="width: 60%"></i>
|
|
1178
|
+
<i style="width: 72%"></i>
|
|
1179
|
+
<i style="width: 50%"></i>
|
|
1180
|
+
<i style="width: 66%"></i>
|
|
1181
|
+
<i style="width: 44%"></i>
|
|
1182
|
+
<i style="width: 58%"></i>
|
|
1183
|
+
</div>
|
|
1184
|
+
<div class="doc">
|
|
1185
|
+
<span class="h"></span>
|
|
1186
|
+
<i style="width: 92%"></i>
|
|
1187
|
+
<i style="width: 88%"></i>
|
|
1188
|
+
<span class="accent"></span>
|
|
1189
|
+
<i style="width: 80%"></i>
|
|
1190
|
+
<i style="width: 90%"></i>
|
|
1191
|
+
<i style="width: 72%"></i>
|
|
1192
|
+
<i style="width: 84%"></i>
|
|
1193
|
+
<i style="width: 78%"></i>
|
|
1194
|
+
</div>
|
|
1195
|
+
</div>
|
|
1196
|
+
</div>
|
|
1197
|
+
<div class="info">
|
|
1198
|
+
<span class="ic">
|
|
1199
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1200
|
+
<path d="M4 5a2 2 0 0 1 2-2h9l5 5v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z" />
|
|
1201
|
+
<path d="M14 3v5h5" />
|
|
1202
|
+
</svg>
|
|
1203
|
+
</span>
|
|
1204
|
+
<h2>Documentation</h2>
|
|
1205
|
+
<div class="row">
|
|
1206
|
+
<p>
|
|
1207
|
+
Schemas, queries, live subscriptions, sharding, and edge deploy — start to finish. New here or coming from Convex or tRPC,
|
|
1208
|
+
you'll have a live app fast.
|
|
1209
|
+
</p>
|
|
1210
|
+
<span class="arrow">
|
|
1211
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1212
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1213
|
+
</svg>
|
|
1214
|
+
</span>
|
|
1215
|
+
</div>
|
|
1216
|
+
</div>
|
|
1217
|
+
</a>
|
|
1218
|
+
|
|
1219
|
+
<div class="stack">
|
|
1220
|
+
<a class="card mini" href="https://lunora.sh/blog">
|
|
1221
|
+
<div class="mc">
|
|
1222
|
+
<span class="ic">
|
|
1223
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1224
|
+
<path d="M5 4h11a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a2 2 0 0 1-2-2V5a1 1 0 0 1 1-1zM8 8h7M8 12h7M8 16h4" />
|
|
1225
|
+
</svg>
|
|
1226
|
+
</span>
|
|
1227
|
+
<h3>Blog</h3>
|
|
1228
|
+
<p>Product updates, deep dives, and what's new in Lunora.</p>
|
|
1229
|
+
</div>
|
|
1230
|
+
<span class="arrow">
|
|
1231
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1232
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1233
|
+
</svg>
|
|
1234
|
+
</span>
|
|
1235
|
+
</a>
|
|
1236
|
+
<a class="card mini" href="/_lunora">
|
|
1237
|
+
<div class="mc">
|
|
1238
|
+
<span class="ic">
|
|
1239
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1240
|
+
<rect x="3" y="3" width="18" height="18" rx="1" />
|
|
1241
|
+
<path d="M3 9h18M9 21V9" />
|
|
1242
|
+
</svg>
|
|
1243
|
+
</span>
|
|
1244
|
+
<h3>Lunora Studio</h3>
|
|
1245
|
+
<p>Local admin for schema, data, logs, and advisors.</p>
|
|
1246
|
+
</div>
|
|
1247
|
+
<span class="arrow">
|
|
1248
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1249
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1250
|
+
</svg>
|
|
1251
|
+
</span>
|
|
1252
|
+
</a>
|
|
1253
|
+
<a class="card mini" href="https://lunora.sh/packages">
|
|
1254
|
+
<div class="mc">
|
|
1255
|
+
<span class="ic">
|
|
1256
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">
|
|
1257
|
+
<path d="M12 2 3 7v10l9 5 9-5V7z" />
|
|
1258
|
+
<path d="M3 7l9 5 9-5M12 12v10" />
|
|
1259
|
+
</svg>
|
|
1260
|
+
</span>
|
|
1261
|
+
<h3>Cloudflare ecosystem</h3>
|
|
1262
|
+
<p>Auth, mail, storage, AI, payments — one deploy.</p>
|
|
1263
|
+
</div>
|
|
1264
|
+
<span class="arrow">
|
|
1265
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1266
|
+
<path d="M5 12h14M13 6l6 6-6 6" />
|
|
1267
|
+
</svg>
|
|
1268
|
+
</span>
|
|
1269
|
+
</a>
|
|
1270
|
+
</div>
|
|
1271
|
+
</div>
|
|
1272
|
+
|
|
1273
|
+
<div class="lw-foot">Running on Lunora · Vite + Vanilla · <span id="lw-count">0</span> messages</div>
|
|
1274
|
+
</div>
|
|
1275
|
+
\`;
|
|
1276
|
+
|
|
1277
|
+
const root = document.querySelector<HTMLDivElement>("#app")!;
|
|
1278
|
+
root.classList.add("lunora-welcome");
|
|
1279
|
+
root.innerHTML = welcomeHtml;
|
|
1280
|
+
|
|
1281
|
+
// Theme toggle: flip the root's data-theme + swap the button's icon/label.
|
|
1282
|
+
const toggleButton = root.querySelector<HTMLButtonElement>(".lw-toggle")!;
|
|
1283
|
+
|
|
1284
|
+
const paintToggle = (theme: "dark" | "light"): void => {
|
|
1285
|
+
root.dataset.theme = theme;
|
|
1286
|
+
toggleButton.innerHTML = \`\${theme === "light" ? MOON_ICON : SUN_ICON}<span>\${theme === "light" ? "Ivory" : "Night"}</span>\`;
|
|
1287
|
+
};
|
|
1288
|
+
|
|
1289
|
+
paintToggle(window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark");
|
|
1290
|
+
toggleButton.addEventListener("click", () => {
|
|
1291
|
+
paintToggle(root.dataset.theme === "light" ? "dark" : "light");
|
|
1292
|
+
});
|
|
1293
|
+
|
|
1294
|
+
// Live demo: the message count of a demo channel re-renders on every delta.
|
|
1295
|
+
const count = document.querySelector<HTMLSpanElement>("#lw-count")!;
|
|
1296
|
+
|
|
1297
|
+
client.onUpdate(api.messages.list, { channelId: "channel:demo" }, (result) => {
|
|
1298
|
+
count.textContent = String(result.messages.length);
|
|
1299
|
+
});
|
|
1300
|
+
`;
|
|
1301
|
+
|
|
1302
|
+
const READ_URL = `const url = (import.meta.env.VITE_LUNORA_URL as string | undefined) ?? globalThis.location.origin;`;
|
|
1303
|
+
const REACT_MAIN = `import "./index.css";
|
|
1304
|
+
|
|
1305
|
+
import { LunoraProvider } from "@lunora/react";
|
|
1306
|
+
import { LunoraClient } from "lunorash/client";
|
|
1307
|
+
import { StrictMode } from "react";
|
|
1308
|
+
import { createRoot } from "react-dom/client";
|
|
1309
|
+
|
|
1310
|
+
import App from "./App.tsx";
|
|
1311
|
+
|
|
1312
|
+
// \`@lunora/vite\` runs the Worker on the same origin as Vite, so default to
|
|
1313
|
+
// \`location.origin\`. Point \`VITE_LUNORA_URL\` at a deployed Worker to develop
|
|
1314
|
+
// the client against production data.
|
|
1315
|
+
${READ_URL}
|
|
1316
|
+
const client = new LunoraClient({ url });
|
|
1317
|
+
|
|
1318
|
+
const root = document.getElementById("root");
|
|
1319
|
+
|
|
1320
|
+
if (!root) {
|
|
1321
|
+
throw new Error("missing #root mount node");
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
createRoot(root).render(
|
|
1325
|
+
<StrictMode>
|
|
1326
|
+
<LunoraProvider client={client}>
|
|
1327
|
+
<App />
|
|
1328
|
+
</LunoraProvider>
|
|
1329
|
+
</StrictMode>,
|
|
1330
|
+
);
|
|
1331
|
+
`;
|
|
1332
|
+
const VUE_MAIN = `import "./style.css";
|
|
1333
|
+
|
|
1334
|
+
import { createLunora } from "@lunora/vue";
|
|
1335
|
+
import { LunoraClient } from "lunorash/client";
|
|
1336
|
+
import { createApp } from "vue";
|
|
1337
|
+
|
|
1338
|
+
import App from "./App.vue";
|
|
1339
|
+
|
|
1340
|
+
// Provide one LunoraClient at the app root via the Vue plugin form.
|
|
1341
|
+
${READ_URL}
|
|
1342
|
+
createApp(App).use(createLunora(new LunoraClient({ url }))).mount("#app");
|
|
1343
|
+
`;
|
|
1344
|
+
const SOLID_INDEX = `import "./index.css";
|
|
1345
|
+
|
|
1346
|
+
import { LunoraContext } from "@lunora/solid";
|
|
1347
|
+
import { LunoraClient } from "lunorash/client";
|
|
1348
|
+
import { render } from "solid-js/web";
|
|
1349
|
+
|
|
1350
|
+
import App from "./App";
|
|
1351
|
+
|
|
1352
|
+
${READ_URL}
|
|
1353
|
+
const client = new LunoraClient({ url });
|
|
1354
|
+
const root = document.getElementById("root");
|
|
1355
|
+
|
|
1356
|
+
render(
|
|
1357
|
+
() => (
|
|
1358
|
+
<LunoraContext.Provider value={client}>
|
|
1359
|
+
<App />
|
|
1360
|
+
</LunoraContext.Provider>
|
|
1361
|
+
),
|
|
1362
|
+
root!,
|
|
1363
|
+
);
|
|
1364
|
+
`;
|
|
1365
|
+
const SVELTE_ROOT = `<script lang="ts">
|
|
1366
|
+
import { setLunoraClient } from "@lunora/svelte";
|
|
1367
|
+
import { LunoraClient } from "lunorash/client";
|
|
1368
|
+
|
|
1369
|
+
import App from "./App.svelte";
|
|
1370
|
+
|
|
1371
|
+
${READ_URL}
|
|
1372
|
+
setLunoraClient(new LunoraClient({ url }));
|
|
1373
|
+
<\/script>
|
|
1374
|
+
|
|
1375
|
+
<App />
|
|
1376
|
+
`;
|
|
1377
|
+
const SVELTE_MAIN = `import "./app.css";
|
|
1378
|
+
|
|
1379
|
+
import { mount } from "svelte";
|
|
1380
|
+
|
|
1381
|
+
import Root from "./Root.svelte";
|
|
1382
|
+
|
|
1383
|
+
// Mount \`Root\` (it sets the ambient LunoraClient) rather than \`App\` directly.
|
|
1384
|
+
const app = mount(Root, { target: document.getElementById("app")! });
|
|
1385
|
+
|
|
1386
|
+
export default app;
|
|
1387
|
+
`;
|
|
1388
|
+
const ADAPTERS = {
|
|
1389
|
+
react: {
|
|
1390
|
+
adapter: "@lunora/react",
|
|
1391
|
+
createViteTemplate: "react-ts",
|
|
1392
|
+
files: [
|
|
1393
|
+
{ contents: REACT_MAIN, path: "src/main.tsx" },
|
|
1394
|
+
{ contents: REACT_APP, path: "src/App.tsx" },
|
|
1395
|
+
{ contents: WELCOME_CSS, path: "src/index.css" }
|
|
1396
|
+
],
|
|
1397
|
+
label: "React"
|
|
1398
|
+
},
|
|
1399
|
+
solid: {
|
|
1400
|
+
adapter: "@lunora/solid",
|
|
1401
|
+
createViteTemplate: "solid",
|
|
1402
|
+
files: [
|
|
1403
|
+
{ contents: SOLID_INDEX, path: "src/index.tsx" },
|
|
1404
|
+
{ contents: SOLID_APP, path: "src/App.tsx" },
|
|
1405
|
+
{ contents: WELCOME_CSS, path: "src/index.css" }
|
|
1406
|
+
],
|
|
1407
|
+
label: "Solid"
|
|
1408
|
+
},
|
|
1409
|
+
svelte: {
|
|
1410
|
+
adapter: "@lunora/svelte",
|
|
1411
|
+
createViteTemplate: "svelte-ts",
|
|
1412
|
+
files: [
|
|
1413
|
+
{ contents: SVELTE_ROOT, path: "src/Root.svelte" },
|
|
1414
|
+
{ contents: SVELTE_MAIN, path: "src/main.ts" },
|
|
1415
|
+
{ contents: SVELTE_APP, path: "src/App.svelte" },
|
|
1416
|
+
{ contents: WELCOME_CSS, path: "src/app.css" }
|
|
1417
|
+
],
|
|
1418
|
+
label: "Svelte"
|
|
1419
|
+
},
|
|
1420
|
+
vanilla: {
|
|
1421
|
+
adapter: "lunorash/client",
|
|
1422
|
+
createViteTemplate: "vanilla-ts",
|
|
1423
|
+
files: [
|
|
1424
|
+
{ contents: VANILLA_MAIN, path: "src/main.ts" },
|
|
1425
|
+
{ contents: WELCOME_CSS, path: "src/style.css" }
|
|
1426
|
+
],
|
|
1427
|
+
label: "Vanilla"
|
|
1428
|
+
},
|
|
1429
|
+
vue: {
|
|
1430
|
+
adapter: "@lunora/vue",
|
|
1431
|
+
createViteTemplate: "vue-ts",
|
|
1432
|
+
files: [
|
|
1433
|
+
{ contents: VUE_MAIN, path: "src/main.ts" },
|
|
1434
|
+
{ contents: VUE_APP, path: "src/App.vue" },
|
|
1435
|
+
{ contents: WELCOME_CSS, path: "src/style.css" }
|
|
1436
|
+
],
|
|
1437
|
+
label: "Vue"
|
|
291
1438
|
}
|
|
292
1439
|
};
|
|
1440
|
+
const isOverlayFramework = (value) => Object.hasOwn(ADAPTERS, value);
|
|
1441
|
+
|
|
1442
|
+
const LUNORA_SCHEMA = `import { defineSchema, defineTable, v } from "lunorash/server";
|
|
1443
|
+
|
|
1444
|
+
export default defineSchema({
|
|
1445
|
+
messages: defineTable({
|
|
1446
|
+
channelId: v.string(),
|
|
1447
|
+
text: v.string(),
|
|
1448
|
+
})
|
|
1449
|
+
.shardBy("channelId")
|
|
1450
|
+
.index("by_channel", ["channelId"]),
|
|
1451
|
+
});
|
|
1452
|
+
`;
|
|
1453
|
+
const LUNORA_MESSAGES = `import { RateLimiter, rateLimit } from "@lunora/ratelimit";
|
|
1454
|
+
|
|
1455
|
+
import { mutation, query, v } from "#lunora/_generated/server.js";
|
|
1456
|
+
|
|
1457
|
+
/**
|
|
1458
|
+
* One in-memory limiter so the public \`send\` mutation isn't an open flood target
|
|
1459
|
+
* out of the box. The default store is in-memory (per-isolate, resets on
|
|
1460
|
+
* eviction) — fine for a starter; run \`lunora add ratelimit\` for the durable,
|
|
1461
|
+
* \`ctx.db\`-backed store when you ship to production.
|
|
1462
|
+
*/
|
|
1463
|
+
const limiter = new RateLimiter({
|
|
1464
|
+
config: {
|
|
1465
|
+
send: { kind: "token bucket", period: 60_000, rate: 30 },
|
|
1466
|
+
},
|
|
1467
|
+
});
|
|
1468
|
+
|
|
1469
|
+
export const list = query.input({ channelId: v.string().meta({ schema: { maxLength: 256 } }), limit: v.optional(v.number()) }).query(async ({ args, ctx }) => {
|
|
1470
|
+
const messages = await ctx.db
|
|
1471
|
+
.query("messages")
|
|
1472
|
+
.withIndex("by_channel", (q) => q.eq("channelId", args.channelId))
|
|
1473
|
+
.take(args.limit ?? 50);
|
|
1474
|
+
|
|
1475
|
+
return { channelId: args.channelId, messages };
|
|
1476
|
+
});
|
|
1477
|
+
|
|
1478
|
+
export const send = mutation
|
|
1479
|
+
.input({ channelId: v.string().meta({ schema: { maxLength: 256 } }), text: v.string().meta({ schema: { maxLength: 4096 } }) })
|
|
1480
|
+
.use(rateLimit(limiter, "send", { key: (ctx) => ctx.auth.userId ?? "anon" }))
|
|
1481
|
+
.mutation(async ({ args, ctx }) => {
|
|
1482
|
+
const id = await ctx.db.insert("messages", { channelId: args.channelId, text: args.text });
|
|
1483
|
+
|
|
1484
|
+
return { channelId: args.channelId, id, text: args.text };
|
|
1485
|
+
});
|
|
1486
|
+
`;
|
|
1487
|
+
const SERVER_ENTRY = `import type { ShardNamespaceLike } from "lunorash/runtime";
|
|
1488
|
+
|
|
1489
|
+
import { defineApp } from "../lunora/_generated/app.js";
|
|
1490
|
+
|
|
1491
|
+
interface Env extends Record<string, unknown> {
|
|
1492
|
+
SHARD: ShardNamespaceLike;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
const app = defineApp<Env>()
|
|
1496
|
+
.shard((env) => env.SHARD)
|
|
1497
|
+
.build();
|
|
1498
|
+
|
|
1499
|
+
export const ShardDO = app.ShardDO;
|
|
1500
|
+
export default app;
|
|
1501
|
+
`;
|
|
1502
|
+
const WRANGLER = `{
|
|
1503
|
+
"$schema": "node_modules/wrangler/config-schema.json",
|
|
1504
|
+
"name": "__NAME__",
|
|
1505
|
+
"main": "src/server.ts",
|
|
1506
|
+
"compatibility_date": "2026-06-10",
|
|
1507
|
+
"compatibility_flags": ["nodejs_compat"],
|
|
1508
|
+
"durable_objects": {
|
|
1509
|
+
"bindings": [{ "name": "SHARD", "class_name": "ShardDO" }],
|
|
1510
|
+
},
|
|
1511
|
+
"migrations": [{ "tag": "v1", "new_sqlite_classes": ["ShardDO"] }],
|
|
1512
|
+
"observability": { "enabled": true, "head_sampling_rate": 1 },
|
|
1513
|
+
}
|
|
1514
|
+
`;
|
|
1515
|
+
const GITIGNORE_ADDITIONS = [".wrangler", ".env", ".env.*", "!.env.example", ".lunora/", ".lunora-cache", "lunora/_generated"];
|
|
1516
|
+
const ENV_EXAMPLE = `# Lunora endpoint for the browser client.
|
|
1517
|
+
# Vite statically replaces \`import.meta.env.VITE_LUNORA_URL\` at \`vite dev\` / build.
|
|
1518
|
+
# Leave it unset to use the page origin; set it to point at a deployed Worker:
|
|
1519
|
+
#
|
|
1520
|
+
# VITE_LUNORA_URL=https://my-app.example.workers.dev
|
|
1521
|
+
`;
|
|
1522
|
+
const COMMON_DEV_DEPENDENCIES = {
|
|
1523
|
+
"@cloudflare/workers-types": "^4.20260611.1",
|
|
1524
|
+
wrangler: "^4.100.0"
|
|
1525
|
+
};
|
|
1526
|
+
const writeFile = (target, relativePath, contents, written) => {
|
|
1527
|
+
const destination = join$1(target, relativePath);
|
|
1528
|
+
mkdirSync(dirname$1(destination), { recursive: true });
|
|
1529
|
+
writeFileSync(destination, contents, "utf8");
|
|
1530
|
+
written.push(destination);
|
|
1531
|
+
};
|
|
1532
|
+
const NEWLINE = /\r?\n/;
|
|
1533
|
+
const ensureGitignore = (target) => {
|
|
1534
|
+
const path = join$1(target, ".gitignore");
|
|
1535
|
+
const existing = existsSync(path) ? readFileSync(path, "utf8") : "";
|
|
1536
|
+
const missing = GITIGNORE_ADDITIONS.filter((entry) => !existing.split(NEWLINE).includes(entry));
|
|
1537
|
+
if (missing.length === 0) {
|
|
1538
|
+
return;
|
|
1539
|
+
}
|
|
1540
|
+
const prefix = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
|
|
1541
|
+
writeFileSync(path, `${existing}${prefix}
|
|
1542
|
+
# Lunora
|
|
1543
|
+
${missing.join("\n")}
|
|
1544
|
+
`, "utf8");
|
|
1545
|
+
};
|
|
1546
|
+
const isLunoraDep$1 = (name) => name === "lunorash" || name.startsWith("@lunora/");
|
|
1547
|
+
const stampRange = (name, range, distTag, versions) => isLunoraDep$1(name) ? versions?.get(name) ?? distTag : range;
|
|
1548
|
+
const withDependency = (map, name, range, distTag) => {
|
|
1549
|
+
return { ...map, [name]: stampRange(name, range, distTag) };
|
|
1550
|
+
};
|
|
1551
|
+
const restampLunora = (map, distTag, versions) => Object.fromEntries(Object.entries(map).map(([name, range]) => [name, stampRange(name, range, distTag, versions)]));
|
|
1552
|
+
const patchPackageJson = async (target, name, adapter, distTag) => {
|
|
1553
|
+
const path = join$1(target, "package.json");
|
|
1554
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
1555
|
+
let dependencies = withDependency(parsed.dependencies ?? {}, "lunorash", distTag, distTag);
|
|
1556
|
+
dependencies = withDependency(dependencies, "@lunora/ratelimit", distTag, distTag);
|
|
1557
|
+
if (adapter.adapter.startsWith("@lunora/")) {
|
|
1558
|
+
dependencies = withDependency(dependencies, adapter.adapter, distTag, distTag);
|
|
1559
|
+
}
|
|
1560
|
+
for (const [depName, range] of Object.entries(adapter.extraDependencies ?? {})) {
|
|
1561
|
+
dependencies = withDependency(dependencies, depName, range, distTag);
|
|
1562
|
+
}
|
|
1563
|
+
let devDependencies = withDependency(parsed.devDependencies ?? {}, "@lunora/vite", distTag, distTag);
|
|
1564
|
+
devDependencies = withDependency(devDependencies, "@lunora/studio", distTag, distTag);
|
|
1565
|
+
for (const [depName, range] of Object.entries(COMMON_DEV_DEPENDENCIES)) {
|
|
1566
|
+
devDependencies = withDependency(devDependencies, depName, range, distTag);
|
|
1567
|
+
}
|
|
1568
|
+
const lunoraNames = [...Object.keys(dependencies), ...Object.keys(devDependencies)].filter((depName) => isLunoraDep$1(depName));
|
|
1569
|
+
const versions = await resolveTagVersions(lunoraNames, distTag);
|
|
1570
|
+
parsed.name = name;
|
|
1571
|
+
parsed.imports = { ...parsed.imports, "#lunora/*": "./lunora/*" };
|
|
1572
|
+
parsed.dependencies = restampLunora(dependencies, distTag, versions);
|
|
1573
|
+
parsed.devDependencies = restampLunora(devDependencies, distTag, versions);
|
|
1574
|
+
parsed.scripts = { ...parsed.scripts, codegen: "lunora codegen", deploy: "vite build && lunora deploy" };
|
|
1575
|
+
writeFileSync(path, `${JSON.stringify(parsed, void 0, 4)}
|
|
1576
|
+
`, "utf8");
|
|
1577
|
+
};
|
|
1578
|
+
const patchBaseViteConfig = (target, logger) => {
|
|
1579
|
+
const candidate = ["vite.config.ts", "vite.config.mts", "vite.config.js", "vite.config.mjs"].map((file) => join$1(target, file)).find((path) => existsSync(path));
|
|
1580
|
+
if (candidate === void 0) {
|
|
1581
|
+
logger.warn("overlay: no vite.config found in the create-vite base — add `lunora()` to your Vite plugins manually.");
|
|
1582
|
+
return;
|
|
1583
|
+
}
|
|
1584
|
+
const result = patchViteConfig(readFileSync(candidate, "utf8"));
|
|
1585
|
+
if (result.changed) {
|
|
1586
|
+
writeFileSync(candidate, result.code, "utf8");
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
const applyLunoraOverlay = async (options) => {
|
|
1590
|
+
const { adapter, distTag, logger, name, target } = options;
|
|
1591
|
+
const written = [];
|
|
1592
|
+
writeFile(target, join$1("lunora", "schema.ts"), LUNORA_SCHEMA, written);
|
|
1593
|
+
writeFile(target, join$1("lunora", "messages.ts"), LUNORA_MESSAGES, written);
|
|
1594
|
+
writeFile(target, join$1("src", "server.ts"), SERVER_ENTRY, written);
|
|
1595
|
+
writeFile(target, "wrangler.jsonc", WRANGLER.replaceAll("__NAME__", name), written);
|
|
1596
|
+
writeFile(target, ".env.example", ENV_EXAMPLE, written);
|
|
1597
|
+
for (const file of adapter.files) {
|
|
1598
|
+
writeFile(target, file.path, file.contents, written);
|
|
1599
|
+
}
|
|
1600
|
+
patchBaseViteConfig(target, logger);
|
|
1601
|
+
await patchPackageJson(target, name, adapter, distTag);
|
|
1602
|
+
ensureGitignore(target);
|
|
1603
|
+
return written;
|
|
1604
|
+
};
|
|
293
1605
|
|
|
1606
|
+
const ADJECTIVES = [
|
|
1607
|
+
"lunar",
|
|
1608
|
+
"silver",
|
|
1609
|
+
"silent",
|
|
1610
|
+
"waning",
|
|
1611
|
+
"waxing",
|
|
1612
|
+
"crescent",
|
|
1613
|
+
"cosmic",
|
|
1614
|
+
"stellar",
|
|
1615
|
+
"orbital",
|
|
1616
|
+
"gibbous",
|
|
1617
|
+
"twilight",
|
|
1618
|
+
"midnight",
|
|
1619
|
+
"shimmering",
|
|
1620
|
+
"drifting",
|
|
1621
|
+
"weightless"
|
|
1622
|
+
];
|
|
1623
|
+
const NOUNS = [
|
|
1624
|
+
"moon",
|
|
1625
|
+
"tide",
|
|
1626
|
+
"crater",
|
|
1627
|
+
"comet",
|
|
1628
|
+
"eclipse",
|
|
1629
|
+
"halo",
|
|
1630
|
+
"orbit",
|
|
1631
|
+
"nebula",
|
|
1632
|
+
"voyager",
|
|
1633
|
+
"lander",
|
|
1634
|
+
"rover",
|
|
1635
|
+
"beacon",
|
|
1636
|
+
"harbor",
|
|
1637
|
+
"meadow",
|
|
1638
|
+
"fox"
|
|
1639
|
+
];
|
|
1640
|
+
const pick = (items) => (
|
|
1641
|
+
// eslint-disable-next-line sonarjs/pseudo-random -- cosmetic default project name, not a security decision.
|
|
1642
|
+
items[Math.floor(Math.random() * items.length)]
|
|
1643
|
+
);
|
|
1644
|
+
const generateProjectName = () => `${pick(ADJECTIVES)}-${pick(NOUNS)}`;
|
|
1645
|
+
|
|
1646
|
+
const isOnline = async () => dns.lookup("github.com").then(
|
|
1647
|
+
() => true,
|
|
1648
|
+
() => false
|
|
1649
|
+
);
|
|
1650
|
+
const GITHUB_SOURCE = /^(?:gh|github):([^/]+)\/([^#/]+)(?:\/[^#]*)?(?:#(.+))?$/;
|
|
1651
|
+
const parseGitHubSource = (source) => {
|
|
1652
|
+
const match = GITHUB_SOURCE.exec(source);
|
|
1653
|
+
if (match === null) {
|
|
1654
|
+
return void 0;
|
|
1655
|
+
}
|
|
1656
|
+
const [, owner, repo, ref] = match;
|
|
1657
|
+
if (owner === void 0 || repo === void 0) {
|
|
1658
|
+
return void 0;
|
|
1659
|
+
}
|
|
1660
|
+
return { owner, ref: ref ?? "HEAD", repo };
|
|
1661
|
+
};
|
|
1662
|
+
const templateRefExists = async (source) => {
|
|
1663
|
+
const parsed = parseGitHubSource(source);
|
|
1664
|
+
if (parsed === void 0) {
|
|
1665
|
+
return void 0;
|
|
1666
|
+
}
|
|
1667
|
+
const url = `https://codeload.github.com/${parsed.owner}/${parsed.repo}/tar.gz/${parsed.ref}`;
|
|
1668
|
+
try {
|
|
1669
|
+
const response = await fetch(url, { method: "HEAD" });
|
|
1670
|
+
if (response.status === 404) {
|
|
1671
|
+
return false;
|
|
1672
|
+
}
|
|
1673
|
+
return response.ok ? true : void 0;
|
|
1674
|
+
} catch {
|
|
1675
|
+
return void 0;
|
|
1676
|
+
}
|
|
1677
|
+
};
|
|
1678
|
+
const verifyRemoteTemplate = async (params) => {
|
|
1679
|
+
if (params.isLocal) {
|
|
1680
|
+
return true;
|
|
1681
|
+
}
|
|
1682
|
+
const isGitHubBacked = params.source === void 0 || parseGitHubSource(params.source) !== void 0;
|
|
1683
|
+
if (!isGitHubBacked) {
|
|
1684
|
+
return true;
|
|
1685
|
+
}
|
|
1686
|
+
if (!await isOnline()) {
|
|
1687
|
+
params.logger.error("you appear to be offline — connect to the internet and try again, or scaffold from a local template with `--from <dir>`.");
|
|
1688
|
+
return false;
|
|
1689
|
+
}
|
|
1690
|
+
if (params.source !== void 0 && await templateRefExists(params.source) === false) {
|
|
1691
|
+
params.logger.error(`template source not found: ${params.source} — double-check --ref / --source, or browse the templates at https://lunora.sh/docs.`);
|
|
1692
|
+
return false;
|
|
1693
|
+
}
|
|
1694
|
+
return true;
|
|
1695
|
+
};
|
|
1696
|
+
|
|
1697
|
+
const COPY = {
|
|
1698
|
+
extras: "Let's finish setting up your app.",
|
|
1699
|
+
framework: "Which framework should we launch?",
|
|
1700
|
+
git: "Initialize a new git repository? (optional)",
|
|
1701
|
+
install: "Install dependencies now?",
|
|
1702
|
+
name: "Where should we land your project?",
|
|
1703
|
+
nextHeader: "Liftoff confirmed — explore your project!",
|
|
1704
|
+
packageManager: "Which package manager?"
|
|
1705
|
+
};
|
|
294
1706
|
const TEXT_EXTENSIONS = /* @__PURE__ */ new Set([".gitignore", ".html", ".js", ".json", ".jsonc", ".md", ".mjs", ".ts", ".tsx"]);
|
|
295
1707
|
const VITE_CONFIG_CANDIDATES = ["vite.config.ts", "vite.config.mts", "vite.config.js", "vite.config.mjs"];
|
|
296
1708
|
const MINIMAL_VITE_CONFIG = `import { defineConfig } from "vite";
|
|
@@ -324,32 +1736,6 @@ export const send = mutation
|
|
|
324
1736
|
});
|
|
325
1737
|
`;
|
|
326
1738
|
const DEFAULT_SOURCE_BASE = "gh:anolilab/lunora/templates";
|
|
327
|
-
const DEFAULT_SOURCE_REF_FALLBACK = "alpha";
|
|
328
|
-
const resolveCliVersion = () => {
|
|
329
|
-
try {
|
|
330
|
-
let directory = dirname$1(fileURLToPath(import.meta.url));
|
|
331
|
-
for (let index = 0; index < 5; index += 1) {
|
|
332
|
-
const candidate = join$1(directory, "package.json");
|
|
333
|
-
if (existsSync(candidate)) {
|
|
334
|
-
const parsed = JSON.parse(readFileSync(candidate, "utf8"));
|
|
335
|
-
if (parsed.name === "@lunora/cli" && typeof parsed.version === "string") {
|
|
336
|
-
return parsed.version;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
const parent = dirname$1(directory);
|
|
340
|
-
if (parent === directory) {
|
|
341
|
-
break;
|
|
342
|
-
}
|
|
343
|
-
directory = parent;
|
|
344
|
-
}
|
|
345
|
-
} catch {
|
|
346
|
-
}
|
|
347
|
-
return "0.0.0";
|
|
348
|
-
};
|
|
349
|
-
const resolveDefaultSourceRef = () => {
|
|
350
|
-
const version = resolveCliVersion();
|
|
351
|
-
return version === "0.0.0" ? DEFAULT_SOURCE_REF_FALLBACK : `v${version}`;
|
|
352
|
-
};
|
|
353
1739
|
const isTextFile = (filePath) => {
|
|
354
1740
|
const lastDot = filePath.lastIndexOf(".");
|
|
355
1741
|
if (lastDot === -1) {
|
|
@@ -358,6 +1744,57 @@ const isTextFile = (filePath) => {
|
|
|
358
1744
|
return TEXT_EXTENSIONS.has(filePath.slice(lastDot));
|
|
359
1745
|
};
|
|
360
1746
|
const substitute = (content, name) => content.replaceAll("{{name}}", name);
|
|
1747
|
+
const isLunoraDep = (name) => name === "lunorash" || name.startsWith("@lunora/");
|
|
1748
|
+
const resolveLunoraVersions = async (files, distTag) => {
|
|
1749
|
+
const names = /* @__PURE__ */ new Set();
|
|
1750
|
+
for (const file of files) {
|
|
1751
|
+
if (basename(file) !== "package.json") {
|
|
1752
|
+
continue;
|
|
1753
|
+
}
|
|
1754
|
+
try {
|
|
1755
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
1756
|
+
for (const section of ["dependencies", "devDependencies"]) {
|
|
1757
|
+
for (const name of Object.keys(parsed[section] ?? {})) {
|
|
1758
|
+
if (isLunoraDep(name)) {
|
|
1759
|
+
names.add(name);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
} catch {
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
return resolveTagVersions(names, distTag);
|
|
1767
|
+
};
|
|
1768
|
+
const stampLunoraDeps = (packageJsonText, distTag, versions) => {
|
|
1769
|
+
let parsed;
|
|
1770
|
+
try {
|
|
1771
|
+
parsed = JSON.parse(packageJsonText);
|
|
1772
|
+
} catch {
|
|
1773
|
+
return packageJsonText;
|
|
1774
|
+
}
|
|
1775
|
+
let text = packageJsonText;
|
|
1776
|
+
for (const section of ["dependencies", "devDependencies"]) {
|
|
1777
|
+
for (const name of Object.keys(parsed[section] ?? {})) {
|
|
1778
|
+
if (!isLunoraDep(name)) {
|
|
1779
|
+
continue;
|
|
1780
|
+
}
|
|
1781
|
+
const pin = versions.get(name) ?? distTag;
|
|
1782
|
+
const edits = modify(text, [section, name], pin, { formattingOptions: { insertSpaces: true, tabSize: 4 } });
|
|
1783
|
+
text = applyEdits(text, edits);
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
return text;
|
|
1787
|
+
};
|
|
1788
|
+
const PNPM_BUILT_DEPENDENCIES = ["esbuild", "sharp", "workerd"];
|
|
1789
|
+
const PNPM_WORKSPACE_FILENAME = "pnpm-workspace.yaml";
|
|
1790
|
+
const pnpmWorkspaceYaml = () => [
|
|
1791
|
+
"# pnpm reads its settings from here (the package.json `pnpm` field is no longer read).",
|
|
1792
|
+
"# Pre-approve the toolchain's native build scripts so `pnpm install` runs them",
|
|
1793
|
+
"# without the interactive `pnpm approve-builds` step.",
|
|
1794
|
+
"allowBuilds:",
|
|
1795
|
+
...PNPM_BUILT_DEPENDENCIES.map((name) => ` ${name}: true`),
|
|
1796
|
+
""
|
|
1797
|
+
].join("\n");
|
|
361
1798
|
const collectFiles = (directory) => {
|
|
362
1799
|
const out = [];
|
|
363
1800
|
for (const entry of walkSync(directory, { includeDirs: false, includeFiles: true })) {
|
|
@@ -365,15 +1802,20 @@ const collectFiles = (directory) => {
|
|
|
365
1802
|
}
|
|
366
1803
|
return out;
|
|
367
1804
|
};
|
|
368
|
-
const copyTemplate = (sourceDirectory, target, name) => {
|
|
1805
|
+
const copyTemplate = async (sourceDirectory, target, name) => {
|
|
369
1806
|
const files = collectFiles(sourceDirectory);
|
|
370
1807
|
const written = [];
|
|
1808
|
+
const distTag = resolveDistTag();
|
|
1809
|
+
const versions = await resolveLunoraVersions(files, distTag);
|
|
371
1810
|
for (const source of files) {
|
|
372
1811
|
const relativePath = relative(sourceDirectory, source);
|
|
373
1812
|
const destination = join$1(target, relativePath);
|
|
374
1813
|
mkdirSync(dirname$1(destination), { recursive: true });
|
|
375
1814
|
const raw = readFileSync(source);
|
|
376
|
-
|
|
1815
|
+
let text = isTextFile(source) ? substitute(raw.toString("utf8"), name) : void 0;
|
|
1816
|
+
if (text !== void 0 && basename(source) === "package.json") {
|
|
1817
|
+
text = stampLunoraDeps(text, distTag, versions);
|
|
1818
|
+
}
|
|
377
1819
|
if (text === void 0) {
|
|
378
1820
|
writeFileSync(destination, raw);
|
|
379
1821
|
} else {
|
|
@@ -383,11 +1825,11 @@ const copyTemplate = (sourceDirectory, target, name) => {
|
|
|
383
1825
|
}
|
|
384
1826
|
return written;
|
|
385
1827
|
};
|
|
386
|
-
const resolveTemplateSource = (templateType, source) => {
|
|
1828
|
+
const resolveTemplateSource = (templateType, source, ref) => {
|
|
387
1829
|
if (source !== void 0 && source.length > 0) {
|
|
388
1830
|
return source;
|
|
389
1831
|
}
|
|
390
|
-
return `${DEFAULT_SOURCE_BASE}/${templateType}#${
|
|
1832
|
+
return `${DEFAULT_SOURCE_BASE}/${templateType}#${resolveSourceRef(ref)}`;
|
|
391
1833
|
};
|
|
392
1834
|
const isSafeSource = (source) => {
|
|
393
1835
|
if (source.includes("..")) {
|
|
@@ -395,46 +1837,205 @@ const isSafeSource = (source) => {
|
|
|
395
1837
|
}
|
|
396
1838
|
return source.startsWith("gh:") || source.startsWith("github:") || source.startsWith("https://");
|
|
397
1839
|
};
|
|
398
|
-
const
|
|
1840
|
+
const logWould = (logger, action) => {
|
|
1841
|
+
logger.info(`[dry-run] would ${action}`);
|
|
1842
|
+
};
|
|
1843
|
+
const logScaffoldSuccess = (logger, written, target) => {
|
|
1844
|
+
if (isInteractive()) {
|
|
1845
|
+
process.stdout.write("\n");
|
|
1846
|
+
}
|
|
399
1847
|
logger.success(`scaffolded ${String(written.length)} files into ${target}`);
|
|
400
|
-
logger.info("next steps:");
|
|
401
|
-
logger.info(` cd ${name}`);
|
|
402
|
-
logger.info(" pnpm install");
|
|
403
|
-
logger.info(" pnpm dev");
|
|
404
1848
|
};
|
|
405
|
-
const
|
|
1849
|
+
const runScriptCommand = (manager, script) => {
|
|
1850
|
+
if (manager === "npm") {
|
|
1851
|
+
return `npm run ${script}`;
|
|
1852
|
+
}
|
|
1853
|
+
if (manager === "bun") {
|
|
1854
|
+
return `bun run ${script}`;
|
|
1855
|
+
}
|
|
1856
|
+
return `${manager} ${script}`;
|
|
1857
|
+
};
|
|
1858
|
+
const isInsideMonorepo = (startDirectory) => {
|
|
1859
|
+
let directory = resolve(startDirectory);
|
|
1860
|
+
for (; ; ) {
|
|
1861
|
+
if (existsSync(join$1(directory, "pnpm-workspace.yaml"))) {
|
|
1862
|
+
return true;
|
|
1863
|
+
}
|
|
1864
|
+
const packagePath = join$1(directory, "package.json");
|
|
1865
|
+
if (existsSync(packagePath)) {
|
|
1866
|
+
try {
|
|
1867
|
+
const parsed = JSON.parse(readFileSync(packagePath, "utf8"));
|
|
1868
|
+
if (parsed.workspaces !== void 0) {
|
|
1869
|
+
return true;
|
|
1870
|
+
}
|
|
1871
|
+
} catch {
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
const parent = dirname$1(directory);
|
|
1875
|
+
if (parent === directory) {
|
|
1876
|
+
return false;
|
|
1877
|
+
}
|
|
1878
|
+
directory = parent;
|
|
1879
|
+
}
|
|
1880
|
+
};
|
|
1881
|
+
const isInsideGitRepo = (startDirectory) => {
|
|
1882
|
+
let directory = resolve(startDirectory);
|
|
1883
|
+
for (; ; ) {
|
|
1884
|
+
if (existsSync(join$1(directory, ".git"))) {
|
|
1885
|
+
return true;
|
|
1886
|
+
}
|
|
1887
|
+
const parent = dirname$1(directory);
|
|
1888
|
+
if (parent === directory) {
|
|
1889
|
+
return false;
|
|
1890
|
+
}
|
|
1891
|
+
directory = parent;
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1894
|
+
const maybeOfferGit = async (options, target) => {
|
|
1895
|
+
if (options.yes === true || !isInteractive() || isInsideGitRepo(dirname$1(target))) {
|
|
1896
|
+
return;
|
|
1897
|
+
}
|
|
1898
|
+
if (!await tuiConfirm(COPY.git, { badge: BADGES.git, defaultYes: false })) {
|
|
1899
|
+
await tuiInfo("Sounds good! You can always run git init manually.");
|
|
1900
|
+
return;
|
|
1901
|
+
}
|
|
1902
|
+
if (options.dryRun === true) {
|
|
1903
|
+
logWould(options.logger, "initialize a git repository");
|
|
1904
|
+
return;
|
|
1905
|
+
}
|
|
1906
|
+
const spawner = options.spawner ?? defaultSpawner;
|
|
1907
|
+
const result = await withTuiSpinner("Initializing a git repository…", () => spawner({ args: ["init"], command: "git", cwd: target }));
|
|
1908
|
+
if (result.code === 0) {
|
|
1909
|
+
await emitStep("git", "Initialized an empty git repository.");
|
|
1910
|
+
} else {
|
|
1911
|
+
options.logger.warn("`git init` failed — initialize it yourself later with `git init`.");
|
|
1912
|
+
}
|
|
1913
|
+
};
|
|
1914
|
+
const printNextSteps = async (name, installed, insideMonorepo) => {
|
|
1915
|
+
const manager = installed ?? "pnpm";
|
|
1916
|
+
const steps = [{ code: `cd ./${name}`, lead: "Enter your project directory using" }];
|
|
1917
|
+
if (installed === void 0) {
|
|
1918
|
+
steps.push({ code: `${manager} install`, lead: "Install dependencies with", tail: insideMonorepo ? " from the workspace root" : void 0 });
|
|
1919
|
+
}
|
|
1920
|
+
steps.push(
|
|
1921
|
+
{ code: runScriptCommand(manager, "dev"), lead: "Run", tail: " to start the dev server." },
|
|
1922
|
+
{ code: "lunora add", lead: "Add features like auth or storage using" }
|
|
1923
|
+
);
|
|
1924
|
+
const help = [
|
|
1925
|
+
{ code: "https://lunora.sh/docs", lead: "Read the docs at" },
|
|
1926
|
+
{ code: "https://lunora.sh/chat", lead: "Stuck? Join the chat at" }
|
|
1927
|
+
];
|
|
1928
|
+
if (isInteractive()) {
|
|
1929
|
+
await tuiNextSteps(BADGES.next, COPY.nextHeader, steps, help);
|
|
1930
|
+
return;
|
|
1931
|
+
}
|
|
1932
|
+
const lines = steps.map((step) => `${step.lead} ${step.code}${step.tail ?? ""}`);
|
|
1933
|
+
lines.push("", ...help.map((line) => `${line.lead} ${line.code}${line.tail ?? ""}`));
|
|
1934
|
+
await emitStep("next", COPY.nextHeader, lines.join("\n"));
|
|
1935
|
+
};
|
|
1936
|
+
const offerInstallIsInteractive = (options) => options.yes !== true && (options.installPrompt !== void 0 || isInteractive());
|
|
1937
|
+
const maybeOfferInstall = async (options, target) => {
|
|
1938
|
+
if (!offerInstallIsInteractive(options)) {
|
|
1939
|
+
return void 0;
|
|
1940
|
+
}
|
|
1941
|
+
if (isInsideMonorepo(dirname$1(target))) {
|
|
1942
|
+
return void 0;
|
|
1943
|
+
}
|
|
1944
|
+
const managers = detectInstalledManagers(options.packageManagerProbe);
|
|
1945
|
+
const [defaultManager] = managers;
|
|
1946
|
+
if (defaultManager === void 0) {
|
|
1947
|
+
return void 0;
|
|
1948
|
+
}
|
|
1949
|
+
const confirm = options.installPrompt?.confirmInstall ?? (async () => tuiConfirm(COPY.install, { badge: BADGES.deps, defaultYes: true }));
|
|
1950
|
+
if (!await confirm()) {
|
|
1951
|
+
await tuiInfo("No problem! Remember to install dependencies after setup.");
|
|
1952
|
+
return void 0;
|
|
1953
|
+
}
|
|
1954
|
+
let manager = defaultManager;
|
|
1955
|
+
if (managers.length > 1) {
|
|
1956
|
+
manager = options.installPrompt ? await options.installPrompt.selectManager(managers) : await tuiSelect(
|
|
1957
|
+
COPY.packageManager,
|
|
1958
|
+
managers.map((candidate) => {
|
|
1959
|
+
return { label: candidate, value: candidate };
|
|
1960
|
+
}),
|
|
1961
|
+
{ badge: BADGES.deps, default: defaultManager }
|
|
1962
|
+
) ?? defaultManager;
|
|
1963
|
+
}
|
|
1964
|
+
if (options.dryRun === true) {
|
|
1965
|
+
logWould(options.logger, `install dependencies with ${manager}`);
|
|
1966
|
+
return void 0;
|
|
1967
|
+
}
|
|
1968
|
+
if (manager === "pnpm") {
|
|
1969
|
+
const workspacePath = join$1(target, PNPM_WORKSPACE_FILENAME);
|
|
1970
|
+
if (!existsSync(workspacePath)) {
|
|
1971
|
+
writeFileSync(workspacePath, pnpmWorkspaceYaml(), "utf8");
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
const spawner = options.spawner ?? defaultSpawner;
|
|
1975
|
+
const { args, command } = installArgsFor(manager);
|
|
1976
|
+
await emitStep("deps", `Installing dependencies with ${manager}…`);
|
|
1977
|
+
const result = await spawner({ args, command, cwd: target });
|
|
1978
|
+
if (result.code !== 0) {
|
|
1979
|
+
options.logger.warn(`\`${command} install\` exited with code ${String(result.code)} — run it yourself in ${basename(target)}/.`);
|
|
1980
|
+
return void 0;
|
|
1981
|
+
}
|
|
1982
|
+
await emitStep("deps", `Dependencies installed with ${manager}.`);
|
|
1983
|
+
return manager;
|
|
1984
|
+
};
|
|
1985
|
+
const scaffoldFromLocal = async (fromRoot, templateType, target, name, logger) => {
|
|
406
1986
|
const templateDirectory = join$1(fromRoot, templateType);
|
|
407
1987
|
if (!existsSync(templateDirectory)) {
|
|
408
1988
|
logger.error(`template not found in local source: ${templateDirectory}`);
|
|
409
1989
|
return { code: 1, files: [], target };
|
|
410
1990
|
}
|
|
411
|
-
const written = copyTemplate(templateDirectory, target, name);
|
|
412
|
-
logScaffoldSuccess(logger, written, target
|
|
1991
|
+
const written = await copyTemplate(templateDirectory, target, name);
|
|
1992
|
+
logScaffoldSuccess(logger, written, target);
|
|
413
1993
|
return { code: 0, files: written, target };
|
|
414
1994
|
};
|
|
415
|
-
const scaffoldFromRemote = async (
|
|
1995
|
+
const scaffoldFromRemote = async (options) => {
|
|
1996
|
+
const { logger, name, ref, source, target, templateType } = options;
|
|
416
1997
|
const stagingRoot = mkdtempSync(join$1(tmpdir(), "lunora-init-fetch-"));
|
|
417
1998
|
const stagingDirectory = join$1(stagingRoot, "template");
|
|
418
1999
|
try {
|
|
419
|
-
const remote = resolveTemplateSource(templateType, source);
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
2000
|
+
const remote = resolveTemplateSource(templateType, source, ref);
|
|
2001
|
+
let downloaded;
|
|
2002
|
+
let written = [];
|
|
2003
|
+
await tuiTasks(
|
|
2004
|
+
[
|
|
2005
|
+
{
|
|
2006
|
+
label: `${templateType} template fetched`,
|
|
2007
|
+
run: async () => {
|
|
2008
|
+
downloaded = await downloadTemplate(remote, {
|
|
2009
|
+
cwd: stagingRoot,
|
|
2010
|
+
dir: stagingDirectory,
|
|
2011
|
+
force: true,
|
|
2012
|
+
install: false,
|
|
2013
|
+
silent: true
|
|
2014
|
+
});
|
|
2015
|
+
}
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
label: `files copied into ${name}/`,
|
|
2019
|
+
run: async () => {
|
|
2020
|
+
written = await copyTemplate(stagingDirectory, target, name);
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
],
|
|
2024
|
+
{ end: "Project initialized!", start: "Project initializing…" }
|
|
2025
|
+
);
|
|
428
2026
|
const staged = collectFiles(stagingDirectory);
|
|
429
|
-
if (
|
|
430
|
-
|
|
431
|
-
} else {
|
|
432
|
-
logger.info(`resolved ${downloaded.source} (${String(staged.length)} file(s))`);
|
|
2027
|
+
if (isInteractive()) {
|
|
2028
|
+
process.stdout.write("\n");
|
|
433
2029
|
}
|
|
434
|
-
|
|
435
|
-
|
|
2030
|
+
logger.info(
|
|
2031
|
+
downloaded?.commit ? `template: ${downloaded.source} @ ${downloaded.commit} (${String(staged.length)} files)` : `template: ${downloaded?.source ?? remote} (${String(staged.length)} files)`
|
|
2032
|
+
);
|
|
2033
|
+
logScaffoldSuccess(logger, written, target);
|
|
436
2034
|
return { code: 0, files: written, target };
|
|
437
2035
|
} catch (error) {
|
|
2036
|
+
if (error instanceof PromptCancelledError) {
|
|
2037
|
+
throw error;
|
|
2038
|
+
}
|
|
438
2039
|
const message = error instanceof Error ? error.message : String(error);
|
|
439
2040
|
logger.error(`failed to download template: ${message}`);
|
|
440
2041
|
return { code: 1, files: [], target };
|
|
@@ -442,6 +2043,64 @@ const scaffoldFromRemote = async (source, templateType, target, name, logger) =>
|
|
|
442
2043
|
rmSync(stagingRoot, { force: true, recursive: true });
|
|
443
2044
|
}
|
|
444
2045
|
};
|
|
2046
|
+
const renameCreateViteDotfiles = (directory) => {
|
|
2047
|
+
for (const file of ["_gitignore", "_npmrc", "_gitattributes"]) {
|
|
2048
|
+
const from = join$1(directory, file);
|
|
2049
|
+
if (existsSync(from)) {
|
|
2050
|
+
renameSync(from, join$1(directory, `.${file.slice(1)}`));
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
};
|
|
2054
|
+
const scaffoldViteOverlay = async (options) => {
|
|
2055
|
+
const { framework, logger, name, overlayBaseFrom, target } = options;
|
|
2056
|
+
const adapter = ADAPTERS[framework];
|
|
2057
|
+
const stagingRoot = mkdtempSync(join$1(tmpdir(), "lunora-vite-base-"));
|
|
2058
|
+
try {
|
|
2059
|
+
let localBase;
|
|
2060
|
+
if (overlayBaseFrom !== void 0) {
|
|
2061
|
+
localBase = join$1(overlayBaseFrom, `template-${adapter.createViteTemplate}`);
|
|
2062
|
+
if (!existsSync(localBase)) {
|
|
2063
|
+
logger.error(`create-vite base not found on disk: ${localBase}`);
|
|
2064
|
+
return { code: 1, files: [], target };
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
const copyBase = async () => {
|
|
2068
|
+
if (localBase !== void 0) {
|
|
2069
|
+
cpSync(localBase, target, { recursive: true });
|
|
2070
|
+
return;
|
|
2071
|
+
}
|
|
2072
|
+
const stagingDirectory = join$1(stagingRoot, "base");
|
|
2073
|
+
const remote = `github:vitejs/vite/packages/create-vite/template-${adapter.createViteTemplate}#main`;
|
|
2074
|
+
await downloadTemplate(remote, { cwd: stagingRoot, dir: stagingDirectory, force: true, install: false, silent: true });
|
|
2075
|
+
renameCreateViteDotfiles(stagingDirectory);
|
|
2076
|
+
cpSync(stagingDirectory, target, { recursive: true });
|
|
2077
|
+
};
|
|
2078
|
+
let written = [];
|
|
2079
|
+
await tuiTasks(
|
|
2080
|
+
[
|
|
2081
|
+
{ label: `create-vite (${adapter.label}) base ready`, run: copyBase },
|
|
2082
|
+
{
|
|
2083
|
+
label: `Lunora overlay applied (${adapter.label})`,
|
|
2084
|
+
run: async () => {
|
|
2085
|
+
written = await applyLunoraOverlay({ adapter, distTag: resolveDistTag(), logger, name, target });
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
],
|
|
2089
|
+
{ end: "Project initialized!", start: "Project initializing…" }
|
|
2090
|
+
);
|
|
2091
|
+
logScaffoldSuccess(logger, written, target);
|
|
2092
|
+
return { code: 0, files: [...collectFiles(target)], target };
|
|
2093
|
+
} catch (error) {
|
|
2094
|
+
if (error instanceof PromptCancelledError) {
|
|
2095
|
+
throw error;
|
|
2096
|
+
}
|
|
2097
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2098
|
+
logger.error(`failed to scaffold the ${adapter.label} base: ${message}`);
|
|
2099
|
+
return { code: 1, files: [], target };
|
|
2100
|
+
} finally {
|
|
2101
|
+
rmSync(stagingRoot, { force: true, recursive: true });
|
|
2102
|
+
}
|
|
2103
|
+
};
|
|
445
2104
|
const createMinimalViteConfig = (cwd, logger) => {
|
|
446
2105
|
const target = join$1(cwd, "vite.config.ts");
|
|
447
2106
|
try {
|
|
@@ -559,68 +2218,247 @@ const runInPlaceInit = (cwd, logger) => {
|
|
|
559
2218
|
const offerIsInteractive = (options) => options.yes !== true && (options.prompt !== void 0 || (options.interactive ?? isInteractive()));
|
|
560
2219
|
const maybeOfferExtras = async (options, projectDirectory) => {
|
|
561
2220
|
const interactive = offerIsInteractive(options);
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
2221
|
+
const preselected = options.add === void 0 ? [] : parseFeatureList(options.add, (message) => {
|
|
2222
|
+
options.logger.warn(message);
|
|
2223
|
+
});
|
|
2224
|
+
const applyAll = async (plans) => {
|
|
2225
|
+
if (plans.length === 0) {
|
|
2226
|
+
return true;
|
|
2227
|
+
}
|
|
2228
|
+
if (options.dryRun === true) {
|
|
2229
|
+
logWould(options.logger, `add ${plans.map((plan) => plan.label).join(", ")}`);
|
|
2230
|
+
return true;
|
|
2231
|
+
}
|
|
2232
|
+
const buffered = [];
|
|
2233
|
+
const applyLogger = isInteractive() ? {
|
|
2234
|
+
error: (message) => {
|
|
2235
|
+
buffered.push({ level: "error", message });
|
|
2236
|
+
},
|
|
2237
|
+
info: () => {
|
|
2238
|
+
},
|
|
2239
|
+
success: () => {
|
|
2240
|
+
},
|
|
2241
|
+
warn: (message) => {
|
|
2242
|
+
buffered.push({ level: "warn", message });
|
|
2243
|
+
}
|
|
2244
|
+
} : options.logger;
|
|
2245
|
+
const steps = plans.map((plan) => {
|
|
2246
|
+
return {
|
|
2247
|
+
running: `adding ${plan.label}…`,
|
|
2248
|
+
task: () => runAddCommand({
|
|
2249
|
+
allowUnsafeSource: options.allowUnsafeSource,
|
|
2250
|
+
cwd: projectDirectory,
|
|
2251
|
+
from: options.registryFrom,
|
|
2252
|
+
logger: applyLogger,
|
|
2253
|
+
names: [...plan.names],
|
|
2254
|
+
ref: options.ref,
|
|
2255
|
+
source: options.registrySource,
|
|
2256
|
+
transformManifest: plan.transformManifest,
|
|
2257
|
+
yes: true
|
|
2258
|
+
})
|
|
2259
|
+
};
|
|
571
2260
|
});
|
|
572
|
-
|
|
2261
|
+
const done = `added ${plans.map((plan) => plan.label).join(", ")}`;
|
|
2262
|
+
const results = await withTuiBadgeProgress(BADGES.add, steps, done);
|
|
2263
|
+
for (const { level, message } of buffered) {
|
|
2264
|
+
options.logger[level](message);
|
|
2265
|
+
}
|
|
2266
|
+
return results.every((result) => result.code === 0);
|
|
573
2267
|
};
|
|
574
|
-
|
|
575
|
-
|
|
2268
|
+
const deps = {
|
|
2269
|
+
applyAll,
|
|
576
2270
|
interactive,
|
|
577
2271
|
logger: options.logger,
|
|
578
|
-
multiSelect: options.prompt?.multiSelect ?? ((message, choices, settings) =>
|
|
579
|
-
|
|
580
|
-
|
|
2272
|
+
multiSelect: options.prompt?.multiSelect ?? ((message, choices, settings) => tuiMultiSelect(message, choices, { ...settings, badge: BADGES.add })),
|
|
2273
|
+
preselected: preselected.length > 0 ? preselected : void 0,
|
|
2274
|
+
projectName: basename(projectDirectory),
|
|
2275
|
+
select: options.prompt?.select ?? ((message, choices, settings) => tuiSelect(message, choices, { ...settings, badge: BADGES.add })),
|
|
2276
|
+
text: options.prompt?.text ?? ((message, settings) => tuiText(message, { ...settings, badge: BADGES.add }))
|
|
2277
|
+
};
|
|
2278
|
+
if (preselected.length > 0) {
|
|
2279
|
+
await offerRegistryExtras(deps);
|
|
2280
|
+
return;
|
|
2281
|
+
}
|
|
2282
|
+
if (isInteractive()) {
|
|
2283
|
+
await tuiHeadline(COPY.extras);
|
|
2284
|
+
}
|
|
2285
|
+
await offerRegistryExtras(deps);
|
|
2286
|
+
};
|
|
2287
|
+
const DEFAULT_FRAMEWORK = "react";
|
|
2288
|
+
const FRAMEWORK_CHOICES = [
|
|
2289
|
+
{ description: "React SPA — official create-vite base + the Lunora layer (the default)", label: "React", value: "react" },
|
|
2290
|
+
{ description: "Vue SPA — create-vite base + Lunora", label: "Vue", value: "vue" },
|
|
2291
|
+
{ description: "Solid SPA — create-vite base + Lunora", label: "Solid", value: "solid" },
|
|
2292
|
+
{ description: "Svelte SPA — create-vite base + Lunora", label: "Svelte", value: "svelte" },
|
|
2293
|
+
{ description: "TanStack Start (React) — SSR with live-loader routes", label: "TanStack Start · React", value: "tanstack-start-react" },
|
|
2294
|
+
{ description: "TanStack Start (Solid)", label: "TanStack Start · Solid", value: "tanstack-start-solid" },
|
|
2295
|
+
{ description: "React Router (v7, framework mode) — SSR composed into the Lunora worker", label: "React Router", value: "react-router" },
|
|
2296
|
+
{ description: "Astro + a standalone Lunora worker", label: "Astro", value: "astro" },
|
|
2297
|
+
{ description: "AnalogJS (Angular) — single-worker, Lunora mounted in Nitro", label: "Analog", value: "analog" },
|
|
2298
|
+
{ description: "Nuxt (Vue) — single-worker, Lunora mounted in Nitro", label: "Nuxt", value: "nuxt" },
|
|
2299
|
+
{ description: "SvelteKit + a standalone Lunora worker", label: "SvelteKit", value: "sveltekit" },
|
|
2300
|
+
{ description: "Worker only — no frontend", label: "Standalone", value: "standalone" }
|
|
2301
|
+
];
|
|
2302
|
+
const OVERLAY_VALUES = Object.keys(ADAPTERS).join("|");
|
|
2303
|
+
const TEMPLATE_VALUES = FRAMEWORK_CHOICES.filter((choice) => !isOverlayFramework(choice.value)).map((choice) => choice.value).join("|");
|
|
2304
|
+
const toScaffoldChoice = (value) => isOverlayFramework(value) ? { framework: value, kind: "overlay" } : { kind: "template", templateType: value };
|
|
2305
|
+
const resolveScaffoldChoice = async (options) => {
|
|
2306
|
+
if (options.vite !== void 0) {
|
|
2307
|
+
return { framework: options.vite, kind: "overlay" };
|
|
2308
|
+
}
|
|
2309
|
+
if (options.templateType !== void 0) {
|
|
2310
|
+
return { kind: "template", templateType: options.templateType };
|
|
2311
|
+
}
|
|
2312
|
+
if (!isInteractive() || options.yes === true) {
|
|
2313
|
+
return { framework: DEFAULT_FRAMEWORK, kind: "overlay" };
|
|
2314
|
+
}
|
|
2315
|
+
return toScaffoldChoice(await tuiSelect(COPY.framework, FRAMEWORK_CHOICES, { badge: BADGES.tmpl, default: DEFAULT_FRAMEWORK }) ?? DEFAULT_FRAMEWORK);
|
|
2316
|
+
};
|
|
2317
|
+
const nonInteractiveInitError = (options) => {
|
|
2318
|
+
if (isInteractive() || options.yes === true) {
|
|
2319
|
+
return void 0;
|
|
2320
|
+
}
|
|
2321
|
+
const missing = [];
|
|
2322
|
+
if (options.name === void 0) {
|
|
2323
|
+
missing.push("a project name (`lunora init <name>`)");
|
|
2324
|
+
}
|
|
2325
|
+
if (options.templateType === void 0 && options.vite === void 0) {
|
|
2326
|
+
missing.push(`a framework — \`--vite <${OVERLAY_VALUES}>\` for an SPA, or \`-t <${TEMPLATE_VALUES}>\` for a bespoke template`);
|
|
2327
|
+
}
|
|
2328
|
+
if (missing.length === 0) {
|
|
2329
|
+
return void 0;
|
|
2330
|
+
}
|
|
2331
|
+
return `lunora init can't prompt in a non-interactive terminal — provide ${missing.join(" and ")}, or pass --yes to accept the defaults.`;
|
|
581
2332
|
};
|
|
582
|
-
const
|
|
583
|
-
|
|
584
|
-
|
|
2333
|
+
const scaffoldOverlayPath = async (options, framework, name, target) => {
|
|
2334
|
+
if (!isOverlayFramework(framework)) {
|
|
2335
|
+
options.logger.error(`init: unknown framework "${framework}". Supported overlays: ${Object.keys(ADAPTERS).join(", ")}.`);
|
|
2336
|
+
return { code: 1, files: [], target };
|
|
2337
|
+
}
|
|
2338
|
+
if (!await verifyRemoteTemplate({ isLocal: options.overlayBaseFrom !== void 0, logger: options.logger })) {
|
|
2339
|
+
return { code: 1, files: [], target };
|
|
2340
|
+
}
|
|
2341
|
+
mkdirSync(target, { recursive: true });
|
|
2342
|
+
return scaffoldViteOverlay({ framework, logger: options.logger, name, overlayBaseFrom: options.overlayBaseFrom, target });
|
|
2343
|
+
};
|
|
2344
|
+
const scaffoldTemplatePath = async (options, templateType, name, target) => {
|
|
585
2345
|
if (templateType === "next") {
|
|
586
|
-
options.logger.warn('template "next" is not yet available — re-run with
|
|
2346
|
+
options.logger.warn('template "next" is not yet available — re-run with `--vite react` or `-t standalone`.');
|
|
2347
|
+
return { code: 1, files: [], target };
|
|
2348
|
+
}
|
|
2349
|
+
if (options.from !== void 0) {
|
|
2350
|
+
return await scaffoldFromLocal(options.from, templateType, target, name, options.logger);
|
|
2351
|
+
}
|
|
2352
|
+
if (options.source !== void 0 && options.source.length > 0 && !options.allowUnsafeSource && !isSafeSource(options.source)) {
|
|
2353
|
+
options.logger.error(
|
|
2354
|
+
`init: refusing --source ${options.source} — only gh:, github:, or https:// sources are allowed (and may not contain ".."). Re-run with --allow-unsafe-source if you really want this.`
|
|
2355
|
+
);
|
|
2356
|
+
return { code: 1, files: [], target };
|
|
2357
|
+
}
|
|
2358
|
+
if (!await verifyRemoteTemplate({ isLocal: false, logger: options.logger, source: resolveTemplateSource(templateType, options.source, options.ref) })) {
|
|
2359
|
+
return { code: 1, files: [], target };
|
|
2360
|
+
}
|
|
2361
|
+
return scaffoldFromRemote({ logger: options.logger, name, ref: options.ref, source: options.source, target, templateType });
|
|
2362
|
+
};
|
|
2363
|
+
const scaffoldNewProject = async (options, cwd, recordTarget) => {
|
|
2364
|
+
await tuiMoonrise("realtime backend on Cloudflare Workers + Durable Objects");
|
|
2365
|
+
const blocked = nonInteractiveInitError(options);
|
|
2366
|
+
if (blocked !== void 0) {
|
|
2367
|
+
options.logger.error(blocked);
|
|
587
2368
|
return { code: 1, files: [], target: "" };
|
|
588
2369
|
}
|
|
2370
|
+
const suggestedName = generateProjectName();
|
|
2371
|
+
const name = options.name ?? await tuiText(COPY.name, { badge: BADGES.dir, default: suggestedName, placeholder: suggestedName });
|
|
2372
|
+
const choice = await resolveScaffoldChoice(options);
|
|
589
2373
|
if (name.includes("/") || name.includes("\\") || name === ".." || name === ".") {
|
|
590
2374
|
options.logger.error(`init: refusing project name "${name}" — must not contain path separators or be "." / "..".`);
|
|
591
2375
|
return { code: 1, files: [], target: "" };
|
|
592
2376
|
}
|
|
593
2377
|
const target = resolve(cwd, name);
|
|
594
|
-
|
|
2378
|
+
const targetPreExisted = existsSync(target);
|
|
2379
|
+
if (targetPreExisted) {
|
|
595
2380
|
const entries = readdirSync(target);
|
|
596
2381
|
if (entries.length > 0) {
|
|
597
2382
|
options.logger.error(`target directory not empty: ${target}`);
|
|
598
2383
|
return { code: 1, files: [], target };
|
|
599
2384
|
}
|
|
600
2385
|
}
|
|
601
|
-
if (options.
|
|
602
|
-
|
|
2386
|
+
if (options.dryRun === true) {
|
|
2387
|
+
const what = choice.kind === "overlay" ? `the ${choice.framework} create-vite overlay` : `the ${choice.templateType} template`;
|
|
2388
|
+
logWould(options.logger, `scaffold ${what} into ${target}`);
|
|
2389
|
+
return { code: 0, files: [], target };
|
|
603
2390
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
2391
|
+
recordTarget(target, targetPreExisted);
|
|
2392
|
+
return choice.kind === "overlay" ? scaffoldOverlayPath(options, choice.framework, name, target) : scaffoldTemplatePath(options, choice.templateType, name, target);
|
|
2393
|
+
};
|
|
2394
|
+
const resetScaffoldOnCancel = (cleanup, logger) => {
|
|
2395
|
+
const { target, targetPreExisted } = cleanup;
|
|
2396
|
+
if (target === void 0 || !existsSync(target)) {
|
|
2397
|
+
return;
|
|
2398
|
+
}
|
|
2399
|
+
if (targetPreExisted === true) {
|
|
2400
|
+
for (const entry of readdirSync(target)) {
|
|
2401
|
+
rmSync(join$1(target, entry), { force: true, recursive: true });
|
|
2402
|
+
}
|
|
2403
|
+
} else {
|
|
2404
|
+
rmSync(target, { force: true, recursive: true });
|
|
2405
|
+
}
|
|
2406
|
+
logger.info(`removed the partially-created project at ${target}`);
|
|
2407
|
+
};
|
|
2408
|
+
const runScaffoldStep = async (options, cwd, recordTarget) => {
|
|
2409
|
+
if (options.inPlace !== true) {
|
|
2410
|
+
return scaffoldNewProject(options, cwd, recordTarget);
|
|
2411
|
+
}
|
|
2412
|
+
if (options.dryRun === true) {
|
|
2413
|
+
logWould(options.logger, `configure Lunora into ${cwd}`);
|
|
2414
|
+
return { code: 0, files: [], target: cwd };
|
|
2415
|
+
}
|
|
2416
|
+
return runInPlaceInit(cwd, options.logger);
|
|
2417
|
+
};
|
|
2418
|
+
const runPostScaffold = async (options, result, cwd) => {
|
|
2419
|
+
await maybeOfferExtras(options, result.target);
|
|
2420
|
+
const installedManager = options.inPlace === true ? void 0 : await maybeOfferInstall(options, result.target);
|
|
2421
|
+
if (options.inPlace !== true) {
|
|
2422
|
+
await maybeOfferGit(options, result.target);
|
|
2423
|
+
await printNextSteps(basename(result.target), installedManager, isInsideMonorepo(cwd));
|
|
2424
|
+
await emitMascot(options.logger);
|
|
609
2425
|
}
|
|
610
|
-
|
|
2426
|
+
};
|
|
2427
|
+
const scaffoldCiPipeline = (options, result, cwd) => {
|
|
2428
|
+
if (result.code !== 0 || options.ci === void 0) {
|
|
2429
|
+
return;
|
|
2430
|
+
}
|
|
2431
|
+
if (options.dryRun === true) {
|
|
2432
|
+
logWould(options.logger, `scaffold a ${options.ci} CI deploy pipeline`);
|
|
2433
|
+
return;
|
|
2434
|
+
}
|
|
2435
|
+
scaffoldCiWorkflow(options.inPlace === true ? cwd : result.target, options.ci, options.logger);
|
|
611
2436
|
};
|
|
612
2437
|
const runInitCommand = async (options) => {
|
|
613
2438
|
const cwd = options.cwd ?? process.cwd();
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
2439
|
+
const cleanup = {};
|
|
2440
|
+
let result;
|
|
2441
|
+
try {
|
|
2442
|
+
result = await runScaffoldStep(options, cwd, (target, preExisted) => {
|
|
2443
|
+
cleanup.target = target;
|
|
2444
|
+
cleanup.targetPreExisted = preExisted;
|
|
2445
|
+
});
|
|
2446
|
+
if (result.code === 0 && result.target !== "") {
|
|
2447
|
+
cleanup.target = void 0;
|
|
2448
|
+
await runPostScaffold(options, result, cwd);
|
|
2449
|
+
}
|
|
2450
|
+
} catch (error) {
|
|
2451
|
+
if (error instanceof PromptCancelledError) {
|
|
2452
|
+
resetScaffoldOnCancel(cleanup, options.logger);
|
|
2453
|
+
process.stdout.write("\n ✖ Setup cancelled — run `lunora init` again whenever you're ready. 🌙\n");
|
|
2454
|
+
return { code: 130, files: [], target: "" };
|
|
2455
|
+
}
|
|
2456
|
+
throw error;
|
|
620
2457
|
}
|
|
2458
|
+
scaffoldCiPipeline(options, result, cwd);
|
|
621
2459
|
return result;
|
|
622
2460
|
};
|
|
623
|
-
const isTemplate = (value) => value === "astro" || value === "next" || value === "nuxt" || value === "
|
|
2461
|
+
const isTemplate = (value) => value === "analog" || value === "astro" || value === "next" || value === "nuxt" || value === "react-router" || value === "standalone" || value === "sveltekit" || value === "tanstack-start-react" || value === "tanstack-start-solid";
|
|
624
2462
|
const resolveCiProvider = (raw, logger) => {
|
|
625
2463
|
if (raw === void 0) {
|
|
626
2464
|
return void 0;
|
|
@@ -632,21 +2470,24 @@ const resolveCiProvider = (raw, logger) => {
|
|
|
632
2470
|
return void 0;
|
|
633
2471
|
};
|
|
634
2472
|
const execute = defineHandler(({ argument, cwd, logger, options }) => {
|
|
635
|
-
const
|
|
636
|
-
const template = isTemplate(templateRaw) ? templateRaw : "vite";
|
|
2473
|
+
const templateType = options.template !== void 0 && isTemplate(options.template) ? options.template : void 0;
|
|
637
2474
|
return runInitCommand({
|
|
2475
|
+
add: options.add,
|
|
638
2476
|
allowUnsafeSource: options.allowUnsafeSource === true,
|
|
639
2477
|
cwd,
|
|
640
2478
|
ci: resolveCiProvider(options.ci, logger),
|
|
2479
|
+
dryRun: options.dryRun === true,
|
|
641
2480
|
from: options.from,
|
|
642
2481
|
inPlace: options.here === true,
|
|
643
2482
|
interactive: options.interactive === true ? true : void 0,
|
|
644
2483
|
logger,
|
|
645
2484
|
name: argument[0],
|
|
2485
|
+
ref: options.ref,
|
|
646
2486
|
source: options.source,
|
|
647
|
-
templateType
|
|
2487
|
+
templateType,
|
|
2488
|
+
vite: options.vite,
|
|
648
2489
|
yes: options.yes === true
|
|
649
2490
|
});
|
|
650
2491
|
});
|
|
651
2492
|
|
|
652
|
-
export { execute, isTemplate, runInitCommand };
|
|
2493
|
+
export { execute, isTemplate, resolveTemplateSource, runInitCommand };
|