Skip to content

Commit 6bca226

Browse files
committed
refactor: standardize node imports and fix formatting
1 parent b27965d commit 6bca226

File tree

6 files changed

+10
-15
lines changed

6 files changed

+10
-15
lines changed

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import tsParser from '@typescript-eslint/parser'
21
import tsPlugin from '@typescript-eslint/eslint-plugin'
2+
import tsParser from '@typescript-eslint/parser'
33
import importPlugin from 'eslint-plugin-import'
44
import prettierPlugin from 'eslint-plugin-prettier'
55
import globals from 'globals'

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
"author": "zhensherlock",
66
"type": "module",
77
"license": "MIT",
8-
"files": [
9-
"build",
10-
"LICENSE",
11-
"README.md"
12-
],
8+
"files": ["build", "LICENSE", "README.md"],
139
"main": "build/index.js",
1410
"scripts": {
1511
"prepare": "husky",

scripts/base.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import path from 'path'
2-
import { fileURLToPath } from 'url'
3-
import { spawn } from 'child_process'
1+
import { spawn } from 'node:child_process'
2+
import path from 'node:path'
43
import { rimraf } from 'rimraf'
54

65
const dirname = import.meta.dirname

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import 'dotenv/config'
2-
import { setTimeout as sleep } from 'timers/promises'
2+
import { setTimeout as sleep } from 'node:timers/promises'
33
import { Client } from '@modelcontextprotocol/sdk/client/index.js'
4+
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'
45
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
56
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'
6-
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'
77

88
export async function testStdioTransport() {
99
console.log('start stdio client transport')

tests/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, test } from 'vitest'
2-
import { testStdioTransport, testStreamableHttpTransport, testSSETransport } from '@/index'
2+
import { testSSETransport, testStdioTransport, testStreamableHttpTransport } from '@/index'
33

44
describe('MCP client', () => {
55
test('stdio transport', async () => {

vitest.global.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { spawn } from 'child_process'
1+
import { spawn } from 'node:child_process'
22
import { waitForValue } from './tests/utils'
33

44
export default async function setup() {
55
const webProcess = spawn('npx', ['-y', '@my-mcp-hub/node-mcp-server', 'web'], {
66
stdio: 'pipe',
77
})
88
let webStarted = false
9-
webProcess.stdout?.on('data', async (data) => {
9+
webProcess.stdout?.on('data', async data => {
1010
const output = data.toString()
1111
if (output.includes('MCP server started')) {
1212
webStarted = true
1313
}
14-
});
14+
})
1515
await waitForValue(() => webStarted)
1616
return () => {
1717
webProcess.kill('SIGINT')

0 commit comments

Comments
 (0)