2017-06-28 12:35:14 +02:00
|
|
|
#!/usr/bin/env node
|
2019-05-19 16:23:43 +02:00
|
|
|
|
|
|
|
// This generates src/stripped-emoji.json as used by the EmojiProvider autocomplete
|
|
|
|
// provider.
|
|
|
|
|
|
|
|
// FIXME: we no longer depends on emojione, so this generation script no longer
|
|
|
|
// works, but the expectation is that we will shift to using emojimart or
|
|
|
|
// similar as an emoji picker before this next needs to be run again.
|
|
|
|
|
2017-06-28 12:35:14 +02:00
|
|
|
const EMOJI_DATA = require('emojione/emoji.json');
|
2017-07-05 18:09:16 +02:00
|
|
|
const EMOJI_SUPPORTED = Object.keys(require('emojione').emojioneList);
|
2017-06-28 12:35:14 +02:00
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
const output = Object.keys(EMOJI_DATA).map(
|
|
|
|
(key) => {
|
|
|
|
const datum = EMOJI_DATA[key];
|
2017-06-29 12:29:55 +02:00
|
|
|
const newDatum = {
|
2017-06-28 12:35:14 +02:00
|
|
|
name: datum.name,
|
|
|
|
shortname: datum.shortname,
|
|
|
|
category: datum.category,
|
|
|
|
emoji_order: datum.emoji_order,
|
|
|
|
};
|
2018-07-24 18:06:45 +02:00
|
|
|
if (datum.aliases.length > 0) {
|
|
|
|
newDatum.aliases = datum.aliases;
|
|
|
|
}
|
2017-06-29 12:29:55 +02:00
|
|
|
if (datum.aliases_ascii.length > 0) {
|
|
|
|
newDatum.aliases_ascii = datum.aliases_ascii;
|
|
|
|
}
|
|
|
|
return newDatum;
|
|
|
|
}
|
2017-07-05 18:09:16 +02:00
|
|
|
).filter((datum) => {
|
|
|
|
return EMOJI_SUPPORTED.includes(datum.shortname);
|
|
|
|
});
|
2017-06-28 12:35:14 +02:00
|
|
|
|
2017-06-28 14:44:44 +02:00
|
|
|
// Write to a file in src. Changes should be checked into git. This file is copied by
|
|
|
|
// babel using --copy-files
|
2017-06-28 14:28:48 +02:00
|
|
|
fs.writeFileSync('./src/stripped-emoji.json', JSON.stringify(output));
|