brave-real-browser-mcp-server 2.41.14 → 2.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/packages/brave-real-blocker/package.json +2 -2
- package/packages/brave-real-launcher/package.json +2 -2
- package/packages/brave-real-playwright-core/package.json +1 -1
- package/packages/brave-real-puppeteer-core/package.json +2 -2
- package/scripts/auto-update-deps.js +299 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brave-real-browser-mcp-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.42.0",
|
|
4
4
|
"description": "MCP Server for Brave Real Browser - Puppeteer with Brave Browser, Stealth Mode, Ad Blocker, and Turnstile Auto-Solver for undetectable web automation.",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/esm/index.mjs",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"license": "ISC",
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
77
|
-
"brave-real-puppeteer-core": "^24.37.2-brave.
|
|
77
|
+
"brave-real-puppeteer-core": "^24.37.2-brave.4",
|
|
78
78
|
"ghost-cursor": "^1.4.2",
|
|
79
79
|
"puppeteer-extra": "^3.3.6",
|
|
80
80
|
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brave-real-blocker",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Advanced uBlock Origin management and stealth features for Brave Real Browser",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@types/adm-zip": "^0.5.5",
|
|
65
65
|
"@types/fs-extra": "^11.0.4",
|
|
66
66
|
"@types/node": "^20.0.0",
|
|
67
|
-
"brave-real-puppeteer-core": "^24.37.2-brave.
|
|
67
|
+
"brave-real-puppeteer-core": "^24.37.2-brave.4",
|
|
68
68
|
"mocha": "^10.4.0",
|
|
69
69
|
"puppeteer-core": ">=24.0.0",
|
|
70
70
|
"sinon": "^17.0.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brave-real-launcher",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "Launch Brave Browser with ease from node. Based on chrome-launcher with Brave-specific support.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"typescript": "^5.0.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"brave-real-blocker": "^1.
|
|
57
|
+
"brave-real-blocker": "^1.18.0",
|
|
58
58
|
"escape-string-regexp": "^5.0.0",
|
|
59
59
|
"is-wsl": "^3.1.0",
|
|
60
60
|
"which": "^6.0.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brave-real-puppeteer-core",
|
|
3
|
-
"version": "24.37.2-brave.
|
|
3
|
+
"version": "24.37.2-brave.4",
|
|
4
4
|
"description": "🦁 Brave Real-World Optimized Puppeteer & Playwright Core with 1-5ms ultra-fast timing, 50+ professional stealth features, intelligent browser auto-detection, and 100% bot detection bypass. Features cross-platform Brave browser integration, comprehensive anti-detection, and breakthrough performance improvements.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
},
|
|
136
136
|
"dependencies": {
|
|
137
137
|
"@puppeteer/browsers": "2.12.0",
|
|
138
|
-
"brave-real-launcher": "^1.
|
|
138
|
+
"brave-real-launcher": "^1.24.0",
|
|
139
139
|
"chromium-bidi": "13.1.1",
|
|
140
140
|
"debug": "^4.4.3",
|
|
141
141
|
"devtools-protocol": "0.0.1566079",
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
const { execSync } = require('child_process');
|
|
14
14
|
const fs = require('fs');
|
|
15
15
|
const path = require('path');
|
|
16
|
+
const https = require('https');
|
|
17
|
+
const http = require('http');
|
|
18
|
+
const os = require('os');
|
|
16
19
|
|
|
17
20
|
// Colors for console
|
|
18
21
|
const colors = {
|
|
@@ -20,6 +23,7 @@ const colors = {
|
|
|
20
23
|
yellow: '\x1b[33m',
|
|
21
24
|
blue: '\x1b[34m',
|
|
22
25
|
red: '\x1b[31m',
|
|
26
|
+
cyan: '\x1b[36m',
|
|
23
27
|
reset: '\x1b[0m',
|
|
24
28
|
bold: '\x1b[1m'
|
|
25
29
|
};
|
|
@@ -28,9 +32,281 @@ const log = {
|
|
|
28
32
|
info: (msg) => console.log(`${colors.blue}[auto-update]${colors.reset} ${msg}`),
|
|
29
33
|
success: (msg) => console.log(`${colors.green}[auto-update]${colors.reset} ${msg}`),
|
|
30
34
|
warn: (msg) => console.log(`${colors.yellow}[auto-update]${colors.reset} ${msg}`),
|
|
31
|
-
error: (msg) => console.log(`${colors.red}[auto-update]${colors.reset} ${msg}`)
|
|
35
|
+
error: (msg) => console.log(`${colors.red}[auto-update]${colors.reset} ${msg}`),
|
|
36
|
+
brave: (msg) => console.log(`${colors.cyan}[brave-install]${colors.reset} ${msg}`)
|
|
32
37
|
};
|
|
33
38
|
|
|
39
|
+
// ============================================
|
|
40
|
+
// BRAVE BROWSER AUTO-DETECTION & INSTALLATION
|
|
41
|
+
// ============================================
|
|
42
|
+
|
|
43
|
+
const BRAVE_DOWNLOAD_URLS = {
|
|
44
|
+
win32: 'https://laptop-updates.brave.com/latest/winx64',
|
|
45
|
+
darwin: 'https://laptop-updates.brave.com/latest/osx'
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get Brave installation paths for current platform
|
|
50
|
+
*/
|
|
51
|
+
function getBravePaths() {
|
|
52
|
+
const platform = process.platform;
|
|
53
|
+
|
|
54
|
+
if (platform === 'win32') {
|
|
55
|
+
return [
|
|
56
|
+
`${process.env.LOCALAPPDATA}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`,
|
|
57
|
+
`${process.env.PROGRAMFILES}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`,
|
|
58
|
+
`${process.env['PROGRAMFILES(X86)']}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`,
|
|
59
|
+
`${process.env.PROGRAMW6432}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`
|
|
60
|
+
].filter(Boolean);
|
|
61
|
+
} else if (platform === 'darwin') {
|
|
62
|
+
return [
|
|
63
|
+
'/Applications/Brave Browser.app/Contents/MacOS/Brave Browser',
|
|
64
|
+
`${os.homedir()}/Applications/Brave Browser.app/Contents/MacOS/Brave Browser`
|
|
65
|
+
];
|
|
66
|
+
} else if (platform === 'linux') {
|
|
67
|
+
return [
|
|
68
|
+
'/usr/bin/brave-browser',
|
|
69
|
+
'/usr/bin/brave-browser-stable',
|
|
70
|
+
'/opt/brave.com/brave/brave',
|
|
71
|
+
'/snap/bin/brave',
|
|
72
|
+
'/usr/bin/brave'
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Check if Brave is installed
|
|
80
|
+
*/
|
|
81
|
+
function findBraveInstallation() {
|
|
82
|
+
const paths = getBravePaths();
|
|
83
|
+
for (const p of paths) {
|
|
84
|
+
try {
|
|
85
|
+
if (fs.existsSync(p)) {
|
|
86
|
+
return p;
|
|
87
|
+
}
|
|
88
|
+
} catch (e) {
|
|
89
|
+
// Path doesn't exist
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Download file with redirect support
|
|
97
|
+
*/
|
|
98
|
+
function downloadFile(url, destPath) {
|
|
99
|
+
return new Promise((resolve, reject) => {
|
|
100
|
+
const followRedirect = (currentUrl, redirectCount = 0) => {
|
|
101
|
+
if (redirectCount > 10) {
|
|
102
|
+
reject(new Error('Too many redirects'));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const protocol = currentUrl.startsWith('https') ? https : http;
|
|
107
|
+
|
|
108
|
+
protocol.get(currentUrl, {
|
|
109
|
+
headers: { 'User-Agent': 'brave-real-browser-mcp-server' }
|
|
110
|
+
}, (response) => {
|
|
111
|
+
if ([301, 302, 307, 308].includes(response.statusCode)) {
|
|
112
|
+
let redirectUrl = response.headers.location;
|
|
113
|
+
if (redirectUrl) {
|
|
114
|
+
if (!redirectUrl.startsWith('http')) {
|
|
115
|
+
const baseUrl = new URL(currentUrl);
|
|
116
|
+
redirectUrl = new URL(redirectUrl, baseUrl.origin).href;
|
|
117
|
+
}
|
|
118
|
+
followRedirect(redirectUrl, redirectCount + 1);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (response.statusCode !== 200) {
|
|
124
|
+
reject(new Error(`Download failed: ${response.statusCode}`));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const file = fs.createWriteStream(destPath);
|
|
129
|
+
response.pipe(file);
|
|
130
|
+
|
|
131
|
+
file.on('finish', () => {
|
|
132
|
+
file.close();
|
|
133
|
+
resolve();
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
file.on('error', (err) => {
|
|
137
|
+
try { fs.unlinkSync(destPath); } catch (e) { }
|
|
138
|
+
reject(err);
|
|
139
|
+
});
|
|
140
|
+
}).on('error', reject);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
followRedirect(url);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Install Brave on Windows
|
|
149
|
+
*/
|
|
150
|
+
async function installBraveWindows() {
|
|
151
|
+
const downloadDir = path.join(os.homedir(), '.brave-real-launcher', 'downloads');
|
|
152
|
+
if (!fs.existsSync(downloadDir)) {
|
|
153
|
+
fs.mkdirSync(downloadDir, { recursive: true });
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const installerPath = path.join(downloadDir, 'BraveBrowserSetup.exe');
|
|
157
|
+
|
|
158
|
+
log.brave('Downloading Brave installer for Windows...');
|
|
159
|
+
await downloadFile(BRAVE_DOWNLOAD_URLS.win32, installerPath);
|
|
160
|
+
|
|
161
|
+
log.brave('Running Brave installer (silent mode)...');
|
|
162
|
+
try {
|
|
163
|
+
execSync(`"${installerPath}" /silent /install`, {
|
|
164
|
+
stdio: 'ignore',
|
|
165
|
+
timeout: 300000
|
|
166
|
+
});
|
|
167
|
+
} catch (error) {
|
|
168
|
+
try {
|
|
169
|
+
execSync(`"${installerPath}" --system-level --do-not-launch-chrome`, {
|
|
170
|
+
stdio: 'ignore',
|
|
171
|
+
timeout: 300000
|
|
172
|
+
});
|
|
173
|
+
} catch (e) {
|
|
174
|
+
// Installation might still succeed
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Wait for installation
|
|
179
|
+
await new Promise(r => setTimeout(r, 5000));
|
|
180
|
+
|
|
181
|
+
// Cleanup
|
|
182
|
+
try { fs.unlinkSync(installerPath); } catch (e) { }
|
|
183
|
+
|
|
184
|
+
return findBraveInstallation();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Install Brave on Linux
|
|
189
|
+
*/
|
|
190
|
+
async function installBraveLinux() {
|
|
191
|
+
log.brave('Installing Brave on Linux...');
|
|
192
|
+
|
|
193
|
+
// Detect package manager
|
|
194
|
+
let packageManager = 'unknown';
|
|
195
|
+
try { execSync('which apt', { stdio: 'ignore' }); packageManager = 'apt'; } catch (e) { }
|
|
196
|
+
if (packageManager === 'unknown') {
|
|
197
|
+
try { execSync('which dnf', { stdio: 'ignore' }); packageManager = 'dnf'; } catch (e) { }
|
|
198
|
+
}
|
|
199
|
+
if (packageManager === 'unknown') {
|
|
200
|
+
try { execSync('which pacman', { stdio: 'ignore' }); packageManager = 'pacman'; } catch (e) { }
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
try {
|
|
204
|
+
if (packageManager === 'apt') {
|
|
205
|
+
execSync('sudo apt install -y curl', { stdio: 'ignore' });
|
|
206
|
+
execSync('sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg', { stdio: 'ignore' });
|
|
207
|
+
execSync('echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list', { stdio: 'ignore' });
|
|
208
|
+
execSync('sudo apt update', { stdio: 'ignore' });
|
|
209
|
+
execSync('sudo apt install -y brave-browser', { stdio: 'ignore' });
|
|
210
|
+
} else if (packageManager === 'dnf') {
|
|
211
|
+
execSync('sudo dnf install -y dnf-plugins-core', { stdio: 'ignore' });
|
|
212
|
+
execSync('sudo dnf config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo', { stdio: 'ignore' });
|
|
213
|
+
execSync('sudo rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc', { stdio: 'ignore' });
|
|
214
|
+
execSync('sudo dnf install -y brave-browser', { stdio: 'ignore' });
|
|
215
|
+
} else if (packageManager === 'pacman') {
|
|
216
|
+
execSync('yay -S --noconfirm brave-bin', { stdio: 'ignore' });
|
|
217
|
+
} else {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return findBraveInstallation();
|
|
222
|
+
} catch (error) {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Install Brave on macOS
|
|
229
|
+
*/
|
|
230
|
+
async function installBraveMacOS() {
|
|
231
|
+
const downloadDir = path.join(os.homedir(), '.brave-real-launcher', 'downloads');
|
|
232
|
+
if (!fs.existsSync(downloadDir)) {
|
|
233
|
+
fs.mkdirSync(downloadDir, { recursive: true });
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const dmgPath = path.join(downloadDir, 'Brave-Browser.dmg');
|
|
237
|
+
|
|
238
|
+
log.brave('Downloading Brave for macOS...');
|
|
239
|
+
await downloadFile(BRAVE_DOWNLOAD_URLS.darwin, dmgPath);
|
|
240
|
+
|
|
241
|
+
log.brave('Installing Brave...');
|
|
242
|
+
try {
|
|
243
|
+
const mountOutput = execSync(`hdiutil attach "${dmgPath}" -nobrowse`, { encoding: 'utf-8' });
|
|
244
|
+
const mountPoint = mountOutput.split('\t').pop()?.trim() || '/Volumes/Brave Browser';
|
|
245
|
+
|
|
246
|
+
execSync(`cp -R "${mountPoint}/Brave Browser.app" /Applications/`, { stdio: 'ignore' });
|
|
247
|
+
execSync(`hdiutil detach "${mountPoint}"`, { stdio: 'ignore' });
|
|
248
|
+
|
|
249
|
+
try { fs.unlinkSync(dmgPath); } catch (e) { }
|
|
250
|
+
|
|
251
|
+
return findBraveInstallation();
|
|
252
|
+
} catch (error) {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Main function to check and install Brave Browser
|
|
259
|
+
*/
|
|
260
|
+
async function checkAndInstallBrave() {
|
|
261
|
+
console.log(`\n${colors.bold}🦁 Brave Browser Check${colors.reset}\n`);
|
|
262
|
+
|
|
263
|
+
// Skip if SKIP_BRAVE_INSTALL is set or in CI
|
|
264
|
+
if (process.env.SKIP_BRAVE_INSTALL === 'true' || process.env.CI === 'true') {
|
|
265
|
+
log.brave('Skipping Brave auto-install (CI/SKIP_BRAVE_INSTALL=true)');
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Check if Brave is already installed
|
|
270
|
+
const existingBrave = findBraveInstallation();
|
|
271
|
+
if (existingBrave) {
|
|
272
|
+
log.brave(`✅ Brave Browser found: ${existingBrave}`);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
log.brave('📥 Brave Browser not found, installing...');
|
|
277
|
+
|
|
278
|
+
const platform = process.platform;
|
|
279
|
+
let bravePath = null;
|
|
280
|
+
|
|
281
|
+
try {
|
|
282
|
+
if (platform === 'win32') {
|
|
283
|
+
bravePath = await installBraveWindows();
|
|
284
|
+
} else if (platform === 'darwin') {
|
|
285
|
+
bravePath = await installBraveMacOS();
|
|
286
|
+
} else if (platform === 'linux') {
|
|
287
|
+
bravePath = await installBraveLinux();
|
|
288
|
+
} else {
|
|
289
|
+
log.warn(`Unsupported platform: ${platform}`);
|
|
290
|
+
log.warn('Please install Brave manually from: https://brave.com/download');
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (bravePath) {
|
|
295
|
+
log.brave(`✅ Brave Browser installed successfully!`);
|
|
296
|
+
log.brave(` Path: ${bravePath}`);
|
|
297
|
+
} else {
|
|
298
|
+
log.warn('⚠️ Could not auto-install Brave. Please install manually from: https://brave.com/download');
|
|
299
|
+
}
|
|
300
|
+
} catch (error) {
|
|
301
|
+
log.warn(`⚠️ Brave auto-install failed: ${error.message}`);
|
|
302
|
+
log.warn('Please install Brave manually from: https://brave.com/download');
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// ============================================
|
|
307
|
+
// END BRAVE BROWSER AUTO-DETECTION
|
|
308
|
+
// ============================================
|
|
309
|
+
|
|
34
310
|
// Skip if CI environment and SKIP_AUTO_UPDATE is set
|
|
35
311
|
if (process.env.SKIP_AUTO_UPDATE === 'true') {
|
|
36
312
|
log.info('Skipping auto-update (SKIP_AUTO_UPDATE=true)');
|
|
@@ -61,7 +337,7 @@ const PACKAGES_TO_UPDATE = [
|
|
|
61
337
|
|
|
62
338
|
async function getLatestVersion(packageName) {
|
|
63
339
|
try {
|
|
64
|
-
const result = execSync(`npm view ${packageName} version`, {
|
|
340
|
+
const result = execSync(`npm view ${packageName} version`, {
|
|
65
341
|
encoding: 'utf8',
|
|
66
342
|
stdio: ['pipe', 'pipe', 'pipe']
|
|
67
343
|
}).trim();
|
|
@@ -86,57 +362,57 @@ async function getCurrentVersion(packageName) {
|
|
|
86
362
|
|
|
87
363
|
async function updateDependencies() {
|
|
88
364
|
log.info('Checking for dependency updates...');
|
|
89
|
-
|
|
365
|
+
|
|
90
366
|
const updates = [];
|
|
91
|
-
|
|
367
|
+
|
|
92
368
|
// Check critical dependencies
|
|
93
369
|
for (const pkg of CRITICAL_DEPS) {
|
|
94
370
|
const latest = await getLatestVersion(pkg);
|
|
95
371
|
const current = await getCurrentVersion(pkg);
|
|
96
|
-
|
|
372
|
+
|
|
97
373
|
if (latest && current && latest !== current) {
|
|
98
374
|
updates.push({ name: pkg, current, latest, critical: true });
|
|
99
375
|
}
|
|
100
376
|
}
|
|
101
|
-
|
|
377
|
+
|
|
102
378
|
// Check other packages
|
|
103
379
|
for (const pkg of PACKAGES_TO_UPDATE) {
|
|
104
380
|
const latest = await getLatestVersion(pkg);
|
|
105
381
|
const current = await getCurrentVersion(pkg);
|
|
106
|
-
|
|
382
|
+
|
|
107
383
|
if (latest && current && latest !== current) {
|
|
108
384
|
updates.push({ name: pkg, current, latest, critical: false });
|
|
109
385
|
}
|
|
110
386
|
}
|
|
111
|
-
|
|
387
|
+
|
|
112
388
|
if (updates.length === 0) {
|
|
113
389
|
log.success('All dependencies are up to date!');
|
|
114
390
|
return;
|
|
115
391
|
}
|
|
116
|
-
|
|
392
|
+
|
|
117
393
|
// Show what will be updated
|
|
118
394
|
log.info(`Found ${updates.length} packages to update:`);
|
|
119
395
|
updates.forEach(u => {
|
|
120
396
|
const icon = u.critical ? '🔴' : '🔵';
|
|
121
397
|
console.log(` ${icon} ${u.name}: ${u.current} → ${u.latest}`);
|
|
122
398
|
});
|
|
123
|
-
|
|
399
|
+
|
|
124
400
|
log.info('Run "npm update" to update these packages.');
|
|
125
401
|
}
|
|
126
402
|
|
|
127
403
|
async function updateBasedOnField() {
|
|
128
404
|
log.info('Checking basedOn field updates...');
|
|
129
|
-
|
|
405
|
+
|
|
130
406
|
const packagesDir = path.join(__dirname, '..', 'packages');
|
|
131
407
|
const updates = [];
|
|
132
|
-
|
|
408
|
+
|
|
133
409
|
// Check brave-real-puppeteer-core
|
|
134
410
|
const puppeteerPkgPath = path.join(packagesDir, 'brave-real-puppeteer-core', 'package.json');
|
|
135
411
|
if (fs.existsSync(puppeteerPkgPath)) {
|
|
136
412
|
const pkg = JSON.parse(fs.readFileSync(puppeteerPkgPath, 'utf8'));
|
|
137
413
|
const basedOn = pkg.brave?.basedOn?.['puppeteer-core'];
|
|
138
414
|
const latestPuppeteer = await getLatestVersion('puppeteer-core');
|
|
139
|
-
|
|
415
|
+
|
|
140
416
|
if (basedOn && latestPuppeteer && basedOn !== latestPuppeteer) {
|
|
141
417
|
updates.push({
|
|
142
418
|
package: 'brave-real-puppeteer-core',
|
|
@@ -146,14 +422,14 @@ async function updateBasedOnField() {
|
|
|
146
422
|
});
|
|
147
423
|
}
|
|
148
424
|
}
|
|
149
|
-
|
|
425
|
+
|
|
150
426
|
// Check brave-real-playwright-core
|
|
151
427
|
const playwrightPkgPath = path.join(packagesDir, 'brave-real-playwright-core', 'package.json');
|
|
152
428
|
if (fs.existsSync(playwrightPkgPath)) {
|
|
153
429
|
const pkg = JSON.parse(fs.readFileSync(playwrightPkgPath, 'utf8'));
|
|
154
430
|
const basedOn = pkg.brave?.basedOn?.['playwright-core'];
|
|
155
431
|
const latestPlaywright = await getLatestVersion('playwright-core');
|
|
156
|
-
|
|
432
|
+
|
|
157
433
|
if (basedOn && latestPlaywright && basedOn !== latestPlaywright) {
|
|
158
434
|
updates.push({
|
|
159
435
|
package: 'brave-real-playwright-core',
|
|
@@ -163,7 +439,7 @@ async function updateBasedOnField() {
|
|
|
163
439
|
});
|
|
164
440
|
}
|
|
165
441
|
}
|
|
166
|
-
|
|
442
|
+
|
|
167
443
|
if (updates.length > 0) {
|
|
168
444
|
log.warn('Upstream updates available:');
|
|
169
445
|
updates.forEach(u => {
|
|
@@ -178,11 +454,17 @@ async function updateBasedOnField() {
|
|
|
178
454
|
// Main execution
|
|
179
455
|
async function main() {
|
|
180
456
|
console.log(`\n${colors.bold}🔄 Auto-Update Dependencies${colors.reset}\n`);
|
|
181
|
-
|
|
457
|
+
|
|
182
458
|
try {
|
|
459
|
+
// First, check and install Brave Browser if needed
|
|
460
|
+
await checkAndInstallBrave();
|
|
461
|
+
|
|
183
462
|
await updateDependencies();
|
|
184
463
|
await updateBasedOnField();
|
|
185
464
|
console.log('');
|
|
465
|
+
|
|
466
|
+
// Exit successfully after completion
|
|
467
|
+
process.exit(0);
|
|
186
468
|
} catch (e) {
|
|
187
469
|
log.error('Auto-update failed: ' + e.message);
|
|
188
470
|
// Don't fail the install
|