Skip to content

Commit e9a4127

Browse files
committed
chore: refactor package.json import
1 parent 280ceaf commit e9a4127

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

src/common/atlas/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ApiClient } from "./apiClient";
2-
import { State } from "../../state";
1+
import { ApiClient } from "./apiClient.js";
2+
import { State } from "../../state.js";
33

44
export async function ensureAuthenticated(state: State, apiClient: ApiClient): Promise<void> {
55
if (!(await isAuthenticated(state, apiClient))) {

src/config.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import path from "path";
2-
import fs from "fs";
3-
import { fileURLToPath } from "url";
42
import os from "os";
5-
6-
const __filename = fileURLToPath(import.meta.url);
7-
const __dirname = path.dirname(__filename);
8-
9-
const packageMetadata = fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8");
10-
const packageJson = JSON.parse(packageMetadata);
3+
import packageJson from "../package.json" with { type: "json" };
114

125
export const config = {
136
atlasApiVersion: `2025-03-12`,

src/tools/mongodb/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { z } from "zod";
22
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
33
import { NodeDriverServiceProvider } from "@mongosh/service-provider-node-driver";
44
import { DbOperationType, MongoDBToolBase } from "./mongodbTool.js";
5-
import { ToolArgs } from "../tool";
5+
import { ToolArgs } from "../tool.js";
66
import { ErrorCodes, MongoDBError } from "../../errors.js";
77

88
export class ConnectTool extends MongoDBToolBase {

src/types/mongodb-redact.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
declare module 'mongodb-redact' {
3+
function redact<T>(message: T): T;
4+
export default redact;
5+
}

tsconfig.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
{
22
"compilerOptions": {
33
"target": "es2020",
4-
"module": "esnext",
5-
"moduleResolution": "node",
4+
"module": "nodenext",
5+
"moduleResolution": "nodenext",
66
"rootDir": "./src",
77
"outDir": "./dist",
88
"strict": true,
99
"esModuleInterop": true,
1010
"types": ["node"],
1111
"sourceMap": true,
12-
"skipLibCheck": true
12+
"skipLibCheck": true,
13+
"resolveJsonModule": true,
14+
"typeRoots": [
15+
"./node_modules/@types",
16+
"./src/types"
17+
],
1318
},
14-
"include": ["src/**/*.ts"]
19+
"include": ["src/**/*.ts", "package.json"],
1520
}

0 commit comments

Comments
 (0)