@@ -37,36 +37,30 @@ download() {
3737}
3838
3939DRIVER_VERSION=$( head -1 ./DRIVER_VERSION)
40+ ROOT=" $( cd .. && pwd) "
4041
41- # Resolve the exact upstream commit that produced this driver version, so that the
42- # bundled Node.js version matches the driver exactly.
43- GIT_HEAD=$( npm view playwright@" $DRIVER_VERSION " gitHead)
44- if [[ -z " $GIT_HEAD " ]]; then
45- echo " Failed to resolve upstream commit (gitHead) for playwright@$DRIVER_VERSION "
46- exit 1
47- fi
42+ # All npm commands run from the repository root so that a root-level .npmrc (e.g. the one
43+ # the release pipeline writes to point at the internal Azure Artifacts feed) is honoured.
44+ # Locally, NPM_CONFIG_REGISTRY=<url> can be used to the same effect.
45+ npm_at_root () {
46+ (cd " $ROOT " && npm " $@ " )
47+ }
4848
4949# The Node.js version used to be pinned in the upstream driver build script. The script was
50- # removed in microsoft/playwright#41518, so for newer versions we follow the same policy it
51- # had: the latest Node.js LTS (see upstream utils/build/update-playwright-node.mjs).
52- NODE_VERSION=$( curl -fsSL " https://raw.githubusercontent.com/microsoft/playwright/ $GIT_HEAD /utils/build/build-playwright-driver.sh " 2> /dev/null \
53- | sed -n ' s/^NODE_VERSION="\([^"]*\)".*/\1/p ' )
50+ # removed in microsoft/playwright#41518, so we follow the same policy it had: the latest
51+ # Node.js LTS (see upstream utils/build/update-playwright-node.mjs).
52+ NODE_VERSION=$( curl -fsSL " https://nodejs.org/dist/index.json " \
53+ | node -e " let s='';process.stdin.on('data',d=>s+=d).on('end',()=>console.log(JSON.parse(s).find(r=>r.lts).version.slice(1))) " )
5454if [[ -z " $NODE_VERSION " ]]; then
55- NODE_VERSION=$( curl -fsSL " https://nodejs.org/dist/index.json" \
56- | node -e " let s='';process.stdin.on('data',d=>s+=d).on('end',()=>console.log(JSON.parse(s).find(r=>r.lts).version.slice(1)))" )
57- fi
58- if [[ -z " $NODE_VERSION " ]]; then
59- echo " Failed to determine Node.js version for playwright@$DRIVER_VERSION ($GIT_HEAD )"
55+ echo " Failed to determine the latest Node.js LTS version"
6056 exit 1
6157fi
6258
6359echo " Driver version: $DRIVER_VERSION "
64- echo " Upstream commit: $GIT_HEAD "
6560echo " Node.js version: $NODE_VERSION "
6661
6762# The platform-independent driver code (playwright-core) is assembled once into the driver module;
6863# the Node.js binary for each platform is assembled into the driver-bundle module. See issue #1196.
69- ROOT=" $( cd .. && pwd) "
7064CORE_DEST=" $ROOT /driver/src/main/resources/driver"
7165NODE_DEST=" $ROOT /driver-bundle/src/main/resources/driver"
7266
@@ -77,8 +71,11 @@ trap 'rm -rf "$TMP_DIR"' EXIT
7771echo " Assembling playwright-core package to $CORE_DEST /package"
7872rm -rf " $CORE_DEST /package"
7973mkdir -p " $CORE_DEST "
74+ # Fetched via npm rather than a hard-coded registry URL so that the configured registry
75+ # (and its credentials) are used.
8076CORE_TGZ=" $TMP_DIR /playwright-core-$DRIVER_VERSION .tgz"
81- download " https://registry.npmjs.org/playwright-core/-/playwright-core-$DRIVER_VERSION .tgz" " $CORE_TGZ "
77+ echo " Downloading playwright-core@$DRIVER_VERSION from $( npm_at_root config get registry) "
78+ npm_at_root pack " playwright-core@$DRIVER_VERSION " --pack-destination " $TMP_DIR " --silent > /dev/null
8279# The npm tarball has a top-level package/ directory, so this creates $CORE_DEST/package.
8380tar -xzf " $CORE_TGZ " -C " $CORE_DEST "
8481rm -f " $CORE_TGZ "
0 commit comments