Skip to content

Commit

Permalink
fix(cli): use puppeteer pkg so it works out of the box on netlify
Browse files Browse the repository at this point in the history
  • Loading branch information
daKmoR committed Mar 28, 2022
1 parent d2a6698 commit 1968e23
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
"commander": "^9.0.0",
"fs-extra": "^9.0.1",
"gray-matter": "^4.0.3",
"playwright": "^1.15.0",
"plugins-manager": "^0.3.0"
"plugins-manager": "^0.3.0",
"puppeteer": "^13.0.0"
},
"devDependencies": {
"koa-proxy": "^1.0.0-alpha.3"
Expand Down
12 changes: 7 additions & 5 deletions packages/cli/src/RocketBuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { adjustPluginOptions } from 'plugins-manager';
import { existsSync } from 'fs';
import { readFile, unlink, writeFile } from 'fs/promises';

import { chromium } from 'playwright';
import puppeteer from 'puppeteer';

/**
* @param {object} config
Expand Down Expand Up @@ -157,13 +157,15 @@ export class RocketBuild {
try {
await this.engine.start();

const browser = await chromium.launch();
const browser = await puppeteer.launch();
const page = await browser.newPage();

// In 2022 Twitter & Facebook recommend a size of 1200x628 - we capture with 2 dpr for retina displays
const context = await browser.newContext({
viewport: { width: 1200, height: 628 },
await page.setViewport({
width: 1200,
height: 628,
deviceScaleFactor: 2,
});
const page = await context.newPage();

for (const openGraphFile of openGraphFiles) {
const relUrl = path.relative(this.cli.options.outputDevDir, openGraphFile);
Expand Down
25 changes: 24 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3817,6 +3817,11 @@ devtools-protocol@0.0.960912:
resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.960912.tgz#411c1fa355eddb72f06c4a8743f2808766db6245"
integrity sha512-I3hWmV9rWHbdnUdmMKHF2NuYutIM2kXz2mdXW8ha7TbRlGTVs+PF+PsB5QWvpCek4Fy9B+msiispCfwlhG5Sqg==

devtools-protocol@0.0.969999:
version "0.0.969999"
resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.969999.tgz#3d6be0a126b3607bb399ae2719b471dda71f3478"
integrity sha512-6GfzuDWU0OFAuOvBokXpXPLxjOJ5DZ157Ue3sGQQM3LgAamb8m0R0ruSfN0DDu+XG5XJgT50i6zZ/0o8RglreQ==

diff-sequences@^27.5.0:
version "27.5.0"
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.5.0.tgz#a8ac0cb742b17d6f30a6c43e233893a2402c0729"
Expand Down Expand Up @@ -7050,7 +7055,7 @@ playwright-core@=1.18.1:
yauzl "^2.10.0"
yazl "^2.5.1"

playwright@^1.14.0, playwright@^1.15.0:
playwright@^1.14.0:
version "1.20.1"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.20.1.tgz#2796c7d4de10afd39d2ca741a754565291803d4d"
integrity sha512-d/25SFUk6Rkt3h+RU13T7h6o0UTCLKXKYJILWVlC+NmrE7Tvn3LlXxoREfFXVNFikRZWTV60WBCZKgNbj7RfrA==
Expand Down Expand Up @@ -7230,6 +7235,24 @@ puppeteer-core@^13.1.3:
unbzip2-stream "1.4.3"
ws "8.5.0"

puppeteer@^13.0.0:
version "13.5.1"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-13.5.1.tgz#d0f751bf36120efc2ebf74c7562a204a84e500e9"
integrity sha512-wWxO//vMiqxlvuzHMAJ0pRJeDHvDtM7DQpW1GKdStz2nZo2G42kOXBDgkmQ+zqjwMCFofKGesBeeKxIkX9BO+w==
dependencies:
cross-fetch "3.1.5"
debug "4.3.3"
devtools-protocol "0.0.969999"
extract-zip "2.0.1"
https-proxy-agent "5.0.0"
pkg-dir "4.2.0"
progress "2.0.3"
proxy-from-env "1.1.0"
rimraf "3.0.2"
tar-fs "2.1.1"
unbzip2-stream "1.4.3"
ws "8.5.0"

puppeteer@^9.0.0:
version "9.1.1"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-9.1.1.tgz#f74b7facf86887efd6c6b9fabb7baae6fdce012c"
Expand Down

0 comments on commit 1968e23

Please sign in to comment.