fix(desktop): auto-install Playwright Chromium browser on first launch - #22
Merged
Merged
Conversation
Closes #21 - Add lib/playwright-setup.ts with ensurePlaywrightBrowsers() that checks for the chromium binary at startup and downloads it via playwright-core CLI if missing. Browser is stored in {userData}/playwright-browsers so the app fully controls the install location with no admin rights needed. - Call ensurePlaywrightBrowsers() in index.ts app.whenReady() callback, wiring progress output into the splash screen label so users see 'Setting up browser engine...' on first launch rather than a silent hang. - Forward PLAYWRIGHT_BROWSERS_PATH in scheduler.ts worker fork() env so every spawned worker process resolves the binary from the same app-controlled location instead of the OS-wide ms-playwright cache.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #21
On a fresh desktop install, users had no Playwright Chromium binary and every
scraper:mapsjob failed immediately with:This PR adds an automatic one-time browser installation that runs during app startup — fully transparent to the user via splash screen progress — so scraping works out of the box on any machine.
Changes
lib/playwright-setup.ts(new)getPlaywrightBrowsersPath(){userData}/playwright-browsers— a stable, app-controlled path with guaranteed write accessisBrowserInstalled()installPlaywrightBrowsers(onProgress?)playwright-core/cli.js install chromium— no dependency onnpxor any global tool; streams stdout to an optional progress callbackensurePlaywrightBrowsers(onProgress?)PLAYWRIGHT_BROWSERS_PATH, checks if installed, installs only if missingmain/index.tsapp.whenReady()callbackasyncensurePlaywrightBrowsers()call between migrations and IPC registration, wired toupdateSplashProgressso the splash screen shows"Setting up browser engine..."during first-launch downloadservices/scheduler.tsPLAYWRIGHT_BROWSERS_PATHto the workerfork()env whitelist so every worker finds the binary in the app-controlled path rather than the missing OS-wide cacheBehaviour
PLAYWRIGHT_BROWSERS_PATHset by main processTesting
pnpm check-types— 0 errors)%APPDATA%\@leadforge\playwright-browsers→ launch app → observe splash shows browser setup → run scraper job → succeeds