mermaid-js / mermaid-cli

Command line tool for the Mermaid library
MIT License
2.22k stars 210 forks source link

Add types for exports #633

Closed andrewshawcare closed 5 months ago

andrewshawcare commented 6 months ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @mermaid-js/mermaid-cli@10.6.1 for the project I'm working on.

This is related to #628

Here is the diff that solved my problem:

diff --git a/node_modules/@mermaid-js/mermaid-cli/package.json b/node_modules/@mermaid-js/mermaid-cli/package.json
index beb51f2..2019501 100644
--- a/node_modules/@mermaid-js/mermaid-cli/package.json
+++ b/node_modules/@mermaid-js/mermaid-cli/package.json
@@ -12,7 +12,14 @@
   "engines": {
     "node": "^14.13 || >=16.0"
   },
-  "exports": "./src/index.js",
+  "exports": {
+    ".": {
+      "import": {
+        "types": "./dist-types/src/index.d.ts",
+        "default": "./src/index.js"
+      }
+    }
+  },
   "types": "./dist-types/src/index.d.ts",
   "scripts": {
     "prepare": "tsc && vite build",

This issue body was partially generated by patch-package.