diff --git a/docs/api.md b/docs/api.md index 34365a56e57ff..a2594048899e2 100644 --- a/docs/api.md +++ b/docs/api.md @@ -371,6 +371,7 @@ In most cases, you'll be fine using the `puppeteer` package. However, you should use `puppeteer-core` if: - you're building another end-user product or library atop of DevTools protocol. For example, one might build a PDF generator using `puppeteer-core` and write a custom `install.js` script that downloads [`headless_shell`](https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md) instead of Chromium to save disk space. - you're bundling Puppeteer to use in Chrome Extension / browser with the DevTools protocol where downloading an additional Chromium binary is unnecessary. +- you're building a set of tools where `puppeteer-core` is one of the ingredients and you want to postpone `install.js` script execution until Chromium is about to be used. When using `puppeteer-core`, remember to change the *include* line: diff --git a/install.js b/install.js index 1e9faf53ad0e2..16974266470a6 100644 --- a/install.js +++ b/install.js @@ -14,10 +14,14 @@ * limitations under the License. */ -// puppeteer-core should not install anything. -if (require('./package.json').name === 'puppeteer-core') - return; - +/** + * This file is part of public API. + * + * By default, the `puppeteer` package runs this script during the installation + * process unless one of the env flags is provided. + * `puppeteer-core` package doesn't include this step at all. However, it's + * still possible to install Chromium using this script when necessary. + */ if (process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD) { logPolitely('**INFO** Skipping Chromium download. "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" environment variable was found.'); return; diff --git a/utils/prepare_puppeteer_core.js b/utils/prepare_puppeteer_core.js index 515731241ca5d..b534dbfd13102 100755 --- a/utils/prepare_puppeteer_core.js +++ b/utils/prepare_puppeteer_core.js @@ -22,4 +22,5 @@ const packagePath = path.join(__dirname, '..', 'package.json'); const json = require(packagePath); json.name = 'puppeteer-core'; +delete json.scripts.install; fs.writeFileSync(packagePath, JSON.stringify(json, null, ' '));