@nonsoo/prisma-mermaid 0.1.0 → 0.1.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/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Prisma to Mermaid Generator
|
|
2
2
|
|
|
3
|
-
Generate Mermaid class diagrams and Mermaid ERD diagrams directly from your Prisma schema. This package exposes a Prisma generator that runs during `prisma generate` as well as two
|
|
3
|
+
Generate Mermaid class diagrams and Mermaid ERD diagrams directly from your Prisma schema. This package exposes a Prisma generator that runs during `prisma generate` as well as two helpers functions -- generateMermaidClass and generateMermaidERD.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ npm i --save-dev @nonsoo/prisma-mermaid @mermaid-js/mermaid-cli
|
|
|
10
10
|
|
|
11
11
|
## Usage (Prisma Generator)
|
|
12
12
|
|
|
13
|
-
Add the following generator to your prisma schema
|
|
13
|
+
Add the following generator to your prisma schema and run `npx prisma generate` in your terminal.
|
|
14
14
|
|
|
15
15
|
```prisma
|
|
16
16
|
generator diagram {
|
|
@@ -20,9 +20,17 @@ generator diagram {
|
|
|
20
20
|
}
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
`
|
|
23
|
+
Once Mermaid files `.mmd` are generated you can use the mermaid cli to render the file as an SVG, PNG, embed it in Markdown, etc.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Run the the following command to generate SVG
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx mmdc -i <path/input-file>.mmd -o <path/output-file>.svg
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Format options
|
|
32
|
+
|
|
33
|
+
| Format Value | Description |
|
|
26
34
|
| ------------- | --------------------------------- |
|
|
27
35
|
| mermaid-erd | Generates a Mermaid ERD diagram |
|
|
28
36
|
| mermaid-class | Generates a Mermaid class diagram |
|
|
@@ -56,10 +64,10 @@ await generateMermaidERD({
|
|
|
56
64
|
});
|
|
57
65
|
```
|
|
58
66
|
|
|
59
|
-
##
|
|
67
|
+
## Purpose
|
|
60
68
|
|
|
61
69
|
Documentation should evolve alongside the code it describes. Diagrams-as-code tools such as Mermaid make it easier for teams to maintain clear, accurate diagrams as their systems grow and change. However, creating these diagrams manually — especially for database schemas — still introduces friction and the risk of diagrams falling out of sync with the system.
|
|
62
70
|
|
|
63
|
-
Prisma already provides a single source of truth for your data model through the Prisma schema. Therefore, by generating diagrams directly from
|
|
71
|
+
Prisma already provides a single source of truth for your data model through the Prisma schema. Therefore, by generating diagrams directly from the schema, we can ensure documentation stays automatically aligned with the current state of the database models.
|
|
64
72
|
|
|
65
|
-
This library bridges that gap. It transforms your Prisma schema into Mermaid
|
|
73
|
+
This library bridges that gap. It transforms your Prisma schema into a Mermaid ERD or class diagrams, combining code generation with diagrams-as-code. Once generated, these diagrams can be used to create Markdown files, SVGs, PDFs, or any other Mermaid-supported output — always consistent, always up to date.
|
|
@@ -1727,7 +1727,7 @@ var prismaGenerators = /* @__PURE__ */ new Map([
|
|
|
1727
1727
|
// package.json
|
|
1728
1728
|
var package_default = {
|
|
1729
1729
|
name: "@nonsoo/prisma-mermaid",
|
|
1730
|
-
version: "0.1.
|
|
1730
|
+
version: "0.1.1",
|
|
1731
1731
|
description: "A Prisma generator that generates Mermaid Class or ER diagrams from your Prisma schema.",
|
|
1732
1732
|
main: "build/index.js",
|
|
1733
1733
|
bin: {
|
|
@@ -1737,9 +1737,6 @@ var package_default = {
|
|
|
1737
1737
|
files: [
|
|
1738
1738
|
"build"
|
|
1739
1739
|
],
|
|
1740
|
-
publishConfig: {
|
|
1741
|
-
access: "public"
|
|
1742
|
-
},
|
|
1743
1740
|
scripts: {
|
|
1744
1741
|
build: "tsup",
|
|
1745
1742
|
lint: "eslint .",
|
|
@@ -1780,6 +1777,7 @@ var package_default = {
|
|
|
1780
1777
|
devDependencies: {
|
|
1781
1778
|
"@changesets/cli": "^2.29.7",
|
|
1782
1779
|
"@eslint/js": "^9.39.1",
|
|
1780
|
+
"@prisma/internals": "^7.0.1",
|
|
1783
1781
|
"@types/node": "^24.10.1",
|
|
1784
1782
|
eslint: "^9.39.1",
|
|
1785
1783
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -1792,11 +1790,13 @@ var package_default = {
|
|
|
1792
1790
|
vitest: "^4.0.10"
|
|
1793
1791
|
},
|
|
1794
1792
|
peerDependencies: {
|
|
1795
|
-
prisma: "^6.
|
|
1796
|
-
"@prisma/
|
|
1793
|
+
"@prisma/client": "^6.0.0 || ^7.0.0",
|
|
1794
|
+
"@prisma/internals": "^6.0.0 || ^7.0.0"
|
|
1797
1795
|
},
|
|
1798
|
-
|
|
1799
|
-
"@prisma/internals":
|
|
1796
|
+
peerDependenciesMeta: {
|
|
1797
|
+
"@prisma/internals": {
|
|
1798
|
+
optional: true
|
|
1799
|
+
}
|
|
1800
1800
|
}
|
|
1801
1801
|
};
|
|
1802
1802
|
|
|
@@ -1732,7 +1732,7 @@ var prismaGenerators = /* @__PURE__ */ new Map([
|
|
|
1732
1732
|
// package.json
|
|
1733
1733
|
var package_default = {
|
|
1734
1734
|
name: "@nonsoo/prisma-mermaid",
|
|
1735
|
-
version: "0.1.
|
|
1735
|
+
version: "0.1.1",
|
|
1736
1736
|
description: "A Prisma generator that generates Mermaid Class or ER diagrams from your Prisma schema.",
|
|
1737
1737
|
main: "build/index.js",
|
|
1738
1738
|
bin: {
|
|
@@ -1742,9 +1742,6 @@ var package_default = {
|
|
|
1742
1742
|
files: [
|
|
1743
1743
|
"build"
|
|
1744
1744
|
],
|
|
1745
|
-
publishConfig: {
|
|
1746
|
-
access: "public"
|
|
1747
|
-
},
|
|
1748
1745
|
scripts: {
|
|
1749
1746
|
build: "tsup",
|
|
1750
1747
|
lint: "eslint .",
|
|
@@ -1785,6 +1782,7 @@ var package_default = {
|
|
|
1785
1782
|
devDependencies: {
|
|
1786
1783
|
"@changesets/cli": "^2.29.7",
|
|
1787
1784
|
"@eslint/js": "^9.39.1",
|
|
1785
|
+
"@prisma/internals": "^7.0.1",
|
|
1788
1786
|
"@types/node": "^24.10.1",
|
|
1789
1787
|
eslint: "^9.39.1",
|
|
1790
1788
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -1797,11 +1795,13 @@ var package_default = {
|
|
|
1797
1795
|
vitest: "^4.0.10"
|
|
1798
1796
|
},
|
|
1799
1797
|
peerDependencies: {
|
|
1800
|
-
prisma: "^6.
|
|
1801
|
-
"@prisma/
|
|
1798
|
+
"@prisma/client": "^6.0.0 || ^7.0.0",
|
|
1799
|
+
"@prisma/internals": "^6.0.0 || ^7.0.0"
|
|
1802
1800
|
},
|
|
1803
|
-
|
|
1804
|
-
"@prisma/internals":
|
|
1801
|
+
peerDependenciesMeta: {
|
|
1802
|
+
"@prisma/internals": {
|
|
1803
|
+
optional: true
|
|
1804
|
+
}
|
|
1805
1805
|
}
|
|
1806
1806
|
};
|
|
1807
1807
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nonsoo/prisma-mermaid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A Prisma generator that generates Mermaid Class or ER diagrams from your Prisma schema.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,9 +10,6 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"build"
|
|
12
12
|
],
|
|
13
|
-
"publishConfig": {
|
|
14
|
-
"access": "public"
|
|
15
|
-
},
|
|
16
13
|
"scripts": {
|
|
17
14
|
"build": "tsup",
|
|
18
15
|
"lint": "eslint .",
|
|
@@ -53,6 +50,7 @@
|
|
|
53
50
|
"devDependencies": {
|
|
54
51
|
"@changesets/cli": "^2.29.7",
|
|
55
52
|
"@eslint/js": "^9.39.1",
|
|
53
|
+
"@prisma/internals": "^7.0.1",
|
|
56
54
|
"@types/node": "^24.10.1",
|
|
57
55
|
"eslint": "^9.39.1",
|
|
58
56
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -65,10 +63,12 @@
|
|
|
65
63
|
"vitest": "^4.0.10"
|
|
66
64
|
},
|
|
67
65
|
"peerDependencies": {
|
|
68
|
-
"prisma": "^6.
|
|
69
|
-
"@prisma/
|
|
66
|
+
"@prisma/client": "^6.0.0 || ^7.0.0",
|
|
67
|
+
"@prisma/internals": "^6.0.0 || ^7.0.0"
|
|
70
68
|
},
|
|
71
|
-
"
|
|
72
|
-
"@prisma/internals":
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"@prisma/internals": {
|
|
71
|
+
"optional": true
|
|
72
|
+
}
|
|
73
73
|
}
|
|
74
74
|
}
|