@cosmicdrift/kumiko-dev-server 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/package.json +8 -12
  2. package/src/__tests__/build-prod-bundle.integration.ts +1 -1
  3. package/src/__tests__/build-prod-bundle.test.ts +1 -1
  4. package/src/__tests__/cache-headers.test.ts +1 -1
  5. package/src/__tests__/classify-change.test.ts +1 -1
  6. package/src/__tests__/compose-features-wiring.integration.ts +10 -9
  7. package/src/__tests__/compose-features.test.ts +1 -1
  8. package/src/__tests__/config-seed-boot.integration.ts +5 -4
  9. package/src/__tests__/crash-tracker.test.ts +1 -1
  10. package/src/__tests__/create-kumiko-server.integration.ts +5 -5
  11. package/src/__tests__/discover-format.test.ts +32 -0
  12. package/src/__tests__/env-schema.integration.ts +1 -1
  13. package/src/__tests__/env-schema.test.ts +1 -1
  14. package/src/__tests__/few-shot-corpus.test.ts +1 -1
  15. package/src/__tests__/inject-schema.test.ts +1 -1
  16. package/src/__tests__/resolve-stylesheet.test.ts +11 -7
  17. package/src/__tests__/resolve-tailwind-cli.test.ts +1 -1
  18. package/src/__tests__/run-prod-app-spec.test.ts +1 -1
  19. package/src/__tests__/run-prod-app.integration.ts +6 -6
  20. package/src/__tests__/scaffold-app-feature.test.ts +1 -1
  21. package/src/__tests__/scaffold-app.test.ts +1 -1
  22. package/src/__tests__/scaffold-deploy.test.ts +1 -1
  23. package/src/__tests__/scaffold-feature.test.ts +1 -1
  24. package/src/__tests__/try-hono-first.test.ts +1 -1
  25. package/src/__tests__/walkthrough.integration.ts +1 -1
  26. package/src/codegen/__tests__/render-codegen.test.ts +50 -0
  27. package/src/codegen/__tests__/run-codegen.test.ts +1 -1
  28. package/src/codegen/__tests__/strict-mode-diagnostics.test.ts +1 -1
  29. package/src/codegen/__tests__/watch.test.ts +1 -1
  30. package/src/codegen/render.ts +7 -2
  31. package/src/codegen/run-codegen.ts +1 -1
  32. package/src/codegen/scan-events.ts +1 -21
  33. package/src/scaffold-app-feature.ts +2 -1
  34. package/src/{drizzle-tables-auth-mode.ts → schema-tables-auth-mode.ts} +1 -1
  35. package/templates/deploy/Dockerfile.template +15 -47
  36. package/CHANGELOG.md +0 -656
  37. package/src/drizzle-config.ts +0 -44
  38. /package/src/{drizzle-tables-minimal.ts → schema-tables-minimal.ts} +0 -0
@@ -41,6 +41,7 @@
41
41
 
42
42
  import { readdirSync, statSync } from "node:fs";
43
43
  import { join, relative, resolve, sep } from "node:path";
44
+ import { toKebab } from "@cosmicdrift/kumiko-framework/engine";
44
45
  import {
45
46
  type CallExpression,
46
47
  type ImportDeclaration,
@@ -51,27 +52,6 @@ import {
51
52
  SyntaxKind,
52
53
  } from "ts-morph";
53
54
 
54
- /**
55
- * Replicates `packages/framework/src/engine/qualified-name.ts:toKebab`.
56
- * Frame's r.defineEvent runs the feature-name + event-name through this
57
- * helper before joining them — `defineFeature("driverOrders")` writes
58
- * events under `driver-orders:event:...`. We MUST mirror the same
59
- * transform here, otherwise the augmentation key drifts from the
60
- * runtime event-type and strict-mode would catch a phantom mismatch.
61
- *
62
- * Inlined (instead of imported from framework) to keep the codegen
63
- * package boundary clean — codegen doesn't depend on the runtime
64
- * framework, only the framework-source-tree via paths-mapping at the
65
- * caller's compile.
66
- */
67
- function toKebab(input: string): string {
68
- return input
69
- .replace(/\./g, "-")
70
- .replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2")
71
- .replace(/([a-z0-9])([A-Z])/g, "$1-$2")
72
- .toLowerCase();
73
- }
74
-
75
55
  export type ScannedEvent = {
76
56
  /** Qualified event-name as it appears in the events table:
77
57
  * `<feature>:event:<inner>`. The KumikoEventTypeMap key. */
@@ -114,7 +114,8 @@ function mountInRunConfig(runConfigPath: string, name: string): boolean {
114
114
 
115
115
  // 1. Prepend import after the last existing import.
116
116
  const imports = sf.getImportDeclarations();
117
- const insertIndex = imports.length > 0 ? imports[imports.length - 1]!.getChildIndex() + 1 : 0;
117
+ const insertIndex =
118
+ imports.length > 0 ? (imports[imports.length - 1]?.getChildIndex() ?? 0) + 1 : 0;
118
119
  sf.insertImportDeclaration(insertIndex, {
119
120
  moduleSpecifier: `./features/${name}`,
120
121
  namedImports: [`${camel}Feature`],
@@ -12,7 +12,7 @@
12
12
  //
13
13
  // Bundle-Entity-Tables (configValuesTable, tenantTable, userTable,
14
14
  // userSessionTable, tenantMembershipsTable etc.) sind bewusst NICHT hier:
15
- // sie kommen über schema.generated.ts via buildDrizzleTable aus den
15
+ // sie kommen über schema.generated.ts via buildEntityTable aus den
16
16
  // r.entity()-Definitionen, das ist seit der entity.indexes-API die
17
17
  // Single-Source-of-Truth. Doppelte Re-Exports würden zwei pgTable-
18
18
  // Instances mit identischem Index-Namen erzeugen — drizzle-kit warnt.
@@ -13,66 +13,34 @@
13
13
  # Size: ~250 MB incl. drizzle-kit for the pre-deploy migrate step.
14
14
  # Build context: repository root (monorepo is used in the build stage).
15
15
 
16
- ARG BUN_VERSION=1.2.20
16
+ ARG BUN_VERSION=1.3.14
17
+ {{#hasPrivateGhPackages}}
18
+ # Private GH-Packages: der CI-Workflow injects GITHUB_TOKEN via --build-arg.
19
+ # Docker's multi-stage ARG scoping braucht die Re-declaration in jeder Stage
20
+ # die sie nutzt; das top-level ARG macht sie per `docker build` setzbar.
21
+ ARG GITHUB_TOKEN=
22
+ {{/hasPrivateGhPackages}}
17
23
  # Build identity — passed in by the CI workflow via --build-arg. Defaults
18
24
  # for local container builds.
19
25
  ARG BUILD_VERSION=dev
20
26
  ARG BUILD_TIME=unknown
21
- {{#hasPrivateGhPackages}}
22
- # Private @cosmicdriftgamestudio/* GH-Packages dep detected — yarn-4
23
- # reads the token via `npmAuthToken: "${GITHUB_TOKEN:-…}"` in .yarnrc.yml.
24
- # Without this build-arg, yarn install aborts with YN0041 anonymous-auth.
25
- ARG GITHUB_TOKEN=
26
- {{/hasPrivateGhPackages}}
27
27
 
28
28
  # ----- build: produces dist/ + dist-server/ ---------------------------------
29
- # Build base is node-alpine (not bun-alpine) because the repo uses yarn 4 as
30
- # its package manager — `link:./.kumiko` (@app/define codegen output) is
31
- # yarn-4's symlink protocol, which bun interprets differently. Node ships
32
- # corepack (yarn 4 via packageManager field); we pull bun via npm for
33
- # `bun run build`. Runtime stage stays pure bun.
34
- FROM node:20-alpine AS build
29
+ FROM oven/bun:${BUN_VERSION}-alpine AS build
30
+ WORKDIR /app
35
31
  {{#hasPrivateGhPackages}}
36
- # Multi-stage ARG inheritance: globals declared before FROM need an
37
- # `ARG <name>` line in every stage that uses them. Without this,
38
- # ${GITHUB_TOKEN} below resolves to empty and yarn install hits YN0041.
32
+ # GITHUB_TOKEN für @cosmicdriftgamestudio/*-Scope beim bun install.
39
33
  ARG GITHUB_TOKEN
34
+ ENV GITHUB_TOKEN=${GITHUB_TOKEN}
35
+ RUN bun config set --scope @cosmicdriftgamestudio token "${GITHUB_TOKEN}"
40
36
  {{/hasPrivateGhPackages}}
41
- WORKDIR /app
42
-
43
- RUN corepack enable && npm install -g bun@${BUN_VERSION}
44
37
 
45
38
  # Standalone-repo layout: @cosmicdrift/* pulled from NPM, no workspace:*
46
- # refs. Manifests first for Docker layer cache (yarn install only
39
+ # refs. Manifests first for Docker layer cache (bun install only
47
40
  # invalidates on dep change).
48
- COPY package.json yarn.lock .yarnrc.yml ./
41
+ COPY package.json bun.lock ./
49
42
 
50
- # YARN_ENABLE_INLINE_BUILDS=true: postinstall stdout/stderr inline in the
51
- # install output. Without this, yarn 4 hides logs in /tmp/xfs-*/build.log
52
- # (invisible in the Docker layer output) and the CI operator guesses why
53
- # the install failed.
54
- #
55
- # `link:./.kumiko` (@app/define in package.json): yarn 4 creates a
56
- # dangling symlink; install does NOT fail. `bun run build` below calls
57
- # `runCodegen` from @cosmicdrift/kumiko-dev-server (see
58
- # bin/kumiko-build.ts), which writes .kumiko/define.ts and turns the
59
- # symlink real before the bundle is built.
60
- ENV YARN_ENABLE_INLINE_BUILDS=true
61
- # Skip postinstall scripts for ALL deps in the build stage. Reason:
62
- # `bun build` bundles JS source only — no native bindings needed at bundle-
63
- # time. msgpackr-extract is the most common offender (ARM/CI native-build
64
- # failures), but the rule applies broadly: any native dep loaded at runtime
65
- # gets re-installed via `bun install --production` in the runtime stage,
66
- # which uses bun's own postinstall handling. Apps that needed per-package
67
- # opt-outs via `dependenciesMeta.<pkg>.built=false` in package.json (e.g.
68
- # studio, enterprise) can remove those entries after adopting this template.
69
- ENV YARN_ENABLE_SCRIPTS=false
70
- {{#hasPrivateGhPackages}}
71
- # Re-export GITHUB_TOKEN as env so yarn-4's `${GITHUB_TOKEN:-…}` expansion
72
- # in .yarnrc.yml finds it during the install step.
73
- ENV GITHUB_TOKEN=${GITHUB_TOKEN}
74
- {{/hasPrivateGhPackages}}
75
- RUN yarn install --immutable
43
+ RUN bun install --frozen-lockfile
76
44
 
77
45
  COPY . .
78
46
  RUN bun run build