@forinda/kickjs-cli 1.2.2 → 1.2.4
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/dist/cli.js +86 -0
- package/dist/cli.js.map +1 -1
- package/dist/index.js +86 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -272,6 +272,7 @@ export default defineConfig({
|
|
|
272
272
|
},
|
|
273
273
|
})
|
|
274
274
|
`);
|
|
275
|
+
await writeFileSafe(join(dir, "README.md"), generateReadme(name, template, packageManager));
|
|
275
276
|
if (options.initGit) {
|
|
276
277
|
try {
|
|
277
278
|
execSync("git init", {
|
|
@@ -429,6 +430,91 @@ bootstrap({
|
|
|
429
430
|
}
|
|
430
431
|
}
|
|
431
432
|
__name(getEntryFile, "getEntryFile");
|
|
433
|
+
function generateReadme(name, template, pm) {
|
|
434
|
+
const templateLabels = {
|
|
435
|
+
rest: "REST API",
|
|
436
|
+
graphql: "GraphQL API",
|
|
437
|
+
ddd: "Domain-Driven Design",
|
|
438
|
+
cqrs: "CQRS + Event-Driven",
|
|
439
|
+
minimal: "Minimal"
|
|
440
|
+
};
|
|
441
|
+
const packages = [
|
|
442
|
+
"@forinda/kickjs-core",
|
|
443
|
+
"@forinda/kickjs-http",
|
|
444
|
+
"@forinda/kickjs-config"
|
|
445
|
+
];
|
|
446
|
+
if (template !== "minimal") {
|
|
447
|
+
packages.push("@forinda/kickjs-swagger", "@forinda/kickjs-devtools");
|
|
448
|
+
}
|
|
449
|
+
if (template === "graphql") packages.push("@forinda/kickjs-graphql");
|
|
450
|
+
if (template === "cqrs") {
|
|
451
|
+
packages.push("@forinda/kickjs-queue", "@forinda/kickjs-ws", "@forinda/kickjs-otel");
|
|
452
|
+
}
|
|
453
|
+
return `# ${name}
|
|
454
|
+
|
|
455
|
+
A **${templateLabels[template] ?? "REST API"}** built with [KickJS](https://forinda.github.io/kick-js/) \u2014 a decorator-driven Node.js framework on Express 5 and TypeScript.
|
|
456
|
+
|
|
457
|
+
## Getting Started
|
|
458
|
+
|
|
459
|
+
\`\`\`bash
|
|
460
|
+
${pm} install
|
|
461
|
+
kick dev
|
|
462
|
+
\`\`\`
|
|
463
|
+
|
|
464
|
+
## Scripts
|
|
465
|
+
|
|
466
|
+
| Command | Description |
|
|
467
|
+
|---|---|
|
|
468
|
+
| \`kick dev\` | Start dev server with Vite HMR |
|
|
469
|
+
| \`kick build\` | Production build |
|
|
470
|
+
| \`kick start\` | Run production build |
|
|
471
|
+
| \`${pm} run test\` | Run tests with Vitest |
|
|
472
|
+
| \`kick g module <name>\` | Generate a DDD module |
|
|
473
|
+
| \`kick g scaffold <name> <fields...>\` | Generate CRUD from field definitions |
|
|
474
|
+
| \`kick add <package>\` | Add a KickJS package |
|
|
475
|
+
|
|
476
|
+
## Project Structure
|
|
477
|
+
|
|
478
|
+
\`\`\`
|
|
479
|
+
src/
|
|
480
|
+
\u251C\u2500\u2500 index.ts # Application entry point
|
|
481
|
+
\u251C\u2500\u2500 modules/ # Feature modules (controllers, services, repos)
|
|
482
|
+
\u2502 \u2514\u2500\u2500 index.ts # Module registry
|
|
483
|
+
\u2514\u2500\u2500 ...
|
|
484
|
+
\`\`\`
|
|
485
|
+
|
|
486
|
+
## Packages
|
|
487
|
+
|
|
488
|
+
${packages.map((p) => `- \`${p}\``).join("\n")}
|
|
489
|
+
|
|
490
|
+
## Adding Features
|
|
491
|
+
|
|
492
|
+
\`\`\`bash
|
|
493
|
+
kick add auth # Authentication (JWT, API key, OAuth)
|
|
494
|
+
kick add swagger # OpenAPI documentation
|
|
495
|
+
kick add ws # WebSocket support
|
|
496
|
+
kick add queue # Background job processing
|
|
497
|
+
kick add mailer # Email sending
|
|
498
|
+
kick add cron # Scheduled tasks
|
|
499
|
+
kick add --list # Show all available packages
|
|
500
|
+
\`\`\`
|
|
501
|
+
|
|
502
|
+
## Environment Variables
|
|
503
|
+
|
|
504
|
+
Copy \`.env.example\` to \`.env\` and configure:
|
|
505
|
+
|
|
506
|
+
| Variable | Default | Description |
|
|
507
|
+
|---|---|---|
|
|
508
|
+
| \`PORT\` | \`3000\` | Server port |
|
|
509
|
+
| \`NODE_ENV\` | \`development\` | Environment |
|
|
510
|
+
|
|
511
|
+
## Learn More
|
|
512
|
+
|
|
513
|
+
- [KickJS Documentation](https://forinda.github.io/kick-js/)
|
|
514
|
+
- [CLI Reference](https://forinda.github.io/kick-js/api/cli.html)
|
|
515
|
+
`;
|
|
516
|
+
}
|
|
517
|
+
__name(generateReadme, "generateReadme");
|
|
432
518
|
|
|
433
519
|
// src/commands/init.ts
|
|
434
520
|
function ask(question, defaultValue) {
|