diff --git a/src/node/BrowserFetcher.ts b/src/node/BrowserFetcher.ts index 01140df4c487b..671aa4ce18406 100644 --- a/src/node/BrowserFetcher.ts +++ b/src/node/BrowserFetcher.ts @@ -41,12 +41,14 @@ const downloadURLs = { chrome: { linux: '%s/chromium-browser-snapshots/Linux_x64/%d/%s.zip', mac: '%s/chromium-browser-snapshots/Mac/%d/%s.zip', + macArm: '%s/chromium-browser-snapshots/Mac_Arm/%d/%s.zip', win32: '%s/chromium-browser-snapshots/Win/%d/%s.zip', win64: '%s/chromium-browser-snapshots/Win_x64/%d/%s.zip', }, firefox: { linux: '%s/firefox-%s.en-US.%s-x86_64.tar.bz2', mac: '%s/firefox-%s.en-US.%s.dmg', + macArm: '%s/firefox-%s.en-US.%s.dmg', win32: '%s/firefox-%s.en-US.%s.zip', win64: '%s/firefox-%s.en-US.%s.zip', }, @@ -67,7 +69,7 @@ const browserConfig = { * Supported platforms. * @public */ -export type Platform = 'linux' | 'mac' | 'win32' | 'win64'; +export type Platform = 'linux' | 'mac' | 'macArm' | 'win32' | 'win64'; function archiveName( product: Product, @@ -76,13 +78,13 @@ function archiveName( ): string { if (product === 'chrome') { if (platform === 'linux') return 'chrome-linux'; - if (platform === 'mac') return 'chrome-mac'; + if (platform === 'mac' || platform === 'macArm') return 'chrome-mac'; if (platform === 'win32' || platform === 'win64') { // Windows archive name changed at r591479. return parseInt(revision, 10) > 591479 ? 'chrome-win' : 'chrome-win32'; } } else if (product === 'firefox') { - return platform; + return platform === 'macArm' ? 'mac' : platform; } } @@ -214,7 +216,8 @@ export class BrowserFetcher { } const platform = os.platform(); - if (platform === 'darwin') this._platform = 'mac'; + if (platform === 'darwin') + this._platform = os.arch() === 'arm64' ? 'macArm' : 'mac'; else if (platform === 'linux') this._platform = 'linux'; else if (platform === 'win32') this._platform = os.arch() === 'x64' ? 'win64' : 'win32'; @@ -353,7 +356,7 @@ export class BrowserFetcher { const folderPath = this._getFolderPath(revision); let executablePath = ''; if (this._product === 'chrome') { - if (this._platform === 'mac') + if (this._platform === 'mac' || this._platform === 'macArm') executablePath = path.join( folderPath, archiveName(this._product, this._platform, revision), @@ -376,7 +379,7 @@ export class BrowserFetcher { ); else throw new Error('Unsupported platform: ' + this._platform); } else if (this._product === 'firefox') { - if (this._platform === 'mac') + if (this._platform === 'mac' || this._platform === 'macArm') executablePath = path.join( folderPath, 'Firefox Nightly.app', diff --git a/src/node/install.ts b/src/node/install.ts index 856b13ae9ce3c..c9dc2457782f1 100644 --- a/src/node/install.ts +++ b/src/node/install.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import os from 'os'; import https, { RequestOptions } from 'https'; import ProgressBar from 'progress'; import URL from 'url'; @@ -95,13 +94,9 @@ export async function downloadBrowser(): Promise { if (NPM_NO_PROXY) process.env.NO_PROXY = NPM_NO_PROXY; function onSuccess(localRevisions: string[]): void { - // Use Intel x86 builds on Apple M1 until native macOS arm64 - // Chromium builds are available. - if (os.platform() !== 'darwin' && os.arch() !== 'arm64') { - logPolitely( - `${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}` - ); - } + logPolitely( + `${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}` + ); localRevisions = localRevisions.filter( (revision) => revision !== revisionInfo.revision );