@nexusts/cli 0.7.4 → 0.7.6

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.
@@ -1,8 +1,9 @@
1
1
  /**
2
- * `nx db:generate <name>` — generate a new migration file from schema changes.
2
+ * `nx db:generate [name]` — generate a new migration file from schema changes.
3
3
  *
4
- * Wraps `drizzle-kit generate` with the project's config, so you
5
- * don't need to pass `--config` every time.
4
+ * Runs `drizzle-kit generate` which compares your schema files
5
+ * (under app/models/*.model.ts) with the database and auto-generates
6
+ * a migration. This is the recommended way to create migrations.
6
7
  *
7
8
  * Examples:
8
9
  * nx db:generate add_users_table
@@ -10,9 +11,11 @@
10
11
  * nx db:generate --sql # raw SQL file (no drizzle-kit)
11
12
  *
12
13
  * See also:
13
- * nx db:migrate — apply pending migrations
14
- * nx db:seed — run database seeds
15
- * nx make:migration — scaffold an empty migration file
14
+ * nx db:migrate — apply pending migrations
15
+ * nx db:seed — run database seeds
16
+ * nx make:migration — scaffold an EMPTY migration file (manual)
17
+ * Use this for one-off SQL edits; prefer
18
+ * db:generate for normal schema changes.
16
19
  */
17
20
  import type { Command } from "../core/index.js";
18
21
  export declare const dbGenerateCommand: Command;
@@ -1,5 +1,12 @@
1
1
  /**
2
- * `nx make:migration <Name>` — generate a database migration.
2
+ * `nx make:migration <Name>` — scaffold an EMPTY migration file (manual).
3
+ *
4
+ * Creates a template file under app/database/migrations/ that you
5
+ * fill in by hand. Use this for one-off SQL edits or when you need
6
+ * fine-grained control over the migration.
7
+ *
8
+ * For NORMAL schema changes, prefer `nx db:generate [name]` which
9
+ * auto-generates migrations from your model files via drizzle-kit.
3
10
  *
4
11
  * Filename pattern: `YYYYMMDD_HHmmss_<snake>.sql` (or `.ts` for
5
12
  * Drizzle). The file is placed under the configured `paths.migrations`
@@ -8,10 +15,6 @@
8
15
  * Drizzle dialect is chosen via `--dialect` (postgres | mysql | sqlite
9
16
  * | bun-sqlite | d1) or `nx.config.ts`'s `dialect` field. Default: bun-sqlite.
10
17
  *
11
- * Drizzle migrations are TypeScript files that export a `pgTable` /
12
- * `mysqlTable` / `sqliteTable` definition — the same shape as
13
- * `nx make:model` — and are loaded by the Drizzle migrator at runtime.
14
- *
15
18
  * Plain SQL migrations work for any dialect that uses Drizzle's
16
19
  * migrator (postgres-js / node-postgres / mysql2 / better-sqlite3).
17
20
  */
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `nx make:repository <Name>` — generate a repository class.
3
+ */
4
+ import type { Command } from "../core/index.js";
5
+ export declare const makeRepositoryCommand: Command;
6
+ export default makeRepositoryCommand;
@@ -34,6 +34,7 @@ export declare function preloadService(env: Record<string, unknown>, app: {
34
34
  resolve: (t: unknown) => unknown;
35
35
  };
36
36
  }, name: string, path: string, className: string): Promise<void>;
37
+ export declare function describeToken(token: unknown): string;
37
38
  export declare function listServices(container: unknown): string[];
38
39
  export declare function isIncomplete(code: string): boolean;
39
40
  export declare function formatResult(r: unknown): string;
@@ -41,3 +41,15 @@ export interface CommandContext {
41
41
  positional: string[];
42
42
  flags: Record<string, string | boolean | string[]>;
43
43
  }
44
+ /**
45
+ * Context passed to seed file default exports.
46
+ *
47
+ * import type { SeedContext } from "@nexusts/cli";
48
+ * export default async function seed(ctx: SeedContext) { ... }
49
+ */
50
+ export interface SeedContext {
51
+ db: import("@nexusts/drizzle").DrizzleService;
52
+ logger: import("@nexusts/logger").Logger;
53
+ dialect: string;
54
+ truncate: (table: any) => Promise<void>;
55
+ }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  /**
3
- * `nx` — the Nexus CLI entry point.
3
+ * `nx` — the NexusTS CLI entry point.
4
4
  *
5
5
  * Invocation:
6
6
  * bunx nx <command> [args...]