Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #7335 +/- ##
========================================
Coverage 99.64% 99.64%
========================================
Files 262 263 +1
Lines 26080 26210 +130
Branches 7207 7236 +29
========================================
+ Hits 25987 26117 +130
Misses 88 88
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
674b629 to
fe50c40
Compare
4b5cf6d to
ad98793
Compare
Generate a TypeScript barrel file with entity exports for typed Kysely and ORM config. Scans entity source files and produces an `entities` array and a `Database` type for use with `getKysely<Database>()`. Closes #7323 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rt --dump The dump codepath passed `process.cwd()` (a directory) as `outPath` to `generateFile()`, so `dirname()` resolved to the parent of cwd, making import paths include the last cwd segment and vary across machines. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Node 24 enables --experimental-strip-types by default. When vitest's OXC transform races under multi-worker `isolate: false`, some .ts imports fall through to Node's native strip-only mode which cannot handle TypeScript parameter properties (`constructor(public x: T)`). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
After vi.resetModules() clears the module cache, the globalThis.dynamicImportProvider still held a reference to an import() function from a previous module evaluation. Under isolate: false with multiple workers, this stale reference could resolve through Node's native loader instead of vitest's OXC transform, causing SyntaxErrors on decorator and parameter property syntax. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add tests for builder options, .d.ts skipping, __esModule filtering, default exports, duplicate avoidance, output path resolution from config, CJS file output, driver fallbacks, and non-entity exports. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Skip Kysely type imports/exports for MongoDB driver - Create parent directories with mkdirSync when writing output file - Revert BigIntType, DecimalType, FullTextType to use parameter properties Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ad98793 to
848a889
Compare
B4nan
added a commit
that referenced
this pull request
Apr 19, 2026
## Summary Adds a `discovery:export` CLI command that scans entity source files and generates a TypeScript barrel file (#7323). The generated file provides: - `export const entities = [...] as const` — for use in ORM config - `export type Database = ...` — for typed `getKysely<Database>()` in DI contexts (NestJS, etc.) ### Command usage ```bash mikro-orm discovery:export [--path './src/entities/*.ts'] [--out ./entities.generated.ts] [--dump] ``` ### Files changed - **New:** `packages/cli/src/commands/DiscoveryExportCommand.ts` — the command implementation - **Modified:** `packages/cli/src/CLIConfigurator.ts` — register the command - **New:** `tests/features/cli/DiscoveryExportCommand.test.ts` — 14 tests - **Modified:** `tests/features/cli/CLIHelper.test.ts` — updated command list assertion - **Modified:** `docs/docs/kysely.md` and `docs/versioned_docs/version-7.0/kysely.md` — documentation ## Test plan - [x] 14 unit tests covering: dump mode, file write, ESM/CJS imports, EntitySchema dedup, decorator entities, multiple entities, driver package resolution, config path fallback, error cases - [x] `yarn build` passes (CLI package) - [x] `yarn tsc-check-tests` passes - [x] Full test suite passes (5314/5314) Closes #7323 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
B4nan
added a commit
that referenced
this pull request
Apr 20, 2026
## Summary Adds a `discovery:export` CLI command that scans entity source files and generates a TypeScript barrel file (#7323). The generated file provides: - `export const entities = [...] as const` — for use in ORM config - `export type Database = ...` — for typed `getKysely<Database>()` in DI contexts (NestJS, etc.) ### Command usage ```bash mikro-orm discovery:export [--path './src/entities/*.ts'] [--out ./entities.generated.ts] [--dump] ``` ### Files changed - **New:** `packages/cli/src/commands/DiscoveryExportCommand.ts` — the command implementation - **Modified:** `packages/cli/src/CLIConfigurator.ts` — register the command - **New:** `tests/features/cli/DiscoveryExportCommand.test.ts` — 14 tests - **Modified:** `tests/features/cli/CLIHelper.test.ts` — updated command list assertion - **Modified:** `docs/docs/kysely.md` and `docs/versioned_docs/version-7.0/kysely.md` — documentation ## Test plan - [x] 14 unit tests covering: dump mode, file write, ESM/CJS imports, EntitySchema dedup, decorator entities, multiple entities, driver package resolution, config path fallback, error cases - [x] `yarn build` passes (CLI package) - [x] `yarn tsc-check-tests` passes - [x] Full test suite passes (5314/5314) Closes #7323 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
discovery:exportCLI command that scans entity source files and generates a TypeScript barrel file (#7323). The generated file provides:export const entities = [...] as const— for use in ORM configexport type Database = ...— for typedgetKysely<Database>()in DI contexts (NestJS, etc.)Command usage
mikro-orm discovery:export [--path './src/entities/*.ts'] [--out ./entities.generated.ts] [--dump]Files changed
packages/cli/src/commands/DiscoveryExportCommand.ts— the command implementationpackages/cli/src/CLIConfigurator.ts— register the commandtests/features/cli/DiscoveryExportCommand.test.ts— 14 teststests/features/cli/CLIHelper.test.ts— updated command list assertiondocs/docs/kysely.mdanddocs/versioned_docs/version-7.0/kysely.md— documentationTest plan
yarn buildpasses (CLI package)yarn tsc-check-testspassesCloses #7323
🤖 Generated with Claude Code