Skip to content

Commit

Permalink
fix(variable): update failing puppeteer launch (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayuhito authored Dec 29, 2024
1 parent 1fdad8e commit b0e7728
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.cjs

This file was deleted.

Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"p-queue": "^7.4.1",
"pathe": "^1.1.1",
"picocolors": "^1.0.0",
"puppeteer": "^21.1.1",
"puppeteer": "^23.11.1",
"stylis": "^4.3.0",
"zod": "^3.22.2"
},
Expand Down
2 changes: 1 addition & 1 deletion src/license.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const processTable = (tableHTML: string) => {
* {@link https://fonts.google.com/attribution}
*/
export const parseLicenses = async () => {
const browser = await puppeteer.launch({ headless: 'new' });
const browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
// We only need html, skip css and font downloads
await page.setRequestInterception(true);
Expand Down
6 changes: 5 additions & 1 deletion src/variable-gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ const processTable = (tableHTML: string) => {
writeArray.push(results[key]);
}

if (writeArray.length === 0) {
throw new Error('No variable font datapoints found.');
}

fs.writeFileSync(
join(
dirname(fileURLToPath(import.meta.url)),
Expand All @@ -101,7 +105,7 @@ const processTable = (tableHTML: string) => {
*/
export const fetchVariable = async () => {
// Need to use Puppeteer to let JavaScript load page elements fully
const browser = await puppeteer.launch({ headless: 'new' });
const browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle0' });

Expand Down

0 comments on commit b0e7728

Please sign in to comment.