chore: move to GitHub hosting for Juggler binaries (#5293)

This commit is contained in:
Mathias Bynens 2020-01-09 15:24:57 +01:00 committed by GitHub
parent c7af7ded66
commit 3a49cfc9f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -27,20 +27,20 @@ const ProxyAgent = require('https-proxy-agent');
// @ts-ignore
const getProxyForUrl = require('proxy-from-env').getProxyForUrl;
const DEFAULT_DOWNLOAD_HOST = 'https://storage.googleapis.com';
const downloadURLs = {
chromium: {
host: 'https://storage.googleapis.com',
linux: '%s/chromium-browser-snapshots/Linux_x64/%s/%s.zip',
mac: '%s/chromium-browser-snapshots/Mac/%s/%s.zip',
win32: '%s/chromium-browser-snapshots/Win/%s/%s.zip',
win64: '%s/chromium-browser-snapshots/Win_x64/%s/%s.zip',
},
firefox: {
linux: '%s/juggler-builds/%s/%s.zip',
mac: '%s/juggler-builds/%s/%s.zip',
win32: '%s/juggler-builds/%s/%s.zip',
win64: '%s/juggler-builds/%s/%s.zip',
host: 'https://github.com/puppeteer/juggler/releases',
linux: '%s/download/%s/%s.zip',
mac: '%s/download/%s/%s.zip',
win32: '%s/download/%s/%s.zip',
win64: '%s/download/%s/%s.zip',
},
};
@ -79,7 +79,8 @@ function archiveName(product, platform, revision) {
* @return {string}
*/
function downloadURL(product, platform, host, revision) {
return util.format(downloadURLs[product][platform], host, revision, archiveName(product, platform, revision));
const url = util.format(downloadURLs[product][platform], host, revision, archiveName(product, platform, revision));
return url;
}
const readdirAsync = helper.promisify(fs.readdir.bind(fs));
@ -103,7 +104,7 @@ class BrowserFetcher {
this._product = (options.product || 'chromium').toLowerCase();
assert(this._product === 'chromium' || this._product === 'firefox', `Unkown product: "${options.product}"`);
this._downloadsFolder = options.path || path.join(projectRoot, '.local-browser');
this._downloadHost = options.host || DEFAULT_DOWNLOAD_HOST;
this._downloadHost = options.host || downloadURLs[this._product].host;
this._platform = options.platform || '';
if (!this._platform) {
const platform = os.platform();

View File

@ -9,7 +9,7 @@
"node": ">=8.9.4"
},
"puppeteer": {
"firefox_revision": "765beffcf39dc68cb2005b2b5343e283e26df7a3"
"firefox_revision": "v0.0.1"
},
"scripts": {
"install": "node install.js",