kavoru 0.8.10 → 0.8.12
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 +1 -1
- package/package.json +1 -1
- package/src/cli.ts +11 -0
- package/src/features.ts +7 -1
- package/src/module-cli.ts +1 -1
- package/src/template.ts +11 -0
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ During setup you can pick which integrations to scaffold. Core is always include
|
|
|
55
55
|
| `resend` | Resend email |
|
|
56
56
|
| `cron` | Cron jobs |
|
|
57
57
|
| `docker` | Dockerfile + Compose |
|
|
58
|
-
| `cli` | Project CLI (`kavoru module`, bin,
|
|
58
|
+
| `cli` | Project CLI (`kavoru module`, bin, root shims) |
|
|
59
59
|
|
|
60
60
|
Interactive mode (TTY) shows a checkbox menu (↑↓ move, Space toggle, Enter confirm). Non-interactive runs use the full stack unless you pass flags.
|
|
61
61
|
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
customizeProject,
|
|
22
22
|
fetchTemplate,
|
|
23
23
|
installDependencies,
|
|
24
|
+
linkProjectCli,
|
|
24
25
|
removeGitMetadata,
|
|
25
26
|
resolveTemplateSource,
|
|
26
27
|
} from "./template";
|
|
@@ -136,6 +137,9 @@ export async function runCli(options: CliOptions): Promise<void> {
|
|
|
136
137
|
|
|
137
138
|
if (options.install) {
|
|
138
139
|
await installDependencies(targetDir);
|
|
140
|
+
if (featureSelection.cli) {
|
|
141
|
+
await linkProjectCli(targetDir);
|
|
142
|
+
}
|
|
139
143
|
}
|
|
140
144
|
} finally {
|
|
141
145
|
await rm(tempDir, { recursive: true, force: true }).catch(() => undefined);
|
|
@@ -150,6 +154,13 @@ export async function runCli(options: CliOptions): Promise<void> {
|
|
|
150
154
|
if (!options.install) {
|
|
151
155
|
console.log(" bun install");
|
|
152
156
|
}
|
|
157
|
+
if (featureSelection.cli) {
|
|
158
|
+
if (!options.install) {
|
|
159
|
+
console.log(" bun run link-cli # optional: put kavoru on PATH");
|
|
160
|
+
}
|
|
161
|
+
console.log(" kavoru module <name> # generate modules");
|
|
162
|
+
}
|
|
163
|
+
console.log(" bunx kavoru@latest <dir> # scaffold another project");
|
|
153
164
|
console.log(" bun run dev");
|
|
154
165
|
console.log();
|
|
155
166
|
console.log(" API: http://localhost:3131");
|
package/src/features.ts
CHANGED
|
@@ -122,10 +122,14 @@ const FEATURE_PATHS: Record<FeatureId, string[]> = {
|
|
|
122
122
|
docker: ["docker-compose.yaml", "docker"],
|
|
123
123
|
cli: [
|
|
124
124
|
"bin/kavoru.js",
|
|
125
|
+
"kavoru",
|
|
126
|
+
"kavoru.cmd",
|
|
125
127
|
"scripts/kavoru-cli.ts",
|
|
126
128
|
"scripts/generate-module.ts",
|
|
129
|
+
"scripts/link-cli.ts",
|
|
127
130
|
"__tests__/generate-module.test.ts",
|
|
128
131
|
"__tests__/kavoru-cli.test.ts",
|
|
132
|
+
"__tests__/link-cli.test.ts",
|
|
129
133
|
],
|
|
130
134
|
};
|
|
131
135
|
|
|
@@ -155,7 +159,7 @@ const FEATURE_SCRIPTS: Partial<Record<FeatureId, string[]>> = {
|
|
|
155
159
|
otel: ["otel:view", "otel:tui"],
|
|
156
160
|
sentry: ["sentry:spotlight"],
|
|
157
161
|
postgres: ["seed"],
|
|
158
|
-
cli: ["
|
|
162
|
+
cli: ["link-cli"],
|
|
159
163
|
};
|
|
160
164
|
|
|
161
165
|
function resolveFeatureId(raw: string): FeatureId | null {
|
|
@@ -494,6 +498,8 @@ async function patchPackageJson(
|
|
|
494
498
|
|
|
495
499
|
if (!selection.cli) {
|
|
496
500
|
delete pkg.bin;
|
|
501
|
+
} else {
|
|
502
|
+
pkg.bin = { kavoru: "./bin/kavoru.js" };
|
|
497
503
|
}
|
|
498
504
|
|
|
499
505
|
await Bun.write(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
package/src/module-cli.ts
CHANGED
|
@@ -66,6 +66,7 @@ Usage: kavoru module <module-name> [options]
|
|
|
66
66
|
|
|
67
67
|
Generate a feature module under src/modules/<module-name>/ with:
|
|
68
68
|
routes.ts, service.ts, types.ts
|
|
69
|
+
src/models/schemas/<module-name>.ts (query, body, params schemas)
|
|
69
70
|
|
|
70
71
|
Options:
|
|
71
72
|
-f, --force Overwrite an existing module folder
|
|
@@ -74,6 +75,5 @@ Options:
|
|
|
74
75
|
Examples:
|
|
75
76
|
kavoru module users
|
|
76
77
|
kavoru module user-profile --force
|
|
77
|
-
bun run kavoru module billing
|
|
78
78
|
`);
|
|
79
79
|
}
|
package/src/template.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
1
2
|
import { cp, mkdir, rm } from "node:fs/promises";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { TEMPLATE_BRANCH } from "./constants";
|
|
@@ -149,6 +150,16 @@ export async function installDependencies(projectDir: string): Promise<void> {
|
|
|
149
150
|
await runCommand(["bun", "install"], projectDir);
|
|
150
151
|
}
|
|
151
152
|
|
|
153
|
+
export async function linkProjectCli(projectDir: string): Promise<void> {
|
|
154
|
+
const script = path.join(projectDir, "scripts/link-cli.ts");
|
|
155
|
+
if (!existsSync(script)) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
log.step("Linking kavoru to PATH (~/.bun/bin)");
|
|
160
|
+
await runCommand(["bun", script], projectDir);
|
|
161
|
+
}
|
|
162
|
+
|
|
152
163
|
export function resolveTemplateSource(
|
|
153
164
|
repo: string,
|
|
154
165
|
branch: string,
|