Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make it possible to run install.js script with puppeteer-core #5325

Merged
merged 4 commits into from Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api.md
Expand Up @@ -370,6 +370,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:

Expand Down
4 changes: 0 additions & 4 deletions install.js
Expand Up @@ -14,10 +14,6 @@
* limitations under the License.
*/

// puppeteer-core should not install anything.
if (require('./package.json').name === 'puppeteer-core')
return;

if (process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD) {
logPolitely('**INFO** Skipping Chromium download. "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" environment variable was found.');
return;
Expand Down
1 change: 1 addition & 0 deletions utils/prepare_puppeteer_core.js
Expand Up @@ -22,4 +22,5 @@ const packagePath = path.join(__dirname, '..', 'package.json');
const json = require(packagePath);

json.name = 'puppeteer-core';
delete json.scripts['install'];
gziolo marked this conversation as resolved.
Show resolved Hide resolved
fs.writeFileSync(packagePath, JSON.stringify(json, null, ' '));