kavoru 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -11
- package/package.json +1 -1
- package/src/args.ts +4 -4
- package/src/cli.ts +1 -1
- package/src/features.ts +13 -6
package/README.md
CHANGED
|
@@ -7,18 +7,23 @@ Scaffold a new [Kavoru](https://github.com/mertthesamael/Kavoru) backend — Ely
|
|
|
7
7
|
After publishing to npm:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
bunx kavoru my-api
|
|
10
|
+
bunx kavoru@latest my-api
|
|
11
11
|
cd my-api
|
|
12
12
|
bun run dev
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Always use `@latest` so you get the newest published CLI. Equivalent to `bunx --bun kavoru@latest`.
|
|
16
16
|
|
|
17
|
-
**Stale
|
|
17
|
+
**Stale CLI after a new publish?** Bun caches `bunx` installs under `%TEMP%\bunx-*-kavoru@latest` and does not auto-refresh. Clear the cache, then run `@latest` again:
|
|
18
18
|
|
|
19
19
|
```powershell
|
|
20
20
|
Remove-Item -Recurse -Force "$env:TEMP\bunx-*-kavoru*"
|
|
21
|
-
bunx kavoru@
|
|
21
|
+
bunx kavoru@latest my-api
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
rm -rf "${TMPDIR:-/tmp}"/bunx-*-kavoru*
|
|
26
|
+
bunx kavoru@latest my-api
|
|
22
27
|
```
|
|
23
28
|
|
|
24
29
|
### Options
|
|
@@ -57,22 +62,22 @@ Interactive mode (TTY) shows a checkbox menu (↑↓ move, Space toggle, Enter c
|
|
|
57
62
|
|
|
58
63
|
```bash
|
|
59
64
|
# Interactive (prompts for project name + feature toggles)
|
|
60
|
-
bunx kavoru
|
|
65
|
+
bunx kavoru@latest
|
|
61
66
|
|
|
62
67
|
# Current directory
|
|
63
|
-
bunx kavoru .
|
|
68
|
+
bunx kavoru@latest .
|
|
64
69
|
|
|
65
70
|
# Minimal API skeleton
|
|
66
|
-
bunx kavoru my-api --minimal
|
|
71
|
+
bunx kavoru@latest my-api --minimal
|
|
67
72
|
|
|
68
73
|
# Pick specific features
|
|
69
|
-
bunx kavoru my-api --features auth,prisma,otel,sentry
|
|
74
|
+
bunx kavoru@latest my-api --features auth,prisma,otel,sentry
|
|
70
75
|
|
|
71
76
|
# Full stack minus Kafka and Docker
|
|
72
|
-
bunx kavoru my-api --no-features kafka,docker
|
|
77
|
+
bunx kavoru@latest my-api --no-features kafka,docker
|
|
73
78
|
|
|
74
79
|
# Custom template fork (local dev)
|
|
75
|
-
bunx kavoru demo --repo your-user/Kavoru --no-install
|
|
80
|
+
bunx kavoru@latest demo --repo your-user/Kavoru --no-install
|
|
76
81
|
```
|
|
77
82
|
|
|
78
83
|
## Development
|
|
@@ -86,7 +91,7 @@ bun test
|
|
|
86
91
|
bun run src/index.ts my-test-app
|
|
87
92
|
# or
|
|
88
93
|
bun link
|
|
89
|
-
bunx kavoru my-test-app
|
|
94
|
+
bunx kavoru@latest my-test-app
|
|
90
95
|
```
|
|
91
96
|
|
|
92
97
|
## License
|
package/package.json
CHANGED
package/src/args.ts
CHANGED
|
@@ -36,10 +36,10 @@ Features:
|
|
|
36
36
|
auth, prisma, otel, sentry, kafka, websocket, resend, cron, docker
|
|
37
37
|
|
|
38
38
|
Examples:
|
|
39
|
-
bunx kavoru my-api
|
|
40
|
-
bunx kavoru my-api --minimal
|
|
41
|
-
bunx kavoru my-api --features auth,prisma,otel
|
|
42
|
-
bunx kavoru my-api --no-features kafka,docker,resend
|
|
39
|
+
bunx kavoru@latest my-api
|
|
40
|
+
bunx kavoru@latest my-api --minimal
|
|
41
|
+
bunx kavoru@latest my-api --features auth,prisma,otel
|
|
42
|
+
bunx kavoru@latest my-api --no-features kafka,docker,resend
|
|
43
43
|
`;
|
|
44
44
|
|
|
45
45
|
export function parseArgs(argv: string[]): CliOptions {
|
package/src/cli.ts
CHANGED
|
@@ -97,7 +97,7 @@ export async function runCli(options: CliOptions): Promise<void> {
|
|
|
97
97
|
if (!targetArg) {
|
|
98
98
|
const interactive = process.stdin.isTTY && process.stdout.isTTY;
|
|
99
99
|
if (!interactive) {
|
|
100
|
-
throw new Error("Missing project directory. Usage: bunx kavoru <directory>");
|
|
100
|
+
throw new Error("Missing project directory. Usage: bunx kavoru@latest <directory>");
|
|
101
101
|
}
|
|
102
102
|
targetArg = await promptProjectName();
|
|
103
103
|
}
|
package/src/features.ts
CHANGED
|
@@ -517,15 +517,25 @@ async function patchDockerfile(projectDir: string, selection: FeatureSelection)
|
|
|
517
517
|
await writeText(projectDir, relativePath, content);
|
|
518
518
|
}
|
|
519
519
|
|
|
520
|
+
function buildAppEnvironment(selection: FeatureSelection): string {
|
|
521
|
+
const lines = [" NODE_ENV: production"];
|
|
522
|
+
if (selection.kafka) {
|
|
523
|
+
lines.push(" KAFKA_BROKERS: kafka:9092");
|
|
524
|
+
}
|
|
525
|
+
if (selection.otel) {
|
|
526
|
+
lines.push(" OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318/v1/traces");
|
|
527
|
+
}
|
|
528
|
+
return ` environment:\n${lines.join("\n")}\n`;
|
|
529
|
+
}
|
|
530
|
+
|
|
520
531
|
function generateDockerCompose(selection: FeatureSelection): string {
|
|
521
532
|
const appDependsOn = selection.kafka
|
|
522
533
|
? ` depends_on:
|
|
523
534
|
kafka:
|
|
524
535
|
condition: service_started
|
|
525
|
-
environment:
|
|
526
|
-
KAFKA_BROKERS: kafka:9092
|
|
527
536
|
`
|
|
528
537
|
: "";
|
|
538
|
+
const appEnvironment = buildAppEnvironment(selection);
|
|
529
539
|
|
|
530
540
|
const kafkaService = selection.kafka
|
|
531
541
|
? `
|
|
@@ -590,7 +600,7 @@ function generateDockerCompose(selection: FeatureSelection): string {
|
|
|
590
600
|
restart: unless-stopped
|
|
591
601
|
env_file:
|
|
592
602
|
- .env
|
|
593
|
-
${appDependsOn} healthcheck:
|
|
603
|
+
${appDependsOn}${appEnvironment} healthcheck:
|
|
594
604
|
test: ["CMD", "curl", "-f", "http://localhost:\${PORT}/healthz"]
|
|
595
605
|
interval: 600s
|
|
596
606
|
timeout: 300s
|
|
@@ -599,10 +609,7 @@ ${appDependsOn} healthcheck:
|
|
|
599
609
|
${kafkaService}${jaegerService}
|
|
600
610
|
networks:
|
|
601
611
|
app_network:
|
|
602
|
-
name: app_network
|
|
603
612
|
driver: bridge
|
|
604
|
-
|
|
605
|
-
version: "3.8"
|
|
606
613
|
`;
|
|
607
614
|
}
|
|
608
615
|
|