Compare commits

...

12 Commits

Author SHA1 Message Date
Nolan Lawson faa4e500cb 1.6.0 2023-12-03 15:24:03 -08:00
Nolan Lawson 44b05162c7
feat: update to emojibase-data 15.3.0 (#8) 2023-12-03 15:22:09 -08:00
Nolan Lawson 303cec94a0 1.5.0 2023-10-07 11:42:46 -07:00
Nolan Lawson fbe44aeba8
feat: update to emojibase-data 15.2.0 (#7) 2023-10-07 11:41:50 -07:00
Nolan Lawson f57420ce88 1.4.0 2023-06-10 20:19:37 -07:00
Nolan Lawson d3ab343040
feat: update to emojibase-data v15 (#4) 2023-06-10 20:19:21 -07:00
Nolan Lawson 2e8d74a9a0
chore: remove rimraf/mkdirp (#5) 2023-06-10 20:16:35 -07:00
Nolan Lawson d7ca66133a
chore: add github actions (#6) 2023-06-10 19:30:14 -07:00
Nolan Lawson 1d48151e61 1.3.0 2021-12-20 13:20:57 -08:00
Nolan Lawson 3918a5c7b5
feat: update to emojibase-data v7 (#3) 2021-12-20 13:20:32 -08:00
Nolan Lawson 6314fbf6f8 1.2.0 2021-05-14 07:00:22 -07:00
Nolan Lawson 6f3e028093
feat: update to emojibase-data 6.2.0 (#2)
* feat: update to emojibase-data 6.2.0

* fix: fixup
2021-05-14 06:59:52 -07:00
5 changed files with 59 additions and 108 deletions

18
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Build
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '20'
cache: 'yarn'
- run: yarn --frozen-lockfile

4
.gitignore vendored
View File

@ -1,3 +1,4 @@
/bn
/da
/de
/en
@ -7,6 +8,7 @@
/et
/fi
/fr
/hi
/hu
/it
/ja
@ -24,4 +26,4 @@
/zh
/zh-hant
/node_modules
/.idea
/.idea

View File

@ -1,13 +1,11 @@
import process from 'process'
import fs from 'fs'
import path from 'path'
import rimraf from 'rimraf'
import mkdirp from 'mkdirp'
import process from 'node:process'
import fs from 'node:fs'
import path from 'node:path'
const IGNORE_FOLDERS = ['meta', 'versions']
const IGNORE_FOLDERS = ['meta', 'messages', 'versions']
const emojiKeys = new Set([
'annotation',
'label',
'emoji',
'emoticon',
'group',
@ -27,14 +25,13 @@ async function main () {
.filter(file => fs.statSync(path.resolve(emojibaseDir, file)).isDirectory())
for (const lang of langs) {
rimraf.sync(path.resolve('./', lang))
fs.rmSync(path.resolve('./', lang), { recursive: true, force: true })
const shortcodeFiles = fs.readdirSync(path.resolve(emojibaseDir, lang, 'shortcodes'))
.filter(_ => _.endsWith('.json'))
const baseData = JSON.parse(fs.readFileSync(path.resolve(emojibaseDir, lang, 'data.json'), 'utf8'))
for (const shortcodeFile of shortcodeFiles) {
const shortcodeData = JSON.parse(fs.readFileSync(
path.resolve(emojibaseDir, lang, 'shortcodes', shortcodeFile),
'utf8'
))
const fullShortcodeFilename = path.resolve(emojibaseDir, lang, 'shortcodes', shortcodeFile)
const shortcodeData = JSON.parse(fs.readFileSync(fullShortcodeFilename, 'utf8'))
const outData = baseData
.filter(emoji => 'group' in emoji) // skip odd emoji with no group, e.g. regional indicator (1F1E6)
@ -53,7 +50,23 @@ async function main () {
// trim keys we don't need
for (const key of Object.keys(emoji)) {
if (emojiKeys.has(key)) {
if (key === 'skins') {
if (key === 'label') {
// Rename to annotation for backwards compat for pre-v7
// https://github.com/milesj/emojibase/blob/master/packages/data/CHANGELOG.md#700---2021-10-15
// TODO: breaking change to rename this
outEmoji.annotation = emoji[key]
} else if (key === 'emoticon') {
// In case of an array, just take one string for backwards compat for pre-v7
// https://github.com/milesj/emojibase/blob/master/packages/data/CHANGELOG.md#700---2021-10-15
// TODO: breaking change to allow arrays as well as strings
if (Array.isArray(emoji[key])) {
// These are usually just variations on the capitalization, with the capitalized version last,
// which in my opinion usually looks best (e.g. "XD" instead of "xD", "XO" instead of "xo")
outEmoji[key] = emoji[key][emoji[key].length - 1]
} else {
outEmoji[key] = emoji[key]
}
} else if (key === 'skins') {
const skins = []
for (const skin of emoji.skins) {
const outSkin = {}
@ -74,7 +87,7 @@ async function main () {
return outEmoji
})
const outPath = path.resolve('./', lang, shortcodeFile.replace('.json', ''))
mkdirp.sync(outPath)
fs.mkdirSync(outPath, { recursive: true })
fs.writeFileSync(path.resolve(outPath, 'data.json'), JSON.stringify(outData), 'utf8')
}
}

View File

@ -1,6 +1,6 @@
{
"name": "emoji-picker-element-data",
"version": "1.1.0",
"version": "1.6.0",
"description": "JSON files built from emojibase-data, designed for emoji-picker-element",
"type": "module",
"scripts": {
@ -17,9 +17,7 @@
"author": "Nolan Lawson <nolan@nolanlawson.com>",
"license": "Apache-2.0",
"devDependencies": {
"emojibase-data": "6.1.1",
"mkdirp": "^1.0.4",
"rimraf": "^3.0.2"
"emojibase-data": "15.3.0"
},
"repository": {
"type": "git",
@ -28,5 +26,9 @@
"bugs": {
"url": "https://github.com/nolanlawson/emoji-picker-element-data/issues"
},
"homepage": "https://github.com/nolanlawson/emoji-picker-element-data#readme"
"homepage": "https://github.com/nolanlawson/emoji-picker-element-data#readme",
"volta": {
"node": "20.10.0",
"yarn": "1.22.19"
}
}

View File

@ -2,91 +2,7 @@
# yarn lockfile v1
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
emojibase-data@6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/emojibase-data/-/emojibase-data-6.1.1.tgz#6b4720a411b61f770ee89e53869a40bc0b789142"
integrity sha512-AS1f4ugCUuXrHED1fjCOGW5e8fkiqMN3ZqHosWQSEKAlXiqvL+g4UCn78BSr/glsNaPHuj5NdojmBBqW4Z04kQ==
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
glob@^7.1.3:
version "7.1.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
dependencies:
brace-expansion "^1.1.7"
mkdirp@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
once@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
dependencies:
wrappy "1"
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
rimraf@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a"
integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==
dependencies:
glob "^7.1.3"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
emojibase-data@15.3.0:
version "15.3.0"
resolved "https://registry.yarnpkg.com/emojibase-data/-/emojibase-data-15.3.0.tgz#250d071eeea8365be34c4c3bf5294749277f5f1b"
integrity sha512-cYsGq57W8wOd1CqQCjmtP1DpmlTVvJY+Um5UobWUQuTnqb8cO2cuqrxJxSIqxLcYZ3rtialT5kivoWigszdslg==