您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

25 行
739 B

  1. const fs = require('fs');
  2. const path = require('path');
  3. // Get emoji data from https://github.com/milesj/emojibase
  4. // https://github.com/milesj/emojibase/blob/master/packages/data/en/data.json
  5. function generate() {
  6. const map = Object.create(null);
  7. const emojis = require(path.join(process.cwd(), 'data.json'));
  8. for (const emoji of emojis) {
  9. if (emoji.shortcodes == null || emoji.shortcodes.length === 0) continue;
  10. for (const code of emoji.shortcodes) {
  11. if (map[code] !== undefined) {
  12. console.warn(code);
  13. }
  14. map[code] = emoji.emoji;
  15. }
  16. }
  17. fs.writeFileSync(path.join(process.cwd(), 'emojis.json'), JSON.stringify(map), 'utf8');
  18. }
  19. generate();