fix: add country flag emoji on windows

This commit is contained in:
Nolan Lawson 2022-03-27 09:40:58 -07:00
parent fd6bb63450
commit 42a513cccd
5 changed files with 26 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import { getIntl, trimWhitespace } from './getIntl.js'
const __dirname = path.dirname(new URL(import.meta.url).pathname)
const readFile = promisify(fs.readFile)
const writeFile = promisify(fs.writeFile)
const copyFile = promisify(fs.copyFile)
// Try 'en-US' first, then 'en' if that doesn't exist
const PREFERRED_LOCALES = [LOCALE, LOCALE.split('-')[0]]
@ -63,10 +64,20 @@ async function buildManifestJson () {
)
}
async function buildFlagEmojiFile () {
await copyFile(path.resolve(
__dirname,
'../node_modules/country-flag-emoji-polyfill/dist/TwemojiCountryFlags.woff2'
), path.resolve(
__dirname, '../static/TwemojiCountryFlags.woff2'
))
}
async function main () {
await Promise.all([
buildEmojiI18nFile(),
buildManifestJson()
buildManifestJson(),
buildFlagEmojiFile()
])
}

View File

@ -115,6 +115,7 @@
},
"devDependencies": {
"assert": "^2.0.0",
"country-flag-emoji-polyfill": "^0.1.1",
"eslint-plugin-html": "^6.2.0",
"fake-indexeddb": "^3.1.7",
"globby": "^11.0.4",

View File

@ -9,6 +9,7 @@ import { cleanup } from './cleanup.js'
import { wordFilterObservers } from './wordFilterObservers.js'
import { showComposeDialogObservers } from './showComposeDialogObservers.js'
import { badgeObservers } from './badgeObservers.js'
import { countryFlagEmojiPolyfill } from './countryFlagEmojiPolyfill.js'
// These observers can be lazy-loaded when the user is actually logged in.
// Prevents circular dependencies and reduces the size of main.js
@ -24,4 +25,5 @@ export function loggedInObservers () {
showComposeDialogObservers()
badgeObservers()
cleanup()
countryFlagEmojiPolyfill()
}

View File

@ -22,6 +22,10 @@ const ON_DEMAND_CACHE = [
{
regex: /\$polyfill\$/,
cache: WEBPACK_ASSETS
},
{
regex: /TwemojiCountryFlags\.woff2/,
cache: ASSETS
}
]

View File

@ -2415,6 +2415,13 @@ cosmiconfig@^7.0.0:
path-type "^4.0.0"
yaml "^1.10.0"
country-flag-emoji-polyfill@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/country-flag-emoji-polyfill/-/country-flag-emoji-polyfill-0.1.1.tgz#1fab7b364c2631f7e7949fbd98659552f401596e"
integrity sha512-H4iB8BAnlcLxE9mxVXm9vY28zKtqjEYRCO+vz1x4u6IsmomHQd/EQfR/Py0YmxeVYkBAOUPJBcY3KJPd+BQe6Q==
dependencies:
is-emoji-supported "^0.0.5"
cross-env@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"