Skip to content

🎥 Make videos programmatically with React

Fix unqoute -> unquote

Aarni Koskelacad9bc624c00
diff --git a/packages/google-fonts/scripts/generate-index.ts b/packages/google-fonts/scripts/generate-index.ts
index df51315a74..f1ba12a212 100644
--- a/packages/google-fonts/scripts/generate-index.ts
+++ b/packages/google-fonts/scripts/generate-index.ts
@@ -2,7 +2,7 @@ import fs from "node:fs";
import path from "path";
import prettier from "prettier";
import { googleFonts } from "./google-fonts";
-import { removeWhitespace, unqoute } from "./utils";
+import { removeWhitespace, unquote } from "./utils";
const OUTDIR = "./src";
@@ -13,8 +13,8 @@ const generate = async () => {
console.log(`- Generating ${filename}`);
let output = `export const getAvailableFonts = () => ${JSON.stringify(
googleFonts.map((f) => ({
- fontFamily: unqoute(f.family),
- importName: removeWhitespace(unqoute(f.family)),
+ fontFamily: unquote(f.family),
+ importName: removeWhitespace(unquote(f.family)),
})),
null,
2
@@ -38,13 +38,13 @@ const generate = async () => {
for (const font of googleFonts) {
if (!read.typesVersions) read.typesVersions = {};
if (!read.typesVersions[">=1.0"]) read.typesVersions[">=1.0"] = {};
- read.typesVersions[">=1.0"][removeWhitespace(unqoute(font.family))] = [
- `dist/${removeWhitespace(unqoute(font.family))}.d.ts`,
+ read.typesVersions[">=1.0"][removeWhitespace(unquote(font.family))] = [
+ `dist/${removeWhitespace(unquote(font.family))}.d.ts`,
];
if (!read.exports) read.exports = {};
read.exports[
- `./${removeWhitespace(unqoute(font.family))}`
- ] = `./dist/${removeWhitespace(unqoute(font.family))}.js`;
+ `./${removeWhitespace(unquote(font.family))}`
+ ] = `./dist/${removeWhitespace(unquote(font.family))}.js`;
}
read.exports["."] = `./dist/index.js`;
diff --git a/packages/google-fonts/scripts/generate.ts b/packages/google-fonts/scripts/generate.ts
index 1acaf9ff7a..e653a5c613 100644
--- a/packages/google-fonts/scripts/generate.ts
+++ b/packages/google-fonts/scripts/generate.ts
@@ -12,7 +12,7 @@ type FontInfo = {
fonts: Record<string, Record<string, Record<string, string>>>;
};
-import { getCssLink, unqoute, quote, removeWhitespace } from "./utils";
+import { getCssLink, unquote, quote, removeWhitespace } from "./utils";
import { Font, googleFonts } from "./google-fonts";
const OUTDIR = "./src";
@@ -31,7 +31,7 @@ const generate = async (font: Font) => {
// Read css from cache, otherwise from url
let css: null | string = null;
- let fontFamily: null | string = unqoute(font.family);
+ let fontFamily: null | string = unquote(font.family);
let cssFile = path.resolve(CSS_CACHE_DIR, cssname);
if (!fs.existsSync(cssFile)) {
// Get from url with user agent that support woff2
@@ -74,9 +74,9 @@ const generate = async (font: Font) => {
// Parse fontFamily
node.walkDecls("font-fontFamily", (decl, _) => {
- if (font.family != unqoute(decl.value)) {
+ if (font.family != unquote(decl.value)) {
throw new Error(
- `Font fontFamily value mismatch: ${font.family} with ${unqoute(
+ `Font fontFamily value mismatch: ${font.family} with ${unquote(
decl.value
)}`
);
diff --git a/packages/google-fonts/scripts/utils.ts b/packages/google-fonts/scripts/utils.ts
index 25a2e3e1ed..ffaa350907 100644
--- a/packages/google-fonts/scripts/utils.ts
+++ b/packages/google-fonts/scripts/utils.ts
@@ -1,6 +1,6 @@
import { Font } from "./google-fonts";
-export const unqoute = (str: string) =>
+export const unquote = (str: string) =>
str.replace(/^['"]/g, "").replace(/['"]$/g, "");
export const quote = (str: string) => `'${str}'`;