@nexusts/cli 0.7.0 → 0.7.2

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 (57) hide show
  1. package/README.md +2 -2
  2. package/dist/commands/config.d.ts +43 -0
  3. package/dist/commands/db-generate.d.ts +19 -0
  4. package/dist/commands/db-migrate.d.ts +32 -0
  5. package/dist/commands/db-seed.d.ts +42 -0
  6. package/dist/commands/index.d.ts +10 -0
  7. package/dist/commands/info.d.ts +10 -0
  8. package/dist/commands/init.d.ts +37 -0
  9. package/dist/commands/make-auth.d.ts +16 -0
  10. package/dist/commands/make-controller.d.ts +15 -0
  11. package/dist/commands/make-crud.d.ts +27 -0
  12. package/dist/commands/make-listener.d.ts +14 -0
  13. package/dist/commands/make-middleware.d.ts +6 -0
  14. package/dist/commands/make-migration.d.ts +20 -0
  15. package/dist/commands/make-model.d.ts +21 -0
  16. package/dist/commands/make-module.d.ts +10 -0
  17. package/dist/commands/make-queue.d.ts +16 -0
  18. package/dist/commands/make-schedule.d.ts +16 -0
  19. package/dist/commands/make-service.d.ts +6 -0
  20. package/dist/commands/make-session.d.ts +14 -0
  21. package/dist/commands/make-validator.d.ts +6 -0
  22. package/dist/commands/new.d.ts +13 -0
  23. package/dist/commands/repl.d.ts +41 -0
  24. package/dist/commands/route-list.d.ts +11 -0
  25. package/dist/core/args.d.ts +28 -0
  26. package/dist/core/config.d.ts +136 -0
  27. package/dist/core/fs.d.ts +37 -0
  28. package/dist/core/index.d.ts +42 -0
  29. package/dist/core/logger.d.ts +45 -0
  30. package/dist/core/loose-json.d.ts +25 -0
  31. package/dist/core/prompts.d.ts +21 -0
  32. package/dist/core/template.d.ts +25 -0
  33. package/dist/index.d.ts +21 -0
  34. package/dist/index.js +1290 -1091
  35. package/dist/index.js.map +37 -33
  36. package/dist/templates/controller/adonis.d.ts +9 -0
  37. package/dist/templates/controller/functional.d.ts +8 -0
  38. package/dist/templates/controller/nest.d.ts +16 -0
  39. package/dist/templates/crud/controller.d.ts +7 -0
  40. package/dist/templates/crud/dto.d.ts +7 -0
  41. package/dist/templates/crud/module.d.ts +5 -0
  42. package/dist/templates/crud/test.d.ts +9 -0
  43. package/dist/templates/index.d.ts +38 -0
  44. package/dist/templates/middleware/middleware.d.ts +7 -0
  45. package/dist/templates/migration/drizzle.d.ts +11 -0
  46. package/dist/templates/migration/sql.d.ts +9 -0
  47. package/dist/templates/model/drizzle-dialect.d.ts +28 -0
  48. package/dist/templates/model/drizzle.d.ts +13 -0
  49. package/dist/templates/model/kysely.d.ts +11 -0
  50. package/dist/templates/model/prisma.d.ts +11 -0
  51. package/dist/templates/module/module.d.ts +15 -0
  52. package/dist/templates/project/drizzle.config.d.ts +11 -0
  53. package/dist/templates/project/nx.config.d.ts +6 -0
  54. package/dist/templates/repository/repository.d.ts +12 -0
  55. package/dist/templates/service/service.d.ts +11 -0
  56. package/dist/templates/validator/validator.d.ts +7 -0
  57. package/package.json +5 -2
