@cosmicdrift/kumiko-dev-server 0.90.0 → 0.90.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-dev-server",
|
|
3
|
-
"version": "0.90.
|
|
3
|
+
"version": "0.90.3",
|
|
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>",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"kumiko-schema-check": "./bin/kumiko-schema-check.ts"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@cosmicdrift/kumiko-bundled-features": "0.90.
|
|
54
|
-
"@cosmicdrift/kumiko-framework": "0.90.
|
|
53
|
+
"@cosmicdrift/kumiko-bundled-features": "0.90.3",
|
|
54
|
+
"@cosmicdrift/kumiko-framework": "0.90.3",
|
|
55
55
|
"ts-morph": "^28.0.0"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
@@ -29,6 +29,7 @@ describe("scaffoldApp", () => {
|
|
|
29
29
|
"bin/dev.ts",
|
|
30
30
|
"src/client.tsx",
|
|
31
31
|
".env.example",
|
|
32
|
+
"docker-compose.yml",
|
|
32
33
|
"README.md",
|
|
33
34
|
]);
|
|
34
35
|
for (const f of result.files) {
|
|
@@ -104,6 +105,27 @@ describe("scaffoldApp", () => {
|
|
|
104
105
|
expect(env).toContain("DATABASE_URL=");
|
|
105
106
|
});
|
|
106
107
|
|
|
108
|
+
test("docker-compose.yml ports + credentials match the .env.example *_URL defaults", () => {
|
|
109
|
+
const dest = join(tmp, "my-shop");
|
|
110
|
+
scaffoldApp({ name: "my-shop", destination: dest });
|
|
111
|
+
|
|
112
|
+
const compose = readFileSync(join(dest, "docker-compose.yml"), "utf-8");
|
|
113
|
+
const env = readFileSync(join(dest, ".env.example"), "utf-8");
|
|
114
|
+
// README tells the user to run `docker compose up -d`; that only works if
|
|
115
|
+
// the compose service matches what the generated .env points its *_URLs at.
|
|
116
|
+
expect(env).toContain("127.0.0.1:5432");
|
|
117
|
+
expect(env).toContain("127.0.0.1:6379");
|
|
118
|
+
// Ports bind to loopback only — weak dev creds / auth-less Redis must not
|
|
119
|
+
// be reachable from the LAN (security review of the scaffold).
|
|
120
|
+
expect(compose).toContain('"127.0.0.1:5432:5432"');
|
|
121
|
+
expect(compose).toContain('"127.0.0.1:6379:6379"');
|
|
122
|
+
expect(compose).not.toContain('"5432:5432"');
|
|
123
|
+
expect(compose).not.toContain('"6379:6379"');
|
|
124
|
+
expect(compose).toContain("POSTGRES_PASSWORD: postgres");
|
|
125
|
+
expect(compose).toContain("image: postgres:");
|
|
126
|
+
expect(compose).toContain("image: redis:");
|
|
127
|
+
});
|
|
128
|
+
|
|
107
129
|
test("README lists the mounted features dynamically", () => {
|
|
108
130
|
const dest = join(tmp, "my-shop");
|
|
109
131
|
scaffoldApp({
|
package/src/scaffold-app.ts
CHANGED
|
@@ -89,6 +89,9 @@ export function scaffoldApp(options: ScaffoldAppOptions): ScaffoldAppResult {
|
|
|
89
89
|
write(join(destination, ".env.example"), renderEnvExample(options.name));
|
|
90
90
|
files.push(".env.example");
|
|
91
91
|
|
|
92
|
+
write(join(destination, "docker-compose.yml"), renderDockerCompose());
|
|
93
|
+
files.push("docker-compose.yml");
|
|
94
|
+
|
|
92
95
|
write(join(destination, "README.md"), renderReadme(options.name, options.features));
|
|
93
96
|
files.push("README.md");
|
|
94
97
|
|
|
@@ -455,6 +458,35 @@ KUMIKO_DEV_DB_NAME=${devDb}
|
|
|
455
458
|
`;
|
|
456
459
|
}
|
|
457
460
|
|
|
461
|
+
// Local Postgres + Redis for `bun dev`. Ports + credentials match the *_URL
|
|
462
|
+
// defaults in renderEnvExample, so `docker compose up -d` (referenced by the
|
|
463
|
+
// README) just works with the generated .env. Named pg volume so dev data
|
|
464
|
+
// survives `docker compose down` (pairs with KUMIKO_DEV_DB_NAME persistence).
|
|
465
|
+
// Ports bind to 127.0.0.1 only: the dev DB (postgres/postgres) and auth-less
|
|
466
|
+
// Redis must not be reachable from the LAN on a machine without a firewall.
|
|
467
|
+
function renderDockerCompose(): string {
|
|
468
|
+
return `# Local Postgres + Redis for \`bun dev\`. Matches the *_URL defaults in .env.example.
|
|
469
|
+
# Start: docker compose up -d · Stop: docker compose down · Reset: docker compose down -v
|
|
470
|
+
# Ports bind to 127.0.0.1 only — weak dev credentials must not be exposed on the LAN.
|
|
471
|
+
services:
|
|
472
|
+
postgres:
|
|
473
|
+
image: postgres:18
|
|
474
|
+
environment:
|
|
475
|
+
POSTGRES_USER: postgres
|
|
476
|
+
POSTGRES_PASSWORD: postgres
|
|
477
|
+
ports:
|
|
478
|
+
- "127.0.0.1:5432:5432"
|
|
479
|
+
volumes:
|
|
480
|
+
- kumiko-pg:/var/lib/postgresql/data
|
|
481
|
+
redis:
|
|
482
|
+
image: redis:7
|
|
483
|
+
ports:
|
|
484
|
+
- "127.0.0.1:6379:6379"
|
|
485
|
+
volumes:
|
|
486
|
+
kumiko-pg:
|
|
487
|
+
`;
|
|
488
|
+
}
|
|
489
|
+
|
|
458
490
|
function renderReadme(
|
|
459
491
|
appName: string,
|
|
460
492
|
features: ReadonlyArray<ScaffoldFeatureEntry> | undefined,
|
|
@@ -503,6 +535,7 @@ Runs \`KUMIKO_DRY_RUN_ENV=boot bun bin/main.ts\` — validates feature compositi
|
|
|
503
535
|
- \`src/run-config.ts\` — single source of truth: which features your app mounts.
|
|
504
536
|
- \`bin/dev.ts\` — dev-server entry (\`bun dev\`).
|
|
505
537
|
- \`bin/main.ts\` — production-bootstrap (\`bun run boot\` smoke + production deploy).
|
|
538
|
+
- \`docker-compose.yml\` — local Postgres + Redis for \`bun dev\`.
|
|
506
539
|
|
|
507
540
|
For full docs see https://docs.kumiko.rocks.
|
|
508
541
|
`;
|