2017-06-28 13:35:14 +03:00
|
|
|
#!/usr/bin/env node
|
2019-05-19 17:23:43 +03:00
|
|
|
|
|
|
|
// This generates src/stripped-emoji.json as used by the EmojiProvider autocomplete
|
|
|
|
// provider.
|
|
|
|
|
2019-05-19 22:48:18 +03:00
|
|
|
const EMOJIBASE = require('emojibase-data/en/compact.json');
|
2019-05-19 17:23:43 +03:00
|
|
|
|
2017-06-28 13:35:14 +03:00
|
|
|
const fs = require('fs');
|
|
|
|
|
2019-05-19 22:48:18 +03:00
|
|
|
const output = EMOJIBASE.map(
|
|
|
|
(datum) => {
|
2017-06-29 13:29:55 +03:00
|
|
|
const newDatum = {
|
2019-05-19 22:48:18 +03:00
|
|
|
name: datum.annotation,
|
|
|
|
shortname: `:${datum.shortcodes[0]}:`,
|
|
|
|
category: datum.group,
|
|
|
|
emoji_order: datum.order,
|
2017-06-28 13:35:14 +03:00
|
|
|
};
|
2019-05-19 22:48:18 +03:00
|
|
|
if (datum.shortcodes.length > 1) {
|
|
|
|
newDatum.aliases = datum.shortcodes.slice(1).map(s => `:${s}:`);
|
2018-07-24 19:06:45 +03:00
|
|
|
}
|
2019-05-19 22:48:18 +03:00
|
|
|
if (datum.emoticon) {
|
|
|
|
newDatum.aliases_ascii = [ datum.emoticon ];
|
2017-06-29 13:29:55 +03:00
|
|
|
}
|
|
|
|
return newDatum;
|
|
|
|
}
|
2019-05-19 22:48:18 +03:00
|
|
|
);
|
2017-06-28 13:35:14 +03:00
|
|
|
|
2017-06-28 15:44:44 +03: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 15:28:48 +03:00
|
|
|
fs.writeFileSync('./src/stripped-emoji.json', JSON.stringify(output));
|