🎥 Make videos programmatically with React
generate is now optional
Jonny Burger47f7edbcbad6
diff --git a/packages/google-fonts/package.json b/packages/google-fonts/package.jsonindex 03f66988de..01c94abd5f 100644--- a/packages/google-fonts/package.json+++ b/packages/google-fonts/package.json@@ -5,7 +5,7 @@"main": "dist/cjs/index.js","module": "dist/esm/index.mjs","scripts": {- "build": "pnpm run generate && bun bundle.ts",+ "build": "bun bundle.ts","generate": "bun scripts/generate.ts && bun scripts/generate-index.ts","prepublishOnly": "bun ensure-generation.ts"},diff --git a/packages/google-fonts/scripts/generate.ts b/packages/google-fonts/scripts/generate.tsindex 25338ca0bc..3dd6e625f6 100644--- a/packages/google-fonts/scripts/generate.ts+++ b/packages/google-fonts/scripts/generate.ts@@ -31,25 +31,20 @@ 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)) {- // Get from url with user agent that support woff2- const res = await fetch(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",- },- });-- // Save to cache- const body = await res.text();- await fs.promises.writeFile(cssFile, body);- console.log("Generated", cssFile);-- css = body;- } else {- // Read css from cache- css = await fs.promises.readFile(cssFile, "utf-8");- }+ // Get from url with user agent that support woff2+ const res = await fetch(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",+ },+ });++ // Save to cache+ const body = await res.text();+ await fs.promises.writeFile(cssFile, body);+ console.log("Generated", cssFile);++ css = body;if (!css) {throw new Error("no css");