mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2026-03-16 22:33:10 +00:00
## Summary - Roll playwright and playwright-core to `1.59.0-alpha-1773451864000` - Fix `install-browser` CLI command registration (was calling `parseAsync` before registering the subcommand) - Add `selector` parameter to accessibility snapshot documentation - Add CLAUDE.md
59 lines
1.9 KiB
JavaScript
59 lines
1.9 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const { execSync } = require('child_process');
|
|
|
|
function copyConfig() {
|
|
const src = path.join(__dirname, '..', 'playwright', 'packages', 'playwright-core', 'src', 'tools', 'mcp', 'config.d.ts');
|
|
const dst = path.join(__dirname, 'packages', 'playwright-mcp', 'config.d.ts');
|
|
let content = fs.readFileSync(src, 'utf-8');
|
|
content = content.replace(
|
|
"import type * as playwright from 'playwright-core';",
|
|
"import type * as playwright from 'playwright';"
|
|
);
|
|
fs.writeFileSync(dst, content);
|
|
console.log(`Copied config.d.ts from ${src} to ${dst}`);
|
|
}
|
|
|
|
function updatePlaywrightVersion(version) {
|
|
const packagesDir = path.join(__dirname, 'packages');
|
|
const files = [path.join(__dirname, 'package.json')];
|
|
for (const entry of fs.readdirSync(packagesDir, { withFileTypes: true })) {
|
|
const pkgJson = path.join(packagesDir, entry.name, 'package.json');
|
|
if (fs.existsSync(pkgJson))
|
|
files.push(pkgJson);
|
|
}
|
|
|
|
for (const file of files) {
|
|
const json = JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
let updated = false;
|
|
for (const section of ['dependencies', 'devDependencies']) {
|
|
for (const pkg of ['@playwright/test', 'playwright', 'playwright-core']) {
|
|
if (json[section]?.[pkg]) {
|
|
json[section][pkg] = version;
|
|
updated = true;
|
|
}
|
|
}
|
|
}
|
|
if (updated) {
|
|
fs.writeFileSync(file, JSON.stringify(json, null, 2) + '\n');
|
|
console.log(`Updated ${file}`);
|
|
}
|
|
}
|
|
|
|
execSync('npm install', { cwd: __dirname, stdio: 'inherit' });
|
|
}
|
|
|
|
function doRoll(version) {
|
|
updatePlaywrightVersion(version);
|
|
copyConfig();
|
|
// update readme
|
|
execSync('npm run lint', { cwd: __dirname, stdio: 'inherit' });
|
|
}
|
|
|
|
let version = process.argv[2];
|
|
if (!version) {
|
|
version = execSync('npm info playwright@next version', { encoding: 'utf-8' }).trim();
|
|
console.log(`Using next playwright version: ${version}`);
|
|
}
|
|
doRoll(version);
|