This is an automated email from the ASF dual-hosted git repository.

hsluoyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/casbin-typeorm-adapter.git


The following commit(s) were added to refs/heads/master by this push:
     new 891aca2  fix: declare mongodb as optional peer dependency
891aca2 is described below

commit 891aca24ef2e4394b635f5d1f13b3bae5a38a02e
Author: Yang Luo <[email protected]>
AuthorDate: Tue Aug 4 15:12:09 2026 +0800

    fix: declare mongodb as optional peer dependency
---
 README.md    | 4 ++++
 package.json | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/README.md b/README.md
index 0e38189..1d81d65 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,10 @@ You may find other 3rd-party supported DBs in TypeORM 
website or other places.
 
     npm install typeorm-adapter
 
+You also need to install the driver for the database you use, e.g. `mysql2`, 
`pg`, `better-sqlite3` or `mongodb`.
+
+`mongodb` is declared as an optional peer dependency, so it is not installed 
unless you ask for it. Importing `typeorm-adapter` never loads it at runtime. 
However, the shipped type declarations for `CasbinMongoRule` still reference 
the `ObjectId` type from `mongodb`. If you do not use MongoDB and compile with 
`skipLibCheck: false`, TypeScript reports `TS2307: Cannot find module 
'mongodb'` — set `skipLibCheck: true` in your `tsconfig.json` (the setting 
recommended by the TypeScript team a [...]
+
 ## Simple Example
 
 ```typescript
diff --git a/package.json b/package.json
index ca110ff..d278a43 100644
--- a/package.json
+++ b/package.json
@@ -37,6 +37,14 @@
     "reflect-metadata": "^0.2.2",
     "typeorm": "^1.0.0"
   },
+  "peerDependencies": {
+    "mongodb": "^7.0.0"
+  },
+  "peerDependenciesMeta": {
+    "mongodb": {
+      "optional": true
+    }
+  },
   "files": [
     "lib",
     "examples"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to