mikro-orm-markdown 0.1.0-alpha.1

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/index.js ADDED
@@ -0,0 +1,461 @@
1
+ // src/docs/jsdoc.ts
2
+ import { Project } from "ts-morph";
3
+ function loadJsDoc(srcGlobs) {
4
+ const entities = /* @__PURE__ */ new Map();
5
+ const props = /* @__PURE__ */ new Map();
6
+ if (srcGlobs.length === 0) return { entities, props };
7
+ const project = new Project({
8
+ skipAddingFilesFromTsConfig: true,
9
+ skipLoadingLibFiles: true,
10
+ compilerOptions: {
11
+ experimentalDecorators: true,
12
+ skipLibCheck: true
13
+ }
14
+ });
15
+ project.addSourceFilesAtPaths(srcGlobs);
16
+ for (const sourceFile of project.getSourceFiles()) {
17
+ for (const cls of sourceFile.getClasses()) {
18
+ const className = cls.getName();
19
+ if (!className) continue;
20
+ const classDocs = cls.getJsDocs();
21
+ if (classDocs.length > 0) {
22
+ entities.set(className, parseEntityJsDoc(classDocs));
23
+ }
24
+ const propMap = /* @__PURE__ */ new Map();
25
+ for (const prop of cls.getProperties()) {
26
+ const propDocs = prop.getJsDocs();
27
+ if (propDocs.length === 0) continue;
28
+ const desc = extractDescription(propDocs);
29
+ if (desc !== void 0) {
30
+ propMap.set(prop.getName(), { description: desc });
31
+ }
32
+ }
33
+ if (propMap.size > 0) {
34
+ props.set(className, propMap);
35
+ }
36
+ }
37
+ }
38
+ return { entities, props };
39
+ }
40
+ function parseEntityJsDoc(jsDocs) {
41
+ const namespaces = [];
42
+ const erdNamespaces = [];
43
+ const describeNamespaces = [];
44
+ let hidden = false;
45
+ let description;
46
+ for (const doc of jsDocs) {
47
+ const desc = doc.getDescription().trim();
48
+ if (desc && description === void 0) description = desc;
49
+ for (const tag of doc.getTags()) {
50
+ const tagName = tag.getTagName();
51
+ const comment = tag.getCommentText()?.trim();
52
+ if (tagName === "namespace" && comment) namespaces.push(comment);
53
+ else if (tagName === "erd" && comment) erdNamespaces.push(comment);
54
+ else if (tagName === "describe" && comment) describeNamespaces.push(comment);
55
+ else if (tagName === "hidden") hidden = true;
56
+ }
57
+ }
58
+ return {
59
+ ...description !== void 0 && { description },
60
+ namespaces,
61
+ erdNamespaces,
62
+ describeNamespaces,
63
+ hidden
64
+ };
65
+ }
66
+ function extractDescription(jsDocs) {
67
+ for (const doc of jsDocs) {
68
+ const desc = doc.getDescription().trim();
69
+ if (desc) return desc;
70
+ }
71
+ return void 0;
72
+ }
73
+
74
+ // src/metadata/load.ts
75
+ import { MikroORM } from "@mikro-orm/core";
76
+ var MetadataLoadError = class extends Error {
77
+ constructor(message, cause) {
78
+ super(message);
79
+ this.cause = cause;
80
+ this.name = "MetadataLoadError";
81
+ }
82
+ };
83
+ async function loadEntityMetadata(options) {
84
+ let orm;
85
+ try {
86
+ orm = await MikroORM.init({
87
+ ...options,
88
+ debug: false
89
+ });
90
+ } catch (cause) {
91
+ throw new MetadataLoadError(
92
+ "Failed to initialize MikroORM and run entity discovery. Make sure your config is valid and all entity files are accessible.",
93
+ cause
94
+ );
95
+ }
96
+ try {
97
+ const all = Object.values(orm.getMetadata().getAll());
98
+ if (all.length === 0) {
99
+ throw new MetadataLoadError(
100
+ "No entities were discovered. Check that your config specifies at least one entity path or class."
101
+ );
102
+ }
103
+ return all;
104
+ } finally {
105
+ await orm.close(true);
106
+ }
107
+ }
108
+
109
+ // src/render/mermaid.ts
110
+ import { ReferenceKind } from "@mikro-orm/core";
111
+ var FORMULA_DUMMY_TABLE = {
112
+ alias: "e0",
113
+ name: "",
114
+ qualifiedName: "",
115
+ toString: () => "e0"
116
+ };
117
+ function buildDiagramModel(metas) {
118
+ const metaByClass = new Map(metas.map((m) => [m.className, m]));
119
+ const entities = metas.filter((meta) => !meta.pivotTable && !meta.embeddable).map((meta) => buildEntityModel(meta, metaByClass));
120
+ const relations = buildRelationEdges(metas);
121
+ return { entities, relations };
122
+ }
123
+ function buildEntityModel(meta, metaByClass) {
124
+ const isStiRoot = meta.discriminatorColumn !== void 0 && !meta.discriminatorValue;
125
+ const isStiChild = Boolean(meta.extends) && meta.discriminatorValue !== void 0;
126
+ const columns = [];
127
+ for (const prop of Object.values(meta.properties)) {
128
+ if (isStiRoot && prop.inherited === true) continue;
129
+ const col = buildColumn(prop, metaByClass, meta);
130
+ if (col !== null) columns.push(col);
131
+ }
132
+ return {
133
+ className: meta.className,
134
+ tableName: meta.tableName,
135
+ columns,
136
+ isPivot: false,
137
+ isEmbeddable: meta.embeddable === true,
138
+ ...isStiRoot && { discriminatorColumn: meta.discriminatorColumn },
139
+ ...isStiChild && { extendsEntity: meta.extends },
140
+ constraints: buildConstraints(meta)
141
+ };
142
+ }
143
+ function buildColumn(prop, metaByClass, owningMeta) {
144
+ if (prop.kind === ReferenceKind.EMBEDDED) return null;
145
+ if (prop.kind === ReferenceKind.SCALAR) {
146
+ const formulaExpr = prop.formula !== void 0 ? resolveFormulaExpr(prop.formula) : void 0;
147
+ let embeddedIn;
148
+ if (prop.embedded !== void 0) {
149
+ const parentPropName = prop.embedded[0];
150
+ embeddedIn = owningMeta.properties[parentPropName]?.type;
151
+ }
152
+ const isDiscriminator = owningMeta.discriminatorColumn !== void 0 && prop.name === owningMeta.discriminatorColumn;
153
+ return {
154
+ propName: prop.name,
155
+ fieldName: prop.fieldNames?.[0] ?? prop.name,
156
+ type: normalizeType(prop.type),
157
+ isPrimary: prop.primary === true,
158
+ isForeignKey: false,
159
+ isUnique: prop.unique === true,
160
+ isNullable: prop.nullable === true,
161
+ ...formulaExpr !== void 0 && { formula: formulaExpr },
162
+ ...embeddedIn !== void 0 && { embeddedIn },
163
+ ...isDiscriminator && { isDiscriminator: true }
164
+ };
165
+ }
166
+ if (prop.kind === ReferenceKind.MANY_TO_ONE || prop.kind === ReferenceKind.ONE_TO_ONE && prop.owner === true) {
167
+ const fkType = resolveFkType(prop.type, metaByClass);
168
+ return {
169
+ propName: prop.name,
170
+ fieldName: prop.fieldNames?.[0] ?? `${prop.name}_id`,
171
+ type: fkType,
172
+ isPrimary: false,
173
+ isForeignKey: true,
174
+ isUnique: prop.unique === true,
175
+ isNullable: prop.nullable === true
176
+ };
177
+ }
178
+ return null;
179
+ }
180
+ function resolveFormulaExpr(cb) {
181
+ try {
182
+ const cols = new Proxy({}, {
183
+ get: (_target, key) => typeof key === "string" ? key : ""
184
+ });
185
+ return cb(FORMULA_DUMMY_TABLE, cols);
186
+ } catch {
187
+ return "";
188
+ }
189
+ }
190
+ function resolveFkType(referencedClassName, metaByClass) {
191
+ const refMeta = metaByClass.get(referencedClassName);
192
+ if (!refMeta) return "integer";
193
+ const pkProp = Object.values(refMeta.properties).find((p) => p.primary === true);
194
+ return pkProp ? normalizeType(pkProp.type) : "integer";
195
+ }
196
+ function buildConstraints(meta) {
197
+ const result = [];
198
+ for (const idx of meta.indexes ?? []) {
199
+ const props = idx.properties;
200
+ result.push({
201
+ type: "index",
202
+ properties: Array.isArray(props) ? props.map(String) : props ? [String(props)] : [],
203
+ ...idx.name !== void 0 && { name: idx.name }
204
+ });
205
+ }
206
+ for (const uniq of meta.uniques ?? []) {
207
+ const props = uniq.properties;
208
+ result.push({
209
+ type: "unique",
210
+ properties: Array.isArray(props) ? props.map(String) : props ? [String(props)] : [],
211
+ ...uniq.name !== void 0 && { name: uniq.name }
212
+ });
213
+ }
214
+ for (const check of meta.checks ?? []) {
215
+ if (typeof check.expression !== "string") continue;
216
+ result.push({
217
+ type: "check",
218
+ properties: [],
219
+ expression: check.expression,
220
+ ...check.name !== void 0 && { name: check.name }
221
+ });
222
+ }
223
+ return result;
224
+ }
225
+ function buildRelationEdges(metas) {
226
+ const edges = [];
227
+ for (const meta of metas) {
228
+ if (meta.pivotTable || meta.embeddable) continue;
229
+ for (const prop of Object.values(meta.properties)) {
230
+ const edge = buildEdge(meta.className, prop);
231
+ if (edge !== null) edges.push(edge);
232
+ }
233
+ }
234
+ return edges;
235
+ }
236
+ function buildEdge(fromEntity, prop) {
237
+ const isNullable = prop.nullable === true;
238
+ if (prop.kind === ReferenceKind.MANY_TO_ONE) {
239
+ return {
240
+ fromEntity,
241
+ toEntity: prop.type,
242
+ fromCardinality: "}o",
243
+ toCardinality: isNullable ? "o|" : "||",
244
+ label: prop.name
245
+ };
246
+ }
247
+ if (prop.kind === ReferenceKind.ONE_TO_ONE && prop.owner === true) {
248
+ return {
249
+ fromEntity,
250
+ toEntity: prop.type,
251
+ fromCardinality: "||",
252
+ toCardinality: isNullable ? "o|" : "||",
253
+ label: prop.name
254
+ };
255
+ }
256
+ if (prop.kind === ReferenceKind.MANY_TO_MANY && prop.owner === true) {
257
+ return {
258
+ fromEntity,
259
+ toEntity: prop.type,
260
+ fromCardinality: "}o",
261
+ toCardinality: "o{",
262
+ label: prop.name
263
+ };
264
+ }
265
+ return null;
266
+ }
267
+ function renderErDiagram(model) {
268
+ const lines = ["erDiagram"];
269
+ for (const entity of model.entities) {
270
+ lines.push(` ${entity.className} {`);
271
+ for (const col of entity.columns) {
272
+ lines.push(` ${renderColumnLine(col)}`);
273
+ }
274
+ lines.push(" }");
275
+ }
276
+ for (const rel of model.relations) {
277
+ lines.push(
278
+ ` ${rel.fromEntity} ${rel.fromCardinality}--${rel.toCardinality} ${rel.toEntity} : "${rel.label}"`
279
+ );
280
+ }
281
+ return lines.join("\n");
282
+ }
283
+ function renderColumnLine(col) {
284
+ let qualifier = "";
285
+ if (col.isPrimary) qualifier = " PK";
286
+ else if (col.isForeignKey) qualifier = " FK";
287
+ else if (col.isUnique) qualifier = " UK";
288
+ let comment;
289
+ if (col.formula !== void 0) {
290
+ comment = col.formula ? `formula: ${col.formula}` : "formula";
291
+ } else if (col.isDiscriminator) {
292
+ comment = "discriminator";
293
+ } else if (col.embeddedIn !== void 0) {
294
+ comment = `[${col.embeddedIn}]`;
295
+ } else if (col.fieldName !== col.propName) {
296
+ comment = col.propName;
297
+ }
298
+ const commentStr = comment !== void 0 ? ` "${comment}"` : "";
299
+ return `${col.type} ${col.fieldName}${qualifier}${commentStr}`;
300
+ }
301
+ function normalizeType(type) {
302
+ return type.replace(/[^a-zA-Z0-9_]/g, "_");
303
+ }
304
+
305
+ // src/model/build.ts
306
+ function buildDocumentModel(metas, jsDocResult, title, description) {
307
+ const { entities: diagramEntities, relations: allRelations } = buildDiagramModel(metas);
308
+ const enrichedByClass = /* @__PURE__ */ new Map();
309
+ for (const model of diagramEntities) {
310
+ const jsDoc = jsDocResult.entities.get(model.className);
311
+ if (jsDoc?.hidden) continue;
312
+ const propDocs = jsDocResult.props.get(model.className) ?? /* @__PURE__ */ new Map();
313
+ enrichedByClass.set(model.className, { model, jsDoc, propDocs });
314
+ }
315
+ const groupNames = /* @__PURE__ */ new Set();
316
+ let anyUntagged = false;
317
+ for (const { jsDoc } of enrichedByClass.values()) {
318
+ const allNs = [
319
+ ...jsDoc?.namespaces ?? [],
320
+ ...jsDoc?.erdNamespaces ?? [],
321
+ ...jsDoc?.describeNamespaces ?? []
322
+ ];
323
+ if (allNs.length === 0) {
324
+ anyUntagged = true;
325
+ } else {
326
+ for (const ns of allNs) groupNames.add(ns);
327
+ }
328
+ }
329
+ if (anyUntagged) groupNames.add("default");
330
+ const groups = [];
331
+ for (const groupName of groupNames) {
332
+ const isDefault = groupName === "default";
333
+ const erdEntities = [...enrichedByClass.values()].filter(
334
+ ({ jsDoc }) => belongsToGroupForErd(jsDoc, groupName, isDefault)
335
+ );
336
+ const textEntities = [...enrichedByClass.values()].filter(
337
+ ({ jsDoc }) => belongsToGroupForText(jsDoc, groupName, isDefault)
338
+ );
339
+ const erdClassNames = new Set(erdEntities.map((e) => e.model.className));
340
+ const erdRelations = allRelations.filter(
341
+ (r) => erdClassNames.has(r.fromEntity) && erdClassNames.has(r.toEntity)
342
+ );
343
+ groups.push({ name: groupName, erdEntities, textEntities, erdRelations });
344
+ }
345
+ groups.sort((a, b) => {
346
+ if (a.name === "default") return 1;
347
+ if (b.name === "default") return -1;
348
+ return a.name.localeCompare(b.name);
349
+ });
350
+ return { title, groups, ...description !== void 0 && { description } };
351
+ }
352
+ function hasNoNamespaceTags(jsDoc) {
353
+ if (!jsDoc) return true;
354
+ return jsDoc.namespaces.length === 0 && jsDoc.erdNamespaces.length === 0 && jsDoc.describeNamespaces.length === 0;
355
+ }
356
+ function belongsToGroupForErd(jsDoc, groupName, isDefault) {
357
+ if (isDefault) return hasNoNamespaceTags(jsDoc);
358
+ if (!jsDoc) return false;
359
+ return jsDoc.namespaces.includes(groupName) || jsDoc.erdNamespaces.includes(groupName);
360
+ }
361
+ function belongsToGroupForText(jsDoc, groupName, isDefault) {
362
+ if (isDefault) return hasNoNamespaceTags(jsDoc);
363
+ if (!jsDoc) return false;
364
+ return jsDoc.namespaces.includes(groupName) || jsDoc.describeNamespaces.includes(groupName);
365
+ }
366
+
367
+ // src/render/markdown.ts
368
+ function renderMarkdown(docModel) {
369
+ const sections = [`# ${docModel.title}`];
370
+ if (docModel.description) {
371
+ sections.push(docModel.description);
372
+ }
373
+ for (const group of docModel.groups) {
374
+ sections.push(renderGroupSection(group));
375
+ }
376
+ return sections.join("\n\n");
377
+ }
378
+ function renderGroupSection(group) {
379
+ const parts = [`## ${group.name}`];
380
+ if (group.erdEntities.length > 0) {
381
+ const diagramModel = {
382
+ entities: group.erdEntities.map((e) => e.model),
383
+ relations: group.erdRelations
384
+ };
385
+ parts.push("```mermaid\n" + renderErDiagram(diagramModel) + "\n```");
386
+ }
387
+ for (const entity of group.textEntities) {
388
+ parts.push(renderEntitySection(entity));
389
+ }
390
+ return parts.join("\n\n");
391
+ }
392
+ function renderEntitySection(entity) {
393
+ const parts = [`### ${entity.model.className}`];
394
+ if (entity.jsDoc?.description) {
395
+ parts.push(`> ${entity.jsDoc.description}`);
396
+ }
397
+ if (entity.model.discriminatorColumn) {
398
+ parts.push(
399
+ `*STI root \u2014 discriminator column: \`${entity.model.discriminatorColumn}\`*`
400
+ );
401
+ } else if (entity.model.extendsEntity) {
402
+ parts.push(`*Extends \`${entity.model.extendsEntity}\` (Single Table Inheritance)*`);
403
+ }
404
+ if (entity.model.columns.length > 0) {
405
+ parts.push(renderColumnTable(entity));
406
+ }
407
+ if (entity.model.constraints.length > 0) {
408
+ parts.push(renderConstraints(entity.model.constraints));
409
+ }
410
+ return parts.join("\n\n");
411
+ }
412
+ function renderColumnTable(entity) {
413
+ const header = "| Column | Type | Key | Nullable | Description |";
414
+ const sep = "|--------|------|-----|----------|-------------|";
415
+ const rows = entity.model.columns.map((col) => {
416
+ const key = resolveColumnKey(col);
417
+ const nullable = col.isNullable && !col.isPrimary ? "Y" : "";
418
+ const desc = entity.propDocs.get(col.propName)?.description ?? "";
419
+ return `| ${col.fieldName} | ${col.type} | ${key} | ${nullable} | ${desc} |`;
420
+ });
421
+ return [header, sep, ...rows].join("\n");
422
+ }
423
+ function resolveColumnKey(col) {
424
+ if (col.isPrimary) return "PK";
425
+ if (col.isForeignKey) {
426
+ return col.fieldName !== col.propName ? `FK (${col.propName})` : "FK";
427
+ }
428
+ if (col.isUnique) return "UK";
429
+ if (col.formula !== void 0) return `formula: ${col.formula}`;
430
+ if (col.isDiscriminator) return "discriminator";
431
+ if (col.embeddedIn !== void 0) return `[${col.embeddedIn}]`;
432
+ return "";
433
+ }
434
+ function renderConstraints(constraints) {
435
+ const lines = ["**Constraints:**", ""];
436
+ for (const c of constraints) {
437
+ const name = c.name ? ` \`${c.name}\`` : "";
438
+ if (c.type === "index") {
439
+ lines.push(`- Index${name}: (${c.properties.join(", ")})`);
440
+ } else if (c.type === "unique") {
441
+ lines.push(`- Unique${name}: (${c.properties.join(", ")})`);
442
+ } else if (c.type === "check") {
443
+ lines.push(`- Check${name}: \`${c.expression ?? ""}\``);
444
+ }
445
+ }
446
+ return lines.join("\n");
447
+ }
448
+
449
+ // src/index.ts
450
+ async function generateMarkdown(options) {
451
+ const { orm, title = "Database Schema", description, src = [] } = options;
452
+ const metas = await loadEntityMetadata(orm);
453
+ const jsDocResult = loadJsDoc(src);
454
+ const docModel = buildDocumentModel(metas, jsDocResult, title, description);
455
+ return renderMarkdown(docModel);
456
+ }
457
+ export {
458
+ MetadataLoadError,
459
+ generateMarkdown
460
+ };
461
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/docs/jsdoc.ts","../src/metadata/load.ts","../src/render/mermaid.ts","../src/model/build.ts","../src/render/markdown.ts","../src/index.ts"],"sourcesContent":["import type { JSDoc } from 'ts-morph';\nimport { Project } from 'ts-morph';\n\n/** JSDoc information extracted from an entity class. */\nexport interface EntityJsDocInfo {\n /** Class-level description (text before any @tags). */\n description?: string;\n /** Namespaces from @namespace tags — appears in both ERD and text table. */\n namespaces: string[];\n /** Namespaces from @erd tags — appears in ERD only. */\n erdNamespaces: string[];\n /** Namespaces from @describe tags — appears in text table only. */\n describeNamespaces: string[];\n /** True when @hidden tag is present — entity is excluded from all output. */\n hidden: boolean;\n}\n\n/** JSDoc information extracted from a single entity property. */\nexport interface PropJsDocInfo {\n /** Property description text. */\n description?: string;\n}\n\n/** Keyed by entity class name. */\nexport type EntityJsDocMap = Map<string, EntityJsDocInfo>;\n\n/** Outer key: entity class name. Inner key: property name. */\nexport type PropJsDocMap = Map<string, Map<string, PropJsDocInfo>>;\n\nexport interface JsDocResult {\n entities: EntityJsDocMap;\n props: PropJsDocMap;\n}\n\n/**\n * Parses TypeScript source files matched by the provided globs and extracts\n * JSDoc descriptions and custom tags (@namespace, @erd, @describe, @hidden)\n * from entity classes and their properties.\n *\n * Returns empty maps if no source files are matched or no JSDoc is found.\n * Never throws — errors are silently ignored so missing docs don't block generation.\n */\nexport function loadJsDoc(srcGlobs: string[]): JsDocResult {\n const entities: EntityJsDocMap = new Map();\n const props: PropJsDocMap = new Map();\n\n if (srcGlobs.length === 0) return { entities, props };\n\n const project = new Project({\n skipAddingFilesFromTsConfig: true,\n skipLoadingLibFiles: true,\n compilerOptions: {\n experimentalDecorators: true,\n skipLibCheck: true,\n },\n });\n\n project.addSourceFilesAtPaths(srcGlobs);\n\n for (const sourceFile of project.getSourceFiles()) {\n for (const cls of sourceFile.getClasses()) {\n const className = cls.getName();\n if (!className) continue;\n\n const classDocs = cls.getJsDocs();\n if (classDocs.length > 0) {\n entities.set(className, parseEntityJsDoc(classDocs));\n }\n\n const propMap = new Map<string, PropJsDocInfo>();\n for (const prop of cls.getProperties()) {\n const propDocs = prop.getJsDocs();\n if (propDocs.length === 0) continue;\n const desc = extractDescription(propDocs);\n if (desc !== undefined) {\n propMap.set(prop.getName(), { description: desc });\n }\n }\n if (propMap.size > 0) {\n props.set(className, propMap);\n }\n }\n }\n\n return { entities, props };\n}\n\nfunction parseEntityJsDoc(jsDocs: JSDoc[]): EntityJsDocInfo {\n const namespaces: string[] = [];\n const erdNamespaces: string[] = [];\n const describeNamespaces: string[] = [];\n let hidden = false;\n let description: string | undefined;\n\n for (const doc of jsDocs) {\n const desc = doc.getDescription().trim();\n if (desc && description === undefined) description = desc;\n\n for (const tag of doc.getTags()) {\n const tagName = tag.getTagName();\n const comment = tag.getCommentText()?.trim();\n\n if (tagName === 'namespace' && comment) namespaces.push(comment);\n else if (tagName === 'erd' && comment) erdNamespaces.push(comment);\n else if (tagName === 'describe' && comment) describeNamespaces.push(comment);\n else if (tagName === 'hidden') hidden = true;\n }\n }\n\n return {\n ...(description !== undefined && { description }),\n namespaces,\n erdNamespaces,\n describeNamespaces,\n hidden,\n };\n}\n\nfunction extractDescription(jsDocs: JSDoc[]): string | undefined {\n for (const doc of jsDocs) {\n const desc = doc.getDescription().trim();\n if (desc) return desc;\n }\n return undefined;\n}\n","import { MikroORM } from '@mikro-orm/core';\nimport type { EntityMetadata, Options } from '@mikro-orm/core';\n\n/** Errors thrown during metadata loading */\nexport class MetadataLoadError extends Error {\n constructor(\n message: string,\n public override readonly cause?: unknown,\n ) {\n super(message);\n this.name = 'MetadataLoadError';\n }\n}\n\n/**\n * Runs MikroORM entity discovery without connecting to the database,\n * and returns all discovered EntityMetadata objects.\n *\n * The caller is responsible for filtering (e.g. excluding abstract,\n * embeddable, or pivot entities) based on rendering needs.\n */\nexport async function loadEntityMetadata(options: Options): Promise<EntityMetadata[]> {\n let orm: MikroORM | undefined;\n\n try {\n orm = await MikroORM.init({\n ...options,\n debug: false,\n });\n } catch (cause) {\n throw new MetadataLoadError(\n 'Failed to initialize MikroORM and run entity discovery. ' +\n 'Make sure your config is valid and all entity files are accessible.',\n cause,\n );\n }\n\n try {\n const all = Object.values(orm.getMetadata().getAll());\n\n if (all.length === 0) {\n throw new MetadataLoadError(\n 'No entities were discovered. ' +\n 'Check that your config specifies at least one entity path or class.',\n );\n }\n\n return all;\n } finally {\n await orm.close(true);\n }\n}\n","import { ReferenceKind } from '@mikro-orm/core';\nimport type { EntityMetadata, EntityProperty, FormulaTable } from '@mikro-orm/core';\nimport type {\n ColumnModel,\n ConstraintModel,\n DiagramModel,\n EntityModel,\n RelationEdge,\n} from '../model/types.js';\n\n// Dummy table descriptor used when resolving formula expressions for documentation.\n// String-based formulas ignore both arguments; function-based formulas use the alias.\nconst FORMULA_DUMMY_TABLE: FormulaTable = {\n alias: 'e0',\n name: '',\n qualifiedName: '',\n toString: () => 'e0',\n};\n\n/**\n * Converts raw MikroORM EntityMetadata array into a DiagramModel.\n *\n * Excluded from entity boxes:\n * - Pivot tables (auto-generated M:N join tables) — represented as edges\n * - @Embeddable classes — their columns appear inline inside the owning entity\n */\nexport function buildDiagramModel(metas: EntityMetadata[]): DiagramModel {\n const metaByClass = new Map(metas.map((m) => [m.className, m]));\n\n const entities: EntityModel[] = metas\n .filter((meta) => !meta.pivotTable && !meta.embeddable)\n .map((meta) => buildEntityModel(meta, metaByClass));\n\n const relations: RelationEdge[] = buildRelationEdges(metas);\n\n return { entities, relations };\n}\n\nfunction buildEntityModel(\n meta: EntityMetadata,\n metaByClass: Map<string, EntityMetadata>,\n): EntityModel {\n // STI root: has discriminatorColumn, no discriminatorValue of its own.\n // Its properties list includes all child-only columns (marked inherited=true) — filter them out.\n const isStiRoot = meta.discriminatorColumn !== undefined && !meta.discriminatorValue;\n const isStiChild = Boolean(meta.extends) && meta.discriminatorValue !== undefined;\n\n const columns: ColumnModel[] = [];\n for (const prop of Object.values(meta.properties)) {\n if (isStiRoot && prop.inherited === true) continue;\n const col = buildColumn(prop, metaByClass, meta);\n if (col !== null) columns.push(col);\n }\n\n return {\n className: meta.className,\n tableName: meta.tableName,\n columns,\n isPivot: false,\n isEmbeddable: meta.embeddable === true,\n ...(isStiRoot && { discriminatorColumn: meta.discriminatorColumn as string }),\n ...(isStiChild && { extendsEntity: meta.extends }),\n constraints: buildConstraints(meta),\n };\n}\n\n/** Returns a ColumnModel for renderable properties, or null to skip. */\nfunction buildColumn(\n prop: EntityProperty,\n metaByClass: Map<string, EntityMetadata>,\n owningMeta: EntityMetadata,\n): ColumnModel | null {\n // Skip the EMBEDDED group reference — individual flat columns appear as SCALAR entries\n if (prop.kind === ReferenceKind.EMBEDDED) return null;\n\n if (prop.kind === ReferenceKind.SCALAR) {\n // For @Formula columns, formula is set on a SCALAR-kinded property\n const formulaExpr: string | undefined = prop.formula !== undefined\n ? resolveFormulaExpr(prop.formula as (table: FormulaTable, cols: Record<string, string>) => string)\n : undefined;\n\n // Flat embedded columns carry `embedded: [ownerPropName, embeddedPropName]`\n let embeddedIn: string | undefined;\n if (prop.embedded !== undefined) {\n const parentPropName = prop.embedded[0];\n embeddedIn = owningMeta.properties[parentPropName]?.type;\n }\n\n const isDiscriminator =\n owningMeta.discriminatorColumn !== undefined &&\n prop.name === owningMeta.discriminatorColumn;\n\n return {\n propName: prop.name,\n fieldName: prop.fieldNames?.[0] ?? prop.name,\n type: normalizeType(prop.type),\n isPrimary: prop.primary === true,\n isForeignKey: false,\n isUnique: prop.unique === true,\n isNullable: prop.nullable === true,\n ...(formulaExpr !== undefined && { formula: formulaExpr }),\n ...(embeddedIn !== undefined && { embeddedIn }),\n ...(isDiscriminator && { isDiscriminator: true }),\n };\n }\n\n // FK columns: m:1 always owns the FK; 1:1 only when owner === true\n if (\n prop.kind === ReferenceKind.MANY_TO_ONE ||\n (prop.kind === ReferenceKind.ONE_TO_ONE && prop.owner === true)\n ) {\n const fkType = resolveFkType(prop.type, metaByClass);\n return {\n propName: prop.name,\n fieldName: prop.fieldNames?.[0] ?? `${prop.name}_id`,\n type: fkType,\n isPrimary: false,\n isForeignKey: true,\n isUnique: prop.unique === true,\n isNullable: prop.nullable === true,\n };\n }\n\n // ONE_TO_MANY, MANY_TO_MANY (both owner and inverse) → no physical column\n return null;\n}\n\n/**\n * Calls the FormulaCallback with a dummy table and column proxy to extract the SQL expression.\n * String-based formulas (most common) ignore their arguments and return the literal string.\n * Function-based formulas use the alias/column names from the dummy objects.\n * Returns empty string on unexpected errors.\n */\nfunction resolveFormulaExpr(\n cb: (table: FormulaTable, cols: Record<string, string>) => string,\n): string {\n try {\n const cols = new Proxy({}, {\n get: (_target, key: string | symbol) => (typeof key === 'string' ? key : ''),\n });\n return cb(FORMULA_DUMMY_TABLE, cols);\n } catch {\n return '';\n }\n}\n\n/** Looks up the PK type of the referenced entity to use as FK column type. */\nfunction resolveFkType(\n referencedClassName: string,\n metaByClass: Map<string, EntityMetadata>,\n): string {\n const refMeta = metaByClass.get(referencedClassName);\n if (!refMeta) return 'integer';\n const pkProp = Object.values(refMeta.properties).find((p) => p.primary === true);\n return pkProp ? normalizeType(pkProp.type) : 'integer';\n}\n\n/** Collects indexes, unique constraints, and check constraints from entity-level metadata. */\nfunction buildConstraints(meta: EntityMetadata): ConstraintModel[] {\n const result: ConstraintModel[] = [];\n\n for (const idx of meta.indexes ?? []) {\n const props = idx.properties;\n result.push({\n type: 'index',\n properties: Array.isArray(props) ? props.map(String) : props ? [String(props)] : [],\n ...(idx.name !== undefined && { name: idx.name }),\n });\n }\n\n for (const uniq of meta.uniques ?? []) {\n const props = uniq.properties;\n result.push({\n type: 'unique',\n properties: Array.isArray(props) ? props.map(String) : props ? [String(props)] : [],\n ...(uniq.name !== undefined && { name: uniq.name }),\n });\n }\n\n for (const check of meta.checks ?? []) {\n // Skip function-based check expressions (they require column reference objects at runtime)\n if (typeof check.expression !== 'string') continue;\n result.push({\n type: 'check',\n properties: [],\n expression: check.expression,\n ...(check.name !== undefined && { name: check.name }),\n });\n }\n\n return result;\n}\n\n/** Builds edges only from owning sides to avoid duplicate arrows. Includes STI inheritance. */\nfunction buildRelationEdges(metas: EntityMetadata[]): RelationEdge[] {\n const edges: RelationEdge[] = [];\n\n for (const meta of metas) {\n if (meta.pivotTable || meta.embeddable) continue;\n\n for (const prop of Object.values(meta.properties)) {\n const edge = buildEdge(meta.className, prop);\n if (edge !== null) edges.push(edge);\n }\n\n }\n\n return edges;\n}\n\nfunction buildEdge(fromEntity: string, prop: EntityProperty): RelationEdge | null {\n const isNullable = prop.nullable === true;\n\n if (prop.kind === ReferenceKind.MANY_TO_ONE) {\n return {\n fromEntity,\n toEntity: prop.type,\n fromCardinality: '}o',\n toCardinality: isNullable ? 'o|' : '||',\n label: prop.name,\n };\n }\n\n if (prop.kind === ReferenceKind.ONE_TO_ONE && prop.owner === true) {\n return {\n fromEntity,\n toEntity: prop.type,\n fromCardinality: '||',\n toCardinality: isNullable ? 'o|' : '||',\n label: prop.name,\n };\n }\n\n if (prop.kind === ReferenceKind.MANY_TO_MANY && prop.owner === true) {\n return {\n fromEntity,\n toEntity: prop.type,\n fromCardinality: '}o',\n toCardinality: 'o{',\n label: prop.name,\n };\n }\n\n return null;\n}\n\n/**\n * Renders a DiagramModel as a Mermaid erDiagram block string.\n * The returned string starts with \"erDiagram\" and is ready to embed in a\n * markdown code fence.\n */\nexport function renderErDiagram(model: DiagramModel): string {\n const lines: string[] = ['erDiagram'];\n\n for (const entity of model.entities) {\n lines.push(` ${entity.className} {`);\n for (const col of entity.columns) {\n lines.push(` ${renderColumnLine(col)}`);\n }\n lines.push(' }');\n }\n\n for (const rel of model.relations) {\n lines.push(\n ` ${rel.fromEntity} ${rel.fromCardinality}--${rel.toCardinality} ${rel.toEntity} : \"${rel.label}\"`,\n );\n }\n\n return lines.join('\\n');\n}\n\nfunction renderColumnLine(col: ColumnModel): string {\n // Priority: PK > FK > UK\n let qualifier = '';\n if (col.isPrimary) qualifier = ' PK';\n else if (col.isForeignKey) qualifier = ' FK';\n else if (col.isUnique) qualifier = ' UK';\n\n // Comment priority (v1 differentiators over prisma-markdown):\n // 1. @Formula SQL expression — \"formula: LENGTH(name)\"\n // 2. STI discriminator column — \"discriminator\"\n // 3. Embedded source type — \"[Address]\"\n // 4. DB/TS name mismatch — \"<tsPropName>\"\n let comment: string | undefined;\n if (col.formula !== undefined) {\n comment = col.formula ? `formula: ${col.formula}` : 'formula';\n } else if (col.isDiscriminator) {\n comment = 'discriminator';\n } else if (col.embeddedIn !== undefined) {\n comment = `[${col.embeddedIn}]`;\n } else if (col.fieldName !== col.propName) {\n comment = col.propName;\n }\n\n const commentStr = comment !== undefined ? ` \"${comment}\"` : '';\n return `${col.type} ${col.fieldName}${qualifier}${commentStr}`;\n}\n\n/** Strips characters that are invalid in Mermaid type identifiers. */\nfunction normalizeType(type: string): string {\n return type.replace(/[^a-zA-Z0-9_]/g, '_');\n}\n","import type { EntityMetadata } from '@mikro-orm/core';\nimport type { EntityJsDocInfo, JsDocResult, PropJsDocInfo } from '../docs/jsdoc.js';\nimport type { EntityModel, RelationEdge } from './types.js';\nimport { buildDiagramModel } from '../render/mermaid.js';\n\n/** An entity with its structural model and JSDoc info merged together. */\nexport interface EnrichedEntity {\n model: EntityModel;\n /** Undefined if the entity has no class-level JSDoc. */\n jsDoc: EntityJsDocInfo | undefined;\n /** Per-property description map (empty map if no property JSDoc). */\n propDocs: Map<string, PropJsDocInfo>;\n}\n\n/**\n * A single namespace group, ready to render as one section of the document.\n *\n * - `erdEntities`: shown in the Mermaid ERD block (@namespace + @erd)\n * - `textEntities`: shown in the column-table sections (@namespace + @describe)\n * - `erdRelations`: relation edges where both endpoints are in `erdEntities`\n */\nexport interface NamespaceGroup {\n name: string;\n erdEntities: EnrichedEntity[];\n textEntities: EnrichedEntity[];\n erdRelations: RelationEdge[];\n}\n\n/** Complete document model — input to the markdown renderer. */\nexport interface DocumentModel {\n title: string;\n /** Optional paragraph rendered below the H1 heading. */\n description?: string;\n groups: NamespaceGroup[];\n}\n\n/**\n * Merges MikroORM structural metadata with JSDoc information and organises the\n * result into namespace groups for rendering.\n *\n * Entities with @hidden are excluded.\n * Entities with no namespace tags fall into the \"default\" group.\n * Groups are ordered alphabetically, with \"default\" always last.\n */\nexport function buildDocumentModel(\n metas: EntityMetadata[],\n jsDocResult: JsDocResult,\n title: string,\n description?: string,\n): DocumentModel {\n const { entities: diagramEntities, relations: allRelations } = buildDiagramModel(metas);\n\n // Build enriched entity map, filtering out @hidden entities.\n const enrichedByClass = new Map<string, EnrichedEntity>();\n for (const model of diagramEntities) {\n const jsDoc = jsDocResult.entities.get(model.className);\n if (jsDoc?.hidden) continue;\n const propDocs = jsDocResult.props.get(model.className) ?? new Map<string, PropJsDocInfo>();\n enrichedByClass.set(model.className, { model, jsDoc, propDocs });\n }\n\n // Collect all unique namespace names referenced by any entity.\n const groupNames = new Set<string>();\n let anyUntagged = false;\n for (const { jsDoc } of enrichedByClass.values()) {\n const allNs = [\n ...(jsDoc?.namespaces ?? []),\n ...(jsDoc?.erdNamespaces ?? []),\n ...(jsDoc?.describeNamespaces ?? []),\n ];\n if (allNs.length === 0) {\n anyUntagged = true;\n } else {\n for (const ns of allNs) groupNames.add(ns);\n }\n }\n if (anyUntagged) groupNames.add('default');\n\n const groups: NamespaceGroup[] = [];\n for (const groupName of groupNames) {\n const isDefault = groupName === 'default';\n\n const erdEntities = [...enrichedByClass.values()].filter(({ jsDoc }) =>\n belongsToGroupForErd(jsDoc, groupName, isDefault),\n );\n\n const textEntities = [...enrichedByClass.values()].filter(({ jsDoc }) =>\n belongsToGroupForText(jsDoc, groupName, isDefault),\n );\n\n const erdClassNames = new Set(erdEntities.map((e) => e.model.className));\n const erdRelations = allRelations.filter(\n (r) => erdClassNames.has(r.fromEntity) && erdClassNames.has(r.toEntity),\n );\n\n groups.push({ name: groupName, erdEntities, textEntities, erdRelations });\n }\n\n // Sort alphabetically; \"default\" is always last.\n groups.sort((a, b) => {\n if (a.name === 'default') return 1;\n if (b.name === 'default') return -1;\n return a.name.localeCompare(b.name);\n });\n\n return { title, groups, ...(description !== undefined && { description }) };\n}\n\nfunction hasNoNamespaceTags(jsDoc: EntityJsDocInfo | undefined): boolean {\n if (!jsDoc) return true;\n return (\n jsDoc.namespaces.length === 0 &&\n jsDoc.erdNamespaces.length === 0 &&\n jsDoc.describeNamespaces.length === 0\n );\n}\n\nfunction belongsToGroupForErd(\n jsDoc: EntityJsDocInfo | undefined,\n groupName: string,\n isDefault: boolean,\n): boolean {\n if (isDefault) return hasNoNamespaceTags(jsDoc);\n if (!jsDoc) return false;\n return jsDoc.namespaces.includes(groupName) || jsDoc.erdNamespaces.includes(groupName);\n}\n\nfunction belongsToGroupForText(\n jsDoc: EntityJsDocInfo | undefined,\n groupName: string,\n isDefault: boolean,\n): boolean {\n if (isDefault) return hasNoNamespaceTags(jsDoc);\n if (!jsDoc) return false;\n return jsDoc.namespaces.includes(groupName) || jsDoc.describeNamespaces.includes(groupName);\n}\n","import type { EnrichedEntity, DocumentModel, NamespaceGroup } from '../model/build.js';\nimport type { ColumnModel, ConstraintModel, DiagramModel } from '../model/types.js';\nimport { renderErDiagram } from './mermaid.js';\n\n/**\n * Renders a DocumentModel as a markdown string.\n * Each namespace group becomes a level-2 section with a Mermaid ERD block\n * followed by per-entity column tables.\n */\nexport function renderMarkdown(docModel: DocumentModel): string {\n const sections: string[] = [`# ${docModel.title}`];\n\n if (docModel.description) {\n sections.push(docModel.description);\n }\n\n for (const group of docModel.groups) {\n sections.push(renderGroupSection(group));\n }\n\n return sections.join('\\n\\n');\n}\n\nfunction renderGroupSection(group: NamespaceGroup): string {\n const parts: string[] = [`## ${group.name}`];\n\n if (group.erdEntities.length > 0) {\n const diagramModel: DiagramModel = {\n entities: group.erdEntities.map((e) => e.model),\n relations: group.erdRelations,\n };\n parts.push('```mermaid\\n' + renderErDiagram(diagramModel) + '\\n```');\n }\n\n for (const entity of group.textEntities) {\n parts.push(renderEntitySection(entity));\n }\n\n return parts.join('\\n\\n');\n}\n\nfunction renderEntitySection(entity: EnrichedEntity): string {\n const parts: string[] = [`### ${entity.model.className}`];\n\n if (entity.jsDoc?.description) {\n parts.push(`> ${entity.jsDoc.description}`);\n }\n\n // STI metadata note\n if (entity.model.discriminatorColumn) {\n parts.push(\n `*STI root — discriminator column: \\`${entity.model.discriminatorColumn}\\`*`,\n );\n } else if (entity.model.extendsEntity) {\n parts.push(`*Extends \\`${entity.model.extendsEntity}\\` (Single Table Inheritance)*`);\n }\n\n if (entity.model.columns.length > 0) {\n parts.push(renderColumnTable(entity));\n }\n\n if (entity.model.constraints.length > 0) {\n parts.push(renderConstraints(entity.model.constraints));\n }\n\n return parts.join('\\n\\n');\n}\n\nfunction renderColumnTable(entity: EnrichedEntity): string {\n const header = '| Column | Type | Key | Nullable | Description |';\n const sep = '|--------|------|-----|----------|-------------|';\n const rows = entity.model.columns.map((col) => {\n const key = resolveColumnKey(col);\n const nullable = col.isNullable && !col.isPrimary ? 'Y' : '';\n const desc = entity.propDocs.get(col.propName)?.description ?? '';\n return `| ${col.fieldName} | ${col.type} | ${key} | ${nullable} | ${desc} |`;\n });\n return [header, sep, ...rows].join('\\n');\n}\n\n/** Returns the \"Key\" cell value for the column table. */\nfunction resolveColumnKey(col: ColumnModel): string {\n if (col.isPrimary) return 'PK';\n if (col.isForeignKey) {\n // Show TS property name in parentheses if it differs from the DB column name\n return col.fieldName !== col.propName ? `FK (${col.propName})` : 'FK';\n }\n if (col.isUnique) return 'UK';\n if (col.formula !== undefined) return `formula: ${col.formula}`;\n if (col.isDiscriminator) return 'discriminator';\n if (col.embeddedIn !== undefined) return `[${col.embeddedIn}]`;\n return '';\n}\n\n\nfunction renderConstraints(constraints: ConstraintModel[]): string {\n const lines = ['**Constraints:**', ''];\n for (const c of constraints) {\n const name = c.name ? ` \\`${c.name}\\`` : '';\n if (c.type === 'index') {\n lines.push(`- Index${name}: (${c.properties.join(', ')})`);\n } else if (c.type === 'unique') {\n lines.push(`- Unique${name}: (${c.properties.join(', ')})`);\n } else if (c.type === 'check') {\n lines.push(`- Check${name}: \\`${c.expression ?? ''}\\``);\n }\n }\n return lines.join('\\n');\n}\n","import type { Options } from '@mikro-orm/core';\nimport { loadJsDoc } from './docs/jsdoc.js';\nimport { loadEntityMetadata } from './metadata/load.js';\nimport { buildDocumentModel } from './model/build.js';\nimport { renderMarkdown } from './render/markdown.js';\n\nexport type { GenerateOptions } from './model/types.js';\nexport { MetadataLoadError } from './metadata/load.js';\n\n/** Options for the programmatic API. */\nexport interface GenerateMarkdownOptions {\n /** MikroORM configuration (driver, entities, dbName, …). */\n orm: Options;\n /** Title shown as the H1 heading in the generated document. */\n title?: string;\n /** Optional description paragraph rendered below the H1 heading. */\n description?: string;\n /**\n * Glob patterns for TypeScript entity source files.\n * Used for JSDoc extraction (@namespace, @hidden, descriptions).\n * Omit to skip JSDoc parsing — all entities go into the \"default\" section.\n */\n src?: string[];\n}\n\n/**\n * Generates a Mermaid ERD + markdown documentation document from MikroORM\n * entity metadata.\n *\n * @example\n * ```ts\n * import { generateMarkdown } from 'mikro-orm-markdown';\n * import ormConfig from './mikro-orm.config.js';\n *\n * const markdown = await generateMarkdown({\n * orm: ormConfig,\n * title: 'My Database',\n * src: ['src/entities/*.ts'],\n * });\n * ```\n */\nexport async function generateMarkdown(options: GenerateMarkdownOptions): Promise<string> {\n const { orm, title = 'Database Schema', description, src = [] } = options;\n\n const metas = await loadEntityMetadata(orm);\n const jsDocResult = loadJsDoc(src);\n const docModel = buildDocumentModel(metas, jsDocResult, title, description);\n return renderMarkdown(docModel);\n}\n"],"mappings":";AACA,SAAS,eAAe;AAyCjB,SAAS,UAAU,UAAiC;AACzD,QAAM,WAA2B,oBAAI,IAAI;AACzC,QAAM,QAAsB,oBAAI,IAAI;AAEpC,MAAI,SAAS,WAAW,EAAG,QAAO,EAAE,UAAU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IAAI,CAAC,GAAG;AAAA,IAC3D,WAAW,EAAE,SAAS,UAAU;AAC9B,YAAM,KAAK,WAAW,IAAI,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG;AAAA,IAC5D,WAAW,EAAE,SAAS,SAAS;AAC7B,YAAM,KAAK,UAAU,IAAI,OAAO,EAAE,cAAc,EAAE,IAAI;AAAA,IACxD;AAAA,EACF;AACA,SAAO,MAAM,KAAK,IAAI;AACxB;;;ACnEA,eAAsB,iBAAiB,SAAmD;AACxF,QAAM,EAAE,KAAK,QAAQ,mBAAmB,aAAa,MAAM,CAAC,EAAE,IAAI;AAElE,QAAM,QAAQ,MAAM,mBAAmB,GAAG;AAC1C,QAAM,cAAc,UAAU,GAAG;AACjC,QAAM,WAAW,mBAAmB,OAAO,aAAa,OAAO,WAAW;AAC1E,SAAO,eAAe,QAAQ;AAChC;","names":[]}
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "mikro-orm-markdown",
3
+ "version": "0.1.0-alpha.1",
4
+ "description": "Generate Mermaid ERD and Markdown documentation from MikroORM entities",
5
+ "keywords": [
6
+ "mikro-orm",
7
+ "erd",
8
+ "mermaid",
9
+ "markdown",
10
+ "documentation",
11
+ "entity",
12
+ "database"
13
+ ],
14
+ "author": "iamkanguk97 (https://github.com/iamkanguk97)",
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/iamkanguk97/mikro-orm-markdown.git"
19
+ },
20
+ "engines": {
21
+ "node": ">=18.0.0"
22
+ },
23
+ "type": "module",
24
+ "main": "./dist/index.cjs",
25
+ "module": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.js",
31
+ "require": "./dist/index.cjs"
32
+ }
33
+ },
34
+ "bin": {
35
+ "mikro-orm-markdown": "dist/cli.js"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "README.md",
40
+ "LICENSE",
41
+ "CHANGELOG.md"
42
+ ],
43
+ "scripts": {
44
+ "build": "tsup",
45
+ "dev": "tsup --watch",
46
+ "typecheck": "tsc --project tsconfig.test.json --noEmit",
47
+ "lint": "eslint src test",
48
+ "lint:fix": "eslint src test --fix",
49
+ "format": "prettier --write .",
50
+ "format:check": "prettier --check .",
51
+ "test": "vitest run",
52
+ "test:watch": "vitest",
53
+ "test:coverage": "vitest run --coverage",
54
+ "prepublishOnly": "npm run lint && npm run typecheck && npm run test && npm run build"
55
+ },
56
+ "peerDependencies": {
57
+ "@mikro-orm/core": ">=6.0.0"
58
+ },
59
+ "dependencies": {
60
+ "commander": "^12.0.0",
61
+ "ts-morph": "^23.0.0"
62
+ },
63
+ "devDependencies": {
64
+ "@mikro-orm/core": "^6.0.0",
65
+ "@mikro-orm/sqlite": "^6.0.0",
66
+ "@types/node": "^22.0.0",
67
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
68
+ "@typescript-eslint/parser": "^8.0.0",
69
+ "@vitest/coverage-v8": "^2.0.0",
70
+ "eslint": "^9.0.0",
71
+ "eslint-config-prettier": "^9.0.0",
72
+ "prettier": "^3.0.0",
73
+ "tsup": "^8.0.0",
74
+ "tsx": "^4.22.4",
75
+ "typescript": "^5.5.0",
76
+ "vitest": "^2.0.0"
77
+ }
78
+ }