mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-26 01:55:48 +02:00
Merge pull request #21453 from timvandermeij/puppeteer-skip-download
Don't download Puppeteer browsers on `npm install`
This commit is contained in:
commit
92bd2dbb38
@ -1,9 +1,13 @@
|
|||||||
{
|
{
|
||||||
"chrome": {
|
"chrome": {
|
||||||
"skipDownload": false
|
"skipDownload": true,
|
||||||
|
"version": "stable"
|
||||||
|
},
|
||||||
|
"chrome-headless-shell": {
|
||||||
|
"skipDownload": true
|
||||||
},
|
},
|
||||||
"firefox": {
|
"firefox": {
|
||||||
"skipDownload": false,
|
"skipDownload": true,
|
||||||
"version": "nightly"
|
"version": "nightly"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import {
|
|||||||
downloadManifestFiles,
|
downloadManifestFiles,
|
||||||
verifyManifestFiles,
|
verifyManifestFiles,
|
||||||
} from "./downloadutils.mjs";
|
} from "./downloadutils.mjs";
|
||||||
|
import { execSync } from "child_process";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import istanbulCoverage from "istanbul-lib-coverage";
|
import istanbulCoverage from "istanbul-lib-coverage";
|
||||||
import istanbulReportGenerator from "istanbul-reports";
|
import istanbulReportGenerator from "istanbul-reports";
|
||||||
@ -1095,9 +1096,13 @@ async function startBrowser({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function startBrowsers({ baseUrl, initializeSession, numSessions = 1 }) {
|
async function startBrowsers({ baseUrl, initializeSession, numSessions = 1 }) {
|
||||||
// Remove old browser revisions from Puppeteer's cache. Updating Puppeteer can
|
// Install the browsers.
|
||||||
// cause new browser revisions to be downloaded, so trimming the cache will
|
for (const browser of ["firefox@nightly", "chrome@stable"]) {
|
||||||
// prevent the disk from filling up over time.
|
execSync(`npx puppeteer browsers install ${browser}`, { stdio: "inherit" });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove old browser revisions from Puppeteer's cache. The commands above can
|
||||||
|
// download new browser revisions, so this prevents the disk from filling up.
|
||||||
await puppeteer.trimCache();
|
await puppeteer.trimCache();
|
||||||
|
|
||||||
const browserNames = ["firefox", "chrome"];
|
const browserNames = ["firefox", "chrome"];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user