🎥 Make videos programmatically with React
Discard changes to packages/google-fonts/scripts/generate.ts
Jonny Burger5e043ed9e0f7
diff --git a/packages/google-fonts/scripts/generate.ts b/packages/google-fonts/scripts/generate.tsindex dc4fa61084..47d2b9b52d 100644--- a/packages/google-fonts/scripts/generate.ts+++ b/packages/google-fonts/scripts/generate.ts@@ -1,5 +1,6 @@import fs, { mkdirSync } from "node:fs";import path from "path";+import got from "got";import postcss from "postcss";type FontInfo = {@@ -39,22 +40,19 @@ const generate = async (font: Font) => {let css: null | string = null;let fontFamily: null | string = replaceDigitsWithWords(unquote(font.family));let cssFile = path.resolve(CSS_CACHE_DIR, cssname);-if (!fs.existsSync(cssFile)) {- console.log(`- Fetching ${font.family} from ${url}`);// Get from url with user agent that support woff2- const res = await fetch(url, {+ const res = await got.get(url, {headers: {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36",},});- const body = await res.text();// Save to cache- await fs.promises.writeFile(cssFile, body);+ await fs.promises.writeFile(cssFile, res.body);- css = body;+ css = res.body;} else {// Read css from cachecss = await fs.promises.readFile(cssFile, "utf-8");