@@ -0,0 +1,9 @@
1
+ /**
2
+ * AdonisJS-style controller template (no decorators, just methods).
3
+ *
4
+ * Use when `nx.config.ts` has `routing: 'adonis'`. Routes are added
5
+ * separately by the user (or by the `make:crud` command) to a route
6
+ * table; this controller is just a plain class.
7
+ */
8
+ declare const _default: string;
9
+ export default _default;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Functional (Hono-native) controller template.
3
+ *
4
+ * Each route is a plain function `(c) => Response`. Useful for
5
+ * webhooks, SSE endpoints, or anything that doesn't fit a class shape.
6
+ */
7
+ declare const _default: string;
8
+ export default _default;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * NestJS-style controller template.
3
+ *
4
+ * Renders an `@Controller(prefix)` class with `@Get` / `@Post` /
5
+ * `@Put` / `@Delete` routes that delegate to an injected service.
6
+ *
7
+ * Context keys used:
8
+ * name — PascalCase class name (e.g. "User")
9
+ * kebab — kebab-case URL segment (e.g. "user")
10
+ * pascal — alias for name (template convenience)
11
+ * camel — camelCase variable name (e.g. "userService")
12
+ * service — PascalCase service name (e.g. "UserService")
13
+ * serviceCamel — camelCase service variable (e.g. "userService")
14
+ */
15
+ declare const _default: string;
16
+ export default _default;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Controller template for `make:crud` (Nest style, with optional Inertia).
3
+ *
4
+ * Renders all five RESTful actions + an Inertia page if `view === 'inertia'`.
5
+ */
6
+ declare const _default: string;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * DTO / validation schema template for `make:crud`.
3
+ *
4
+ * Generates a `{{ name }}Dto` schema and a typesafe `Create{{ name }}` type.
5
+ */
6
+ declare const _default: string;
7
+ export default _default;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Module template for `make:crud`.
3
+ */
4
+ declare const _default: string;
5
+ export default _default;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Vitest test template for `make:crud`.
3
+ *
4
+ * Renders an integration test that exercises the controller's CRUD
5
+ * endpoints through the running server. The test auto-imports the
6
+ * appropriate service depending on `hasRepo`.
7
+ */
8
+ declare const _default: string;
9
+ export default _default;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Re-exports for scaffold templates.
3
+ *
4
+ * Commands import the templates they need and pass a render context.
5
+ * Adding a new template is a one-line change here.
6
+ */
7
+ export declare const templates: {
8
+ controller: {
9
+ nest: string;
10
+ adonis: string;
11
+ functional: string;
12
+ };
13
+ service: string;
14
+ repository: string;
15
+ module: string;
16
+ validator: string;
17
+ middleware: string;
18
+ model: {
19
+ drizzle: string;
20
+ prisma: string;
21
+ kysely: string;
22
+ };
23
+ migration: {
24
+ drizzle: string;
25
+ sql: string;
26
+ };
27
+ crud: {
28
+ controller: string;
29
+ module: string;
30
+ dto: string;
31
+ test: string;
32
+ };
33
+ project: {
34
+ "nx.config.ts": string;
35
+ "drizzle.config.ts": string;
36
+ };
37
+ };
38
+ export type TemplateKey = keyof typeof templates;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Middleware template — for `make:middleware <Name>`.
3
+ *
4
+ * Generates an `@Injectable()` middleware class with a `handle` method.
5
+ */
6
+ declare const _default: string;
7
+ export default _default;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Drizzle migration template.
3
+ *
4
+ * Context:
5
+ * name — PascalCase model name
6
+ * tableName — snake_case plural table
7
+ * columns — column definitions (rendered by command)
8
+ * timestamp — ISO timestamp prefix used in the filename
9
+ */
10
+ declare const _default: string;
11
+ export default _default;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Generic migration header.
3
+ *
4
+ * Context:
5
+ * name — PascalCase model name
6
+ * timestamp — ISO timestamp prefix
7
+ */
8
+ declare const _default: string;
9
+ export default _default;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Drizzle ORM model template — dialect-aware.
3
+ *
4
+ * Renders a Drizzle table schema + types. The right import path
5
+ * (`drizzle-orm/pg-core`, `drizzle-orm/mysql-core`, `drizzle-orm/sqlite-core`,
6
+ * `drizzle-orm/bun-sqlite`, `drizzle-orm/d1`) and column helpers are
7
+ * selected by the caller.
8
+ *
9
+ * Context:
10
+ * name — PascalCase class name (e.g. "User")
11
+ * kebab — kebab-case file name (e.g. "user")
12
+ * tableName — snake_case plural table name (e.g. "users")
13
+ * columns — newline-separated column lines (rendered by command)
14
+ * importPath — drizzle dialect module path
15
+ * idHelper — 'serial' (pg), 'int' (mysql), 'integer' (sqlite/bun/d1)
16
+ * tsHelper — 'integer' (pg), 'int' (mysql), 'integer' (sqlite/bun/d1)
17
+ * tsText — 'text' for all dialects
18
+ * tsTimestamp — 'timestamp' (pg/mysql) or 'integer' (sqlite/d1)
19
+ * tsBool — 'boolean' (pg/mysql) or 'integer' (sqlite/d1)
20
+ * tsDateMode — '' (pg), '' (mysql), "{ mode: 'timestamp' }" (sqlite/d1)
21
+ * idType — Drizzle column type for id (e.g. "serial", "integer")
22
+ * timestampType — Drizzle column type for createdAt/updatedAt
23
+ */
24
+ export declare function renderDrizzleDialect(dialect: string): string;
25
+ /** Per-dialect TS-type for a column flag. */
26
+ export declare function mapDrizzleType(dialect: string, type: string): string;
27
+ /** Whether the column needs a notNull() modifier by default. */
28
+ export declare function shouldBeNotNull(type: string): boolean;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Drizzle ORM model template.
3
+ *
4
+ * Generates a Drizzle table schema + a typed repository wrapper.
5
+ *
6
+ * Context:
7
+ * name — PascalCase class name (e.g. "User")
8
+ * kebab — kebab-case file name (e.g. "user")
9
+ * tableName — snake_case plural table name (e.g. "users")
10
+ * columns — newline-separated column list (rendered by command)
11
+ */
12
+ declare const _default: string;
13
+ export default _default;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Kysely model template.
3
+ *
4
+ * Generates a typed table interface + repository.
5
+ *
6
+ * Context:
7
+ * name — PascalCase (e.g. "User")
8
+ * tableName — snake_case plural (e.g. "users")
9
+ */
10
+ declare const _default: string;
11
+ export default _default;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Prisma model template.
3
+ *
4
+ * Renders a `model Foo { ... }` block plus a typed client wrapper.
5
+ *
6
+ * Context:
7
+ * name — PascalCase (e.g. "User")
8
+ * fields — rendered field lines (name, type, optionality)
9
+ */
10
+ declare const _default: string;
11
+ export default _default;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Module template.
3
+ *
4
+ * Aggregates controllers, services, and repositories for a feature
5
+ * folder. Mirrors NestJS `@Module({ controllers, providers, exports })`.
6
+ *
7
+ * Context:
8
+ * name — PascalCase module name (e.g. "User")
9
+ * controller — PascalCase controller (e.g. "UserController")
10
+ * service — PascalCase service (e.g. "UserService")
11
+ * repository — PascalCase repository (e.g. "UserRepository") — optional
12
+ * exports — comma-separated tokens to re-export (e.g. "UserService")
13
+ */
14
+ declare const _default: string;
15
+ export default _default;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * drizzle.config.ts template — placed at the project root by
3
+ * `nx config` when the project's ORM is set to `drizzle`.
4
+ *
5
+ * The dialect is derived from the project's `db` driver:
6
+ * bun-sqlite / node-sqlite / libsql → sqlite
7
+ * postgres → postgresql
8
+ * mysql → mysql
9
+ */
10
+ declare const _default: "\nimport { defineConfig } from \"drizzle-kit\";\n\nexport default defineConfig({\n dialect: \"{{ dialect }}\",\n schema: \"./app/models/*.model.ts\",\n out: \"./drizzle\",\n dbCredentials: {\n url: process.env.DATABASE_URL ?? \"{{ dbUrl }}\",\n },\n verbose: true,\n strict: true,\n});\n";
11
+ export default _default;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * nx.config.ts template — placed at the project root by `nx init` /
3
+ * `nx new`.
4
+ */
5
+ declare const _default: "/**\n * Nexus project configuration.\n * Run `nx info` to see the resolved values.\n */\n\nexport default {\n // ---------------------------------------------------------------------------\n // Core\n // ---------------------------------------------------------------------------\n\n /** Routing style used by `make:controller` / `make:crud`. */\n routing: '{{ routing }}',\n\n /** View engine \u2014 `inertia`, `rendu`, `edge`, or `none`. */\n view: '{{ view }}',\n\n /**\n * Directory searched when a controller returns a view file name\n * (e.g. `about.html`). Empty string = inline templates only.\n * Typical: `'resources/views'`. On edge runtimes\n * (Cloudflare Workers), leave empty and pass inline strings.\n */\n viewPaths: '{{ viewPaths }}',\n\n /** ORM driver \u2014 `drizzle`, `prisma`, `kysely`, or `none`. */\n orm: '{{ orm }}',\n\n // ---------------------------------------------------------------------------\n // Database\n // ---------------------------------------------------------------------------\n\n database: {\n driver: '{{ dbDriver }}',\n url: process.env.DATABASE_URL ?? '{{ dbUrl }}',\n },\n\n // ---------------------------------------------------------------------------\n // Inertia (only consulted when `view === 'inertia'`)\n // ---------------------------------------------------------------------------\n\n inertia: {\n frontend: '{{ inertiaFrontend }}',\n ssr: {{ inertiaSSR }},\n version: '{{ inertiaVersion }}',\n },\n\n // ---------------------------------------------------------------------------\n // Paths\n // ---------------------------------------------------------------------------\n\n paths: {\n app: 'app',\n controllers: 'app/controllers',\n services: 'app/services',\n modules: 'app/modules',\n models: 'app/models',\n migrations: 'app/database/migrations',\n seeds: 'db/seeds',\n middleware: 'app/middleware',\n dto: 'app/dto',\n },\n};\n";
6
+ export default _default;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Repository template.
3
+ *
4
+ * Context:
5
+ * name — PascalCase class name
6
+ * camel — camelCase variable
7
+ * kebab — kebab-case
8
+ * tableName — plural snake_case table name
9
+ * repository — PascalCase repository name
10
+ */
11
+ declare const _default: string;
12
+ export default _default;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Service template.
3
+ *
4
+ * Context:
5
+ * name — PascalCase class name
6
+ * camel — camelCase variable
7
+ * repository — PascalCase repository name (only if ORM !== 'none')
8
+ * repositoryCamel — camelCase repo variable
9
+ */
10
+ declare const _default: string;
11
+ export default _default;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Validator (DTO) template — for `make:validator <Name>`.
3
+ *
4
+ * Generates a Zod schema with reasonable starter fields.
5
+ */
6
+ declare const _default: string;
7
+ export default _default;
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@nexusts/cli",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "CLI command runner (nx)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
+ "bin": {
10
+ "nx": "./dist/index.js"
11
+ },
9
12
  "exports": {
10
13
  ".": {
11
14
  "types": "./dist/index.d.ts",
@@ -26,6 +29,6 @@
26
29
  ],
27
30
  "license": "MIT",
28
31
  "dependencies": {
29
- "@nexusts/core": "^0.7.0"
32
+ "@nexusts/core": "^0.7.2"
30
33
  }
31
34
  }