Skip to content

Commit e095823

Browse files
committed
chore: fix levenshtein dependency
1 parent a57376f commit e095823

File tree

4 files changed

+12
-32
lines changed

4 files changed

+12
-32
lines changed

package-lock.json

Lines changed: 7 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
"@mongodb-js/oidc-mock-provider": "^0.11.3",
6767
"@redocly/cli": "^2.0.8",
6868
"@types/express": "^5.0.3",
69-
"@types/fast-levenshtein": "^0.0.4",
7069
"@types/http-proxy": "^1.17.16",
7170
"@types/node": "^24.3.0",
7271
"@types/proper-lockfile": "^4.1.4",
@@ -105,7 +104,6 @@
105104
"@vitest/eslint-plugin": "^1.3.4",
106105
"bson": "^6.10.4",
107106
"express": "^5.1.0",
108-
"fast-levenshtein": "^3.0.0",
109107
"lru-cache": "^11.1.0",
110108
"mongodb": "^6.19.0",
111109
"mongodb-connection-string-url": "^3.0.2",
@@ -116,6 +114,7 @@
116114
"node-machine-id": "1.1.12",
117115
"oauth4webapi": "^3.8.0",
118116
"openapi-fetch": "^0.14.0",
117+
"ts-levenshtein": "^1.0.7",
119118
"yargs-parser": "^22.0.0",
120119
"zod": "^3.25.76"
121120
},

src/common/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { CliOptions, ConnectionInfo } from "@mongosh/arg-parser";
55
import { generateConnectionInfoFromCliArgs } from "@mongosh/arg-parser";
66
import { Keychain } from "./keychain.js";
77
import type { Secret } from "./keychain.js";
8-
import { get as levenshtein } from "fast-levenshtein";
8+
import levenshtein from "ts-levenshtein";
99

1010
// From: https://github.com/mongodb-js/mongosh/blob/main/packages/cli-repl/src/arg-parser.ts
1111
const OPTIONS = {
@@ -115,7 +115,7 @@ export function validateConfigKey(key: string): { valid: boolean; suggestion?: s
115115
}
116116

117117
// else, infer something using levenhstein so we suggest a valid key
118-
const lev = levenshtein(key, validKey);
118+
const lev = levenshtein.get(key, validKey);
119119
if (lev < minLev) {
120120
minLev = lev;
121121
suggestion = validKey;

tsconfig.build.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"paths": {
2222
"mongodb-connection-string-url": [
2323
"./node_modules/mongodb-connection-string-url/lib/index.d.ts"
24-
]
24+
],
25+
"ts-levenshtein": ["./node_modules/ts-levenshtein/dist/index.d.mts"]
2526
}
2627
},
2728
"include": ["src/**/*.ts"]

0 commit comments

Comments
 (0)