mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 22:10:22 +00:00
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
"use strict";
|
|
|
|
const got = require("got");
|
|
const path = require("path");
|
|
const fs = require("fs");
|
|
|
|
// same regex as found in client/../parse.js
|
|
const emojiModifiersRegex = /[\u{1f3fb}-\u{1f3ff}]|\u{fe0f}/gu;
|
|
|
|
(async () => {
|
|
const response = await got(
|
|
"https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json"
|
|
);
|
|
const emojiStrategy = JSON.parse(response.body);
|
|
const emojiMap = {};
|
|
const fullNameEmojiMap = {};
|
|
|
|
for (const emoji of emojiStrategy) {
|
|
const cleanEmoji = emoji.emoji.replace(emojiModifiersRegex, "");
|
|
fullNameEmojiMap[cleanEmoji] = emoji.description;
|
|
|
|
for (const alias of emoji.aliases) {
|
|
emojiMap[alias] = emoji.emoji;
|
|
}
|
|
}
|
|
|
|
const emojiMapOutput = JSON.stringify(emojiMap, null, 2) + "\n";
|
|
const fullNameEmojiMapOutput = JSON.stringify(fullNameEmojiMap, null, 2) + "\n";
|
|
|
|
fs.writeFileSync(
|
|
path.resolve(path.join(__dirname, "..", "client", "js", "helpers", "simplemap.json")),
|
|
emojiMapOutput
|
|
);
|
|
|
|
fs.writeFileSync(
|
|
path.resolve(path.join(__dirname, "..", "client", "js", "helpers", "fullnamemap.json")),
|
|
fullNameEmojiMapOutput
|
|
);
|
|
})();
|