feat: assemble driver from npm instead of CDN#1927
Merged
Conversation
Download the driver from the canonical npm registry rather than cdn.playwright.dev. Each platform's driver is assembled from the playwright-core npm package plus the matching Node.js binary from nodejs.org, the same way the upstream Playwright build does it, mirroring the approach in playwright-dotnet#3322. The npm package does not contain api.json, so generate_api.sh now generates it from the upstream Playwright source at the exact commit that produced the driver version (resolved via npm gitHead), instead of relying on the bundled driver's print-api-json command. References microsoft/playwright-internal#291 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
dgozman
approved these changes
Jun 12, 2026
| fi | ||
|
|
||
| # The Node.js version is kept in sync with the driver version in the upstream build script. | ||
| NODE_VERSION=$(curl -fsSL "https://raw.githubusercontent.com/microsoft/playwright/$GIT_HEAD/utils/build/build-playwright-driver.sh" \ |
There was a problem hiding this comment.
I think we'll get rid of this script later on, so the node version would be somewhere else (probably hardcoded and updated right here in this script).
Member
Author
There was a problem hiding this comment.
I'm on the fence, we have this auto-updater upstream which could jus bump NODE_VERSION file there. In any case we can update this line later on.
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.
What
Download the driver from the canonical npm registry rather than
cdn.playwright.dev. Each platform's driver is now assembled from theplaywright-corenpm package plus the matching Node.js binary from nodejs.org, the same way the upstream Playwright build does it — mirroring the approach in microsoft/playwright-dotnet#3322.The driver version is pinned to the exact upstream commit via
npm view playwright@<version> gitHead, and the pairedNODE_VERSIONis read from that commit'sbuild-playwright-driver.sh.api.json
The npm package does not contain
api.json(it is a build artifact upstream copies into the CDN zip). Sogenerate_api.shnow generates it from the upstream Playwright source at the same commit — via a minimal sparse checkout (utils+docs, nonpm install) runninggenerateApiJson.js— instead of relying on the bundled driver'sprint-api-json. SetPW_SRC_DIRto reuse an existingmicrosoft/playwrightcheckout.Verification
mac,mac-arm64,linux,linux-arm64,win32_x64) assemble in ~12s with correct per-arch Node.js binaries.package/is byte-identical to the official CDN zip's, except the two intentionally-dropped build artifacts (api.json,protocol.yml— the latter unused at runtime).node package/cli.js --version).api.jsonis byte-identical to the official CDN-bundled 1.60.0api.json.References https://github.com/microsoft/playwright-internal/issues/291