mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2025-07-26 08:32:26 +08:00
chore: change import assert to readFile (#368)
This commit is contained in:
parent
35e6c49d7c
commit
91ae93c167
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -37,7 +37,8 @@ jobs:
|
||||
- name: Use Node.js 18
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
# https://github.com/microsoft/playwright-mcp/issues/344
|
||||
node-version: '18.19'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
|
@ -18,14 +18,12 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
||||
import { CallToolRequestSchema, ListToolsRequestSchema, Tool as McpTool } from '@modelcontextprotocol/sdk/types.js';
|
||||
import { zodToJsonSchema } from 'zod-to-json-schema';
|
||||
|
||||
import { Context } from './context.js';
|
||||
import { Context, packageJSON } from './context.js';
|
||||
import { snapshotTools, screenshotTools } from './tools.js';
|
||||
|
||||
import type { Config } from '../config.js';
|
||||
import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
||||
|
||||
import packageJSON from '../package.json' with { type: 'json' };
|
||||
|
||||
export async function createConnection(config: Config): Promise<Connection> {
|
||||
const allTools = config.vision ? screenshotTools : snapshotTools;
|
||||
const tools = allTools.filter(tool => !config.capabilities || tool.capability === 'core' || config.capabilities.includes(tool.capability));
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
import fs from 'node:fs';
|
||||
import url from 'node:url';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
|
||||
@ -381,3 +382,6 @@ async function createUserDataDir(browserConfig: Config['browser']) {
|
||||
export async function generateLocator(locator: playwright.Locator): Promise<string> {
|
||||
return (locator as any)._generateLocatorString();
|
||||
}
|
||||
|
||||
const __filename = url.fileURLToPath(import.meta.url);
|
||||
export const packageJSON = JSON.parse(fs.readFileSync(path.join(path.dirname(__filename), '..', 'package.json'), 'utf8'));
|
||||
|
@ -20,8 +20,7 @@ import { startHttpTransport, startStdioTransport } from './transport.js';
|
||||
import { resolveConfig } from './config.js';
|
||||
|
||||
import type { Connection } from './connection.js';
|
||||
|
||||
import packageJSON from '../package.json' with { type: 'json' };
|
||||
import { packageJSON } from './context.js';
|
||||
|
||||
program
|
||||
.version('Version ' + packageJSON.version)
|
||||
|
Loading…
x
Reference in New Issue
Block a user