From 4f62eb858ccc6e9e6e0cb4c6efc176d1e50c44cc Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Sat, 21 Oct 2023 22:01:35 -0700 Subject: [PATCH 1/2] prevent a try catch from hiding a build error --- build/emoji.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/build/emoji.js b/build/emoji.js index 0dc41dc3b..ed579ec77 100644 --- a/build/emoji.js +++ b/build/emoji.js @@ -95,13 +95,9 @@ function writeEmojiJS(emojiData) { console.info('Build emoji'); -try { - const emojiData = await getEmojiData(); +const emojiData = await getEmojiData(); - if (emojiData) { - writeEmojiPage(emojiData); - writeEmojiJS(emojiData); - } -} catch (err) { - console.warn(`- Error: ${err.message}`); +if (emojiData) { + writeEmojiPage(emojiData); + writeEmojiJS(emojiData); } From 505b685d876a0187187cb09435b704394f794f5e Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Sat, 21 Oct 2023 22:42:43 -0700 Subject: [PATCH 2/2] take into account possible CRLF endings in the regex in build/emoji.js just in case it runs in Windows and line endings happen to be CRLF --- build/emoji.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/emoji.js b/build/emoji.js index ed579ec77..d8cc5353e 100644 --- a/build/emoji.js +++ b/build/emoji.js @@ -42,7 +42,8 @@ function writeEmojiPage(emojiData) { const emojiPage = (isExistingPage && fs.readFileSync(filePaths.emojiMarkdown, 'utf8')) || `\n\n`; - const emojiRegEx = /(\n)([\s\S]*)(\n)/; + const emojiRegEx = /(\r?\n)([\s\S]*)(\r?\n)/; + // ^ Note, we use \r? in case Windows converts to CRLF const emojiMatch = emojiPage.match(emojiRegEx); const emojiMarkdownStart = emojiMatch[1].trim(); const emojiMarkdown = emojiMatch[2].trim();