2020-04-22 14:33:36 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
set -e
|
|
|
|
|
2020-06-29 15:13:24 +00:00
|
|
|
ROOTDIR="$(pwd)"
|
2020-04-22 14:33:36 +00:00
|
|
|
# Pack the module into a tarball
|
|
|
|
npm pack
|
|
|
|
tarball="$(realpath puppeteer-*.tgz)"
|
2020-06-25 13:24:46 +00:00
|
|
|
TMPDIR="$(mktemp -d)"
|
|
|
|
cd $TMPDIR
|
2020-04-22 14:33:36 +00:00
|
|
|
# Check we can install from the tarball.
|
|
|
|
# This emulates installing from npm and ensures that:
|
|
|
|
# 1. we publish the right files in the `files` list from package.json
|
|
|
|
# 2. The install script works and correctly exits without errors
|
|
|
|
# 3. Requiring Puppeteer from Node works.
|
|
|
|
npm install --loglevel silent "${tarball}"
|
|
|
|
node --eval="require('puppeteer')"
|
2020-06-25 13:24:46 +00:00
|
|
|
ls $TMPDIR/node_modules/puppeteer/.local-chromium/
|
2020-06-03 14:00:08 +00:00
|
|
|
|
2022-02-09 07:47:27 +00:00
|
|
|
# Testing ES module features
|
|
|
|
TMPDIR="$(mktemp -d)"
|
|
|
|
cd $TMPDIR
|
|
|
|
echo '{"type":"module"}' >>$TMPDIR/package.json
|
|
|
|
npm install --loglevel silent "${tarball}"
|
|
|
|
node --input-type="module" --eval="import puppeteer from 'puppeteer'"
|
|
|
|
ls $TMPDIR/node_modules/puppeteer/.local-chromium/
|
|
|
|
|
|
|
|
node --input-type="module" --eval="
|
|
|
|
import puppeteer from 'puppeteer';
|
|
|
|
|
|
|
|
(async () => {
|
|
|
|
const browser = await puppeteer.launch();
|
|
|
|
const page = await browser.newPage();
|
|
|
|
await page.goto('http://example.com');
|
|
|
|
await page.screenshot({ path: 'example.png' });
|
|
|
|
await browser.close();
|
|
|
|
})();
|
|
|
|
"
|
|
|
|
|
2020-06-03 14:00:08 +00:00
|
|
|
# Again for Firefox
|
|
|
|
TMPDIR="$(mktemp -d)"
|
|
|
|
cd $TMPDIR
|
|
|
|
PUPPETEER_PRODUCT=firefox npm install --loglevel silent "${tarball}"
|
|
|
|
node --eval="require('puppeteer')"
|
2020-04-22 14:33:36 +00:00
|
|
|
rm "${tarball}"
|
2020-08-10 08:22:31 +00:00
|
|
|
ls $TMPDIR/node_modules/puppeteer/.local-firefox/linux-*/firefox/firefox
|
2020-06-29 15:13:24 +00:00
|
|
|
|
|
|
|
# Again for puppeteer-core
|
|
|
|
cd $ROOTDIR
|
|
|
|
node ./utils/prepare_puppeteer_core.js
|
|
|
|
npm pack
|
|
|
|
tarball="$(realpath puppeteer-core-*.tgz)"
|
|
|
|
TMPDIR="$(mktemp -d)"
|
|
|
|
cd $TMPDIR
|
|
|
|
# Check we can install from the tarball.
|
|
|
|
# This emulates installing from npm and ensures that:
|
|
|
|
# 1. we publish the right files in the `files` list from package.json
|
|
|
|
# 2. The install script works and correctly exits without errors
|
|
|
|
# 3. Requiring Puppeteer Core from Node works.
|
|
|
|
npm install --loglevel silent "${tarball}"
|
|
|
|
node --eval="require('puppeteer-core')"
|
|
|
|
|
2022-02-09 07:47:27 +00:00
|
|
|
# Testing ES module features
|
|
|
|
TMPDIR="$(mktemp -d)"
|
|
|
|
cd $TMPDIR
|
|
|
|
echo '{"type":"module"}' >>$TMPDIR/package.json
|
|
|
|
npm install --loglevel silent "${tarball}"
|
|
|
|
node --input-type="module" --eval="import puppeteer from 'puppeteer-core'"
|