speedrun-cli 2.7.9 → 2.7.15

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/CHANGELOG.md CHANGED
@@ -5,7 +5,45 @@ All notable changes to create-nestjs-auth will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [2.8.0] - 2026-08-22
8
+ ## [2.7.14] - 2026-08-22
9
+
10
+ ### Fixed
11
+ - **FK fields now included in `Create*Dto` and response DTO** — When relations (Many-to-One / One-to-Many) are defined during `speedrun-cli g [module]`, the foreign key fields (e.g., `userId`, `categoryId`) are now generated in `create-[module].dto.ts` with `@IsUUID()` / `@IsOptional()` validators and `@ApiPropertyOptional({ format: 'uuid' })` Swagger docs. They also appear in the response DTO.
12
+ - **`IsUUID` added to class-validator imports when relations exist** — The validator import set now includes `IsUUID` whenever at least one relation FK field is generated, preventing `TS2304: Cannot find name 'IsUUID'`.
13
+ - **`Type` (class-transformer) no longer bleeds into class-validator import** — The `allValDecorators` collector now filters to `Is*` prefixed names only, preventing duplicate/wrong imports like `import { Type } from 'class-validator'` in both `generateModule` and `regenerateModuleComponents`.
14
+ - **TypeORM `update()` uses object criteria form** — Changed `this.repo.update(primaryKey, dto)` to `this.repo.update({ primaryKey } as any, dto)` so TypeORM correctly resolves the WHERE clause by column object rather than treating the PK name string as the row ID.
15
+ - **`parseExistingFields` reads `create-[module].dto.ts` and uses validator decorators for type inference** — Previously read the response DTO and guessed ORM types from TypeScript types, causing `number` → `'Number'` corruption. Now reads the create DTO (which has `@IsInt()`, `@IsDate()`, etc.) and maps them precisely to ORM-native types (`Int`, `DateTime`, `timestamp`, etc.) per detected ORM.
16
+
17
+ ---
18
+
19
+ ## [2.7.13] - 2026-08-22
20
+
21
+ ### Fixed
22
+ - **`regenerateModuleComponents` – Primary Key now detected from existing DTO** — Previously hardcoded `primaryKey = 'id'`, which would overwrite custom PKs (`food_id`, `foodId`, etc.) when using `speedrun-cli field`. Now reads the PK from the module's response DTO via `detectModulePrimaryKey()`.
23
+ - **`syncPrismaSchema` – `forceUpdate` flag added** — Calling `speedrun-cli field` → Save no longer silently skips Prisma schema updates when the model already exists. The existing model block is now replaced in-place.
24
+ - **`fieldManager` – `kebabName` now uses `toKebabCase()`** — Multi-word module names like `OrderItems` are correctly normalised to `order-items` instead of `orderitems`.
25
+ - **`fieldManager` – `parseExistingFields` ignores custom PK/FK fields** — Fields ending with `_id` or `Id` are now excluded from the editable field list so custom primary keys and foreign keys are never accidentally modified.
26
+ - **`fieldManager` – `save` action correctly exits loop** — After saving, `managing` is now set to `false` so the prompt loop terminates instead of continuing.
27
+ - **`moduleGenerator` – `require('./utils')` result now assigned** — `detectPackageManager` and `getRunPrefix` from `utils` are now explicitly imported rather than silently discarded.
28
+ - **`moduleGenerator` – `toKebabCase` and `detectModulePrimaryKey` now exported** — Both utilities are exported so `fieldManager` and other consumers can import them directly.
29
+
30
+ ---
31
+
32
+ ## [2.7.12] - 2026-08-22
33
+
34
+ ### Added
35
+ - **Database Migration & Seed Actions in Field Manager (`speedrun-cli field`)** — Added interactive prompt options `⚡ Run database migration / schema sync` and `🌱 Seed database table` directly to the `? What do you want to do?` menu in `speedrun-cli field` / `speedrun-cli f`. Also offers an optional prompt to immediately run migrations and seeds right after saving updated fields.
36
+
37
+ ---
38
+
39
+ ## [2.7.11] - 2026-08-22
40
+
41
+ ### Fixed
42
+ - **Dynamic ORM Field Types in Interactive Field Manager (`speedrun-cli field`)** — Updated `src/fieldManager.js` to dynamically detect the project ORM (`detectOrm`) and populate field type choices using `getOrmFieldChoices(orm)` instead of hardcoded default choices.
43
+
44
+ ---
45
+
46
+ ## [2.7.10] - 2026-08-22
9
47
 
10
48
  ### Added
11
49
  - **Auto-Scaffold Missing Base Architecture (`ensureBaseArchitecture`)** — When generating modules via `speedrun-cli g [module]`, `src/common/base` is automatically scaffolded if missing from target project, resolving TS2307 & TS4112 compilation errors.
@@ -18,38 +56,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
18
56
  - **Specific Field Editing Sub-menu** — Interactive sub-menu allows modifying specific field properties (Field Name, Field Type, Optional Status, or All) instead of forcing full re-entry.
19
57
  - **Advanced Relationship Builder** — Interactively add relations (`Many-to-One`, `One-to-Many`) pointing to target modules and foreign keys, automatically injecting attributes into Prisma, TypeORM, Mongoose, and Drizzle schemas.
20
58
  - **Auth & Roles Guard Protection Prompt** — Optional step to protect write operations (`POST`, `PUT`, `DELETE`) with `@UseGuards()` and role-based decorators (`ADMIN`, `USER`, `MANAGER`).
21
-
22
- ### Changed
23
- - **Standardized Import Statements** — Controller & Service templates now fetch `BaseController`, `BaseService`, `IBaseRepository`, `ApiResponseDto`, `ApiResponseSchema`, `PaginatedResponseDto`, `PaginatedResponseSchema`, `PaginationQueryDto` cleanly from the single barrel export `../../common/base`.
24
-
25
- ---
26
-
27
- ## [2.7.1] - 2026-08-22
59
+ - **Optional `status` Field Prompt** — Added interactive prompt `Include default 'status' field (e.g. ACTIVE)? (Y/n)` during module generation to include or omit status field.
28
60
 
29
61
  ### Fixed
30
- - **Strict Input Validation for CLI Confirm Prompts** — Implemented `StrictConfirmPrompt` across all CLI interactive prompts. Previously, typing invalid characters (e.g. `'t'`) on boolean confirm prompts would silently default to `'no'`. Now, only valid inputs (`'y'`, `'n'`, `'yes'`, `'no'`, or pressing Enter for default) are accepted, and typing invalid characters displays `>> Invalid input. Please enter 'y' or 'n'.` and re-prompts the user.
31
-
32
- ---
33
-
34
- ## [2.7.0] - 2026-08-22
35
-
36
- ### Added
37
- - **Scaffolding Cleanup** — Static `src/modules/products` directory has been completely removed from all initial project templates (`templates/base-crud*`). Scaffolding now creates zero CRUD modules by default.
38
- - **Interactive Field Builder Loop** — When generating a module (via guided setup or `speedrun-cli g [module_name]`), users can interactively define custom fields (`fieldName`, `fieldType`: `String`/`Number`/`Boolean`/`Date`, `isOptional`).
39
- - **Dynamic ORM Schema Synchronization** — Automatically syncs definitions to the project's detected ORM:
40
- - **Prisma:** Appends `model` with appropriate data types (`String`, `Float`/`Int`, `Boolean`, `DateTime`) and optional modifiers (`?`) to `prisma/schema.prisma`.
41
- - **TypeORM:** Generates `@Entity()` class in `src/modules/[kebab]/entities/[singular].entity.ts`.
42
- - **Mongoose:** Generates `@Schema()` class in `src/modules/[kebab]/schemas/[singular].schema.ts`.
43
- - **Drizzle:** Generates `pgTable` definition in `src/modules/[kebab]/schema/[kebab].schema.ts`.
44
- - **Auto-Generated Starter Seed Template** — Creates starter seed snippet populated with dummy data based on defined fields in `prisma/seeds/[kebab].seed.ts` (Prisma) or `src/database/seeds/[kebab].seed.ts` (TypeORM/Mongoose/Drizzle).
45
- - **Dynamic Post-Setup Summary Log** — Displays clear post-install next steps dynamically tailored for each ORM (migration & seed commands).
62
+ - **Runtime Error `TypeError: manageFields is not a function` Fixed** — Exported `fieldManager` in `src/index.js` entry point so `manageFields` is properly destructured in `bin/cli.js` when executing `speedrun-cli field [module]`.
63
+ - **Module Field Regeneration** — Exported `regenerateModuleComponents` in `src/moduleGenerator.js` to enable automatic DTO and ORM schema updates when field definitions are edited via `speedrun-cli field`.
64
+ - **Automated Migration Flow for CRUD Modules & JWT Setup** — Reordered post-setup steps in `handlePostSetup` so CRUD module generation occurs *before* database migrations/seeding. Any generated CRUD modules and schema updates are now automatically included when running `prisma migrate dev` / `schema:sync` / `db:push` and seeding during CLI setup.
65
+ - **Strict Input Validation for CLI Confirm Prompts** — Enforced strict `y`/`n` input validation across all CLI interactive prompts.
46
66
 
47
67
  ### Changed
48
- - **Interactive Setup Prompt Sequence** updated:
49
- 1. `Enable Base CRUD Architecture?` (Default: `Yes`)
50
- 2. `Do you want to generate your first CRUD module now?` (Default: `Yes`)
51
- 3. Shared Module Generator execution for module name, CRUD mode, and custom field loop.
52
- - **Controller Service Constructor Visibility** fixed to `protected readonly service: [Name]Service` so generated controllers safely extend `BaseController`.
68
+ - **Standardized Import Statements** — Controller & Service templates now fetch `BaseController`, `BaseService`, `IBaseRepository`, `ApiResponseDto`, `ApiResponseSchema`, `PaginatedResponseDto`, `PaginatedResponseSchema`, `PaginationQueryDto` cleanly from the single barrel export `../../common/base`.
53
69
 
54
70
  ---
55
71