@cosmicdrift/kumiko-dev-server 0.20.0 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/bin/kumiko-dev.ts +2 -2
- package/package.json +4 -4
- package/src/__tests__/build-prod-bundle.test.ts +1 -1
- package/src/__tests__/walkthrough.integration.test.ts +2 -2
- package/src/build-prod-bundle.ts +2 -2
- package/src/build-server-bundle.ts +0 -1
- package/src/codegen/render.ts +2 -2
- package/src/codegen/run-codegen.ts +1 -1
- package/src/create-kumiko-server.ts +1 -1
- package/src/run-dev-app.ts +1 -1
- package/src/run-prod-app.ts +1 -1
- package/src/scaffold-app-feature.ts +1 -1
- package/src/scaffold-app.ts +3 -3
- package/src/scaffold-feature.ts +6 -6
package/LICENSE
CHANGED
|
@@ -21,7 +21,7 @@ managed offering of the Licensed Work.
|
|
|
21
21
|
This restriction does not apply to the Licensor, any entity controlled by,
|
|
22
22
|
controlling, or under common control with the Licensor ("Affiliates"), or
|
|
23
23
|
contractors acting on their behalf. The Licensor remains free to use the
|
|
24
|
-
Licensed Work for any purpose, including for the operation of kumiko.
|
|
24
|
+
Licensed Work for any purpose, including for the operation of kumiko.rocks.
|
|
25
25
|
|
|
26
26
|
Change Date: 2030-05-05
|
|
27
27
|
Change License: Apache License, Version 2.0
|
package/bin/kumiko-dev.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// Crash-Loop-Schutz via createCrashTracker. Verhindert Endlos-Loop
|
|
11
11
|
// bei syntaktisch totem bin/main.ts und gibt dem User trotzdem
|
|
12
12
|
// "Live-Edit"-Feeling: ein Code-Fehler in einem Feature killt nicht
|
|
13
|
-
// die ganze
|
|
13
|
+
// die ganze bun-dev-Session.
|
|
14
14
|
// - Signal-killed (SIGINT/SIGTERM): wir folgen dem Caller, exit 0.
|
|
15
15
|
//
|
|
16
16
|
// Nutzung: `kumiko-dev src/app/server.ts` in package.json:
|
|
@@ -74,7 +74,7 @@ const spawnServer = (): void => {
|
|
|
74
74
|
if (!allowed) {
|
|
75
75
|
process.stderr.write(
|
|
76
76
|
`[kumiko-dev] ${MAX_CRASHES} Crashes in ${CRASH_WINDOW_MS / 1000}s — aufgeben (exit ${code}). ` +
|
|
77
|
-
"Fehler oben fixen und
|
|
77
|
+
"Fehler oben fixen und bun dev erneut starten.\n",
|
|
78
78
|
);
|
|
79
79
|
process.exit(code);
|
|
80
80
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-dev-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"description": "Development server bootstrap for Kumiko apps. Bundles the client, mints dev-JWTs, injects the resolved AppSchema, and seeds an admin. Not for production.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/CosmicDriftGameStudio/kumiko-framework/issues"
|
|
14
14
|
},
|
|
15
|
-
"homepage": "https://kumiko.
|
|
15
|
+
"homepage": "https://kumiko.rocks",
|
|
16
16
|
"type": "module",
|
|
17
17
|
"kumiko": {
|
|
18
18
|
"runtime": "dev"
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"kumiko-schema-check": "./bin/kumiko-schema-check.ts"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
50
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
49
|
+
"@cosmicdrift/kumiko-bundled-features": "0.21.0",
|
|
50
|
+
"@cosmicdrift/kumiko-framework": "0.21.0",
|
|
51
51
|
"ts-morph": "^28.0.0"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Bun.build und Tailwind-CLI brauchen einen Bun-Runtime, deshalb
|
|
4
4
|
// werden die hier nicht aufgerufen — nur Discovery + HTML-Injection
|
|
5
5
|
// die unter Node funktionieren. End-to-End-Tests (mit echtem Bun.build)
|
|
6
|
-
// laufen im CI als `
|
|
6
|
+
// laufen im CI als `bun run build` auf der Showcase-App; das ist der
|
|
7
7
|
// ehrlichere Smoke-Test.
|
|
8
8
|
|
|
9
9
|
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// DX-3.1 — walkthrough-snapshot-test. Reproduces the 3-command path from
|
|
2
|
-
// docs.kumiko.
|
|
2
|
+
// docs.kumiko.rocks/en/walkthrough/ in-process and asserts what the walkthrough
|
|
3
3
|
// claims. Catches drift in scaffoldApp + scaffoldAppFeature against the
|
|
4
|
-
// docs without an actual `bunx … &&
|
|
4
|
+
// docs without an actual `bunx … && bun install && bun run boot` CI run.
|
|
5
5
|
//
|
|
6
6
|
// What this test pins:
|
|
7
7
|
// - scaffoldApp produces the 6 files the walkthrough lists
|
package/src/build-prod-bundle.ts
CHANGED
|
@@ -332,7 +332,7 @@ export function discoverHtmlTemplate(cwd: string): string | undefined {
|
|
|
332
332
|
async function runTailwindOnce(entry: string, cwd: string): Promise<string> {
|
|
333
333
|
if (!hasBun) {
|
|
334
334
|
throw new Error(
|
|
335
|
-
"[kumiko build] Tailwind one-shot requires Bun (Bun.spawn) — run via `bun run …` or `
|
|
335
|
+
"[kumiko build] Tailwind one-shot requires Bun (Bun.spawn) — run via `bun run …` or `bun kumiko build`.",
|
|
336
336
|
);
|
|
337
337
|
}
|
|
338
338
|
const bunResolver = (globalThis as { Bun: { resolveSync: (id: string, from: string) => string } })
|
|
@@ -373,7 +373,7 @@ async function buildClientBundles(
|
|
|
373
373
|
outDir: string,
|
|
374
374
|
): Promise<Record<string, string>> {
|
|
375
375
|
if (!hasBun) {
|
|
376
|
-
throw new Error("[kumiko build] requires Bun — run via `bun run …` or `
|
|
376
|
+
throw new Error("[kumiko build] requires Bun — run via `bun run …` or `bun kumiko build`.");
|
|
377
377
|
}
|
|
378
378
|
const built = await Bun.build({
|
|
379
379
|
entrypoints: entries.map((e) => e.sourceFile),
|
package/src/codegen/render.ts
CHANGED
|
@@ -29,7 +29,7 @@ import { rewriteImportPath } from "./scan-events";
|
|
|
29
29
|
const HEADER = [
|
|
30
30
|
"// =====================================================================",
|
|
31
31
|
"// AUTO-GENERATED — DO NOT EDIT BY HAND",
|
|
32
|
-
"// Run `
|
|
32
|
+
"// Run `bun kumiko codegen` to regenerate (or rely on the dev-server's",
|
|
33
33
|
"// file-watcher, which calls it on every r.defineEvent change).",
|
|
34
34
|
"// =====================================================================",
|
|
35
35
|
].join("\n");
|
|
@@ -129,7 +129,7 @@ export function renderInlineSchemasFile(
|
|
|
129
129
|
"// Schema extracts purely for type inference: this file is referenced",
|
|
130
130
|
"// from types.generated.d.ts via `import type`. ts-strip elides it at",
|
|
131
131
|
"// build time, so there is NO runtime duplication of the inline schemas",
|
|
132
|
-
"// in feature files. When an event schema changes: re-run `
|
|
132
|
+
"// in feature files. When an event schema changes: re-run `bun kumiko",
|
|
133
133
|
"// codegen` — otherwise the z.infer type drifts from the runtime schema.",
|
|
134
134
|
"",
|
|
135
135
|
`import { z } from "zod";`,
|
|
@@ -221,7 +221,7 @@ const AUTH_COOKIE = "kumiko_auth";
|
|
|
221
221
|
// die erste bootId; wenn nach einem Reconnect (Server-Restart!) eine
|
|
222
222
|
// ANDERE bootId kommt, refresh — sonst bleibt der Browser ewig auf
|
|
223
223
|
// dem alten Bundle hängen wenn der Watcher classifyChange="restart"
|
|
224
|
-
// gewählt hat oder der User Ctrl-C/
|
|
224
|
+
// gewählt hat oder der User Ctrl-C/bun dev gemacht hat.
|
|
225
225
|
const RELOAD_SNIPPET = `
|
|
226
226
|
<script>
|
|
227
227
|
(() => {
|
package/src/run-dev-app.ts
CHANGED
|
@@ -161,7 +161,7 @@ export async function runDevApp(options: RunDevAppOptions): Promise<KumikoServer
|
|
|
161
161
|
// Idempotent (writeIfChanged) — der TS-Sprachserver kriegt nur einen
|
|
162
162
|
// Reload-Tick wenn sich tatsächlich was geändert hat.
|
|
163
163
|
//
|
|
164
|
-
// App-Root ist process.cwd() (
|
|
164
|
+
// App-Root ist process.cwd() (bun-dev läuft vom App-Workspace). Der
|
|
165
165
|
// Watcher läuft solange der Dev-Server lebt; close() bei Shutdown
|
|
166
166
|
// wird über das createKumikoServer-Handle implizit erledigt (Bun's
|
|
167
167
|
// process-exit räumt fs.watch-handles auf).
|
package/src/run-prod-app.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// - Hard Schema-Drift-Gate: prüft drizzle/migrations/_journal vs.
|
|
7
7
|
// __drizzle_migrations + tableExists für jede erwartete Tabelle.
|
|
8
8
|
// KEIN Auto-CREATE TABLE im Boot — Migration ist ein CI-Step
|
|
9
|
-
// (`
|
|
9
|
+
// (`bun kumiko migrate apply`), Boot validiert nur. Verhindert
|
|
10
10
|
// Race-Conditions bei Multi-Replica-Deploys + macht Schema-Stand
|
|
11
11
|
// reviewbar in der Pull-Request.
|
|
12
12
|
// - Idempotente Seeds: laufen nur wenn DB leer (über `isDbEmpty`-Probe
|
|
@@ -72,7 +72,7 @@ function renderFeature(name: string): string {
|
|
|
72
72
|
const camel = kebabToCamel(name);
|
|
73
73
|
return `// ${name} feature — scaffolded by \`kumiko add feature\`. Edit freely.
|
|
74
74
|
//
|
|
75
|
-
// Doc-Pointer: https://docs.kumiko.
|
|
75
|
+
// Doc-Pointer: https://docs.kumiko.rocks/en/patterns/ for the \`r.*\` API
|
|
76
76
|
// (r.entity, r.writeHandler, r.queryHandler, hooks, …).
|
|
77
77
|
|
|
78
78
|
import { defineFeature } from "@cosmicdrift/kumiko-framework/engine";
|
package/src/scaffold-app.ts
CHANGED
|
@@ -249,7 +249,7 @@ function renderMain(appName: string): string {
|
|
|
249
249
|
"// Production-bootstrap. KUMIKO_DRY_RUN_ENV=boot exits after",
|
|
250
250
|
"// composeFeatures + validateBoot + createRegistry without DB/Redis-connect",
|
|
251
251
|
"// (siehe @cosmicdrift/kumiko-dev-server runProdApp). Echter Dev-Boot",
|
|
252
|
-
"// passiert via `
|
|
252
|
+
"// passiert via `bun kumiko dev` (in-repo dev-tool) mit Docker-stack — DX-1.0 deckt nur",
|
|
253
253
|
"// den boot-mode-Pfad ab; `kumiko dev` kommt in einer späteren DX-Phase.",
|
|
254
254
|
"",
|
|
255
255
|
"",
|
|
@@ -282,7 +282,7 @@ mounted (foundation set). Add features with \`bunx @cosmicdrift/kumiko-cli add f
|
|
|
282
282
|
## First boot
|
|
283
283
|
|
|
284
284
|
\`\`\`sh
|
|
285
|
-
|
|
285
|
+
bun install
|
|
286
286
|
cp .env.example .env
|
|
287
287
|
# edit .env — set JWT_SECRET + KUMIKO_SECRETS_MASTER_KEY_V1
|
|
288
288
|
bun run boot
|
|
@@ -302,7 +302,7 @@ bunx @cosmicdrift/kumiko-cli add feature my-domain
|
|
|
302
302
|
- \`src/run-config.ts\` — single source of truth: which features your app mounts.
|
|
303
303
|
- \`bin/main.ts\` — production-bootstrap. Reads env, mounts features, starts server.
|
|
304
304
|
|
|
305
|
-
For full docs see https://docs.kumiko.
|
|
305
|
+
For full docs see https://docs.kumiko.rocks.
|
|
306
306
|
`;
|
|
307
307
|
}
|
|
308
308
|
|
package/src/scaffold-feature.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// scaffoldFeature — generate a fresh feature workspace from a name.
|
|
2
|
-
// Used by `
|
|
2
|
+
// Used by `bun kumiko create <name>` and (later) by the Designer when
|
|
3
3
|
// a tenant scaffolds a new feature inside their repo. Wraps the
|
|
4
4
|
// canonical-form renderer (feature-ast/render.ts) so every freshly
|
|
5
5
|
// scaffolded feature is born in canonical Object-Form with the
|
|
6
6
|
// schema-version header set.
|
|
7
7
|
//
|
|
8
8
|
// The generated workspace is intentionally minimal: a single entity
|
|
9
|
-
// pattern as a starter, so the user has something to point a "
|
|
9
|
+
// pattern as a starter, so the user has something to point a "bun
|
|
10
10
|
// kumiko dev" at and immediately see something on screen. Adding more
|
|
11
11
|
// patterns is the user's job (or the Designer's / AI's, on top of this
|
|
12
12
|
// scaffolding).
|
|
@@ -48,7 +48,7 @@ export type ScaffoldFeatureResult = {
|
|
|
48
48
|
/**
|
|
49
49
|
* Generate a starter feature workspace at `destination`. Throws when
|
|
50
50
|
* the destination already exists — refuses to overwrite. The caller is
|
|
51
|
-
* expected to run `
|
|
51
|
+
* expected to run `bun install` afterwards to wire the workspace.
|
|
52
52
|
*/
|
|
53
53
|
export function scaffoldFeature(options: ScaffoldFeatureOptions): ScaffoldFeatureResult {
|
|
54
54
|
const featureName = validateFeatureName(options.name);
|
|
@@ -156,7 +156,7 @@ function renderPackageJson(packageName: string): string {
|
|
|
156
156
|
return `${JSON.stringify(
|
|
157
157
|
{
|
|
158
158
|
name: packageName,
|
|
159
|
-
description: "Kumiko sample feature — scaffolded by `
|
|
159
|
+
description: "Kumiko sample feature — scaffolded by `bun kumiko create`",
|
|
160
160
|
private: true,
|
|
161
161
|
dependencies: {
|
|
162
162
|
"@cosmicdrift/kumiko-framework": "workspace:*",
|
|
@@ -170,7 +170,7 @@ function renderPackageJson(packageName: string): string {
|
|
|
170
170
|
/**
|
|
171
171
|
* Standard tsconfig matching the rest of the sample workspaces:
|
|
172
172
|
* strict, ESNext, bundler-resolution, no-emit. Without this file
|
|
173
|
-
* `
|
|
173
|
+
* `bun install + tsc` immediately complains about missing config —
|
|
174
174
|
* scaffolded features should compile cleanly out of the box.
|
|
175
175
|
*/
|
|
176
176
|
function renderTsconfig(): string {
|
|
@@ -210,7 +210,7 @@ const SYNTHETIC_LOC: SourceLocation = {
|
|
|
210
210
|
|
|
211
211
|
function starterPatterns(): readonly FeaturePattern[] {
|
|
212
212
|
// One entity, one field. Smallest interesting output: parses, renders,
|
|
213
|
-
// can be `
|
|
213
|
+
// can be `bun kumiko dev`'d, and gives the user something to extend.
|
|
214
214
|
return [
|
|
215
215
|
{
|
|
216
216
|
kind: "entity",
|