From 018c6f69e84d7cfb6283210d29febcb7f69991f9 Mon Sep 17 00:00:00 2001 From: Marcos Defendi Date: Tue, 13 Nov 2018 09:13:54 -0200 Subject: [PATCH] Convert emoji-emojione to main module structure --- packages/rocketchat-emoji-emojione/client/index.js | 2 ++ .../rocketchat-emoji-emojione/{ => lib}/emojiPicker.js | 10 +++------- .../{ => lib}/generateEmojiIndex.js | 1 + .../rocketchat-emoji-emojione/{ => lib}/rocketchat.js | 4 +++- packages/rocketchat-emoji-emojione/package.js | 8 ++------ packages/rocketchat-emoji-emojione/server/callbacks.js | 3 ++- packages/rocketchat-emoji-emojione/server/index.js | 2 ++ 7 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 packages/rocketchat-emoji-emojione/client/index.js rename packages/rocketchat-emoji-emojione/{ => lib}/emojiPicker.js (99%) rename packages/rocketchat-emoji-emojione/{ => lib}/generateEmojiIndex.js (97%) rename packages/rocketchat-emoji-emojione/{ => lib}/rocketchat.js (89%) create mode 100644 packages/rocketchat-emoji-emojione/server/index.js diff --git a/packages/rocketchat-emoji-emojione/client/index.js b/packages/rocketchat-emoji-emojione/client/index.js new file mode 100644 index 000000000000..f7ece04fae69 --- /dev/null +++ b/packages/rocketchat-emoji-emojione/client/index.js @@ -0,0 +1,2 @@ +import './sprites.css'; +import '../lib/rocketchat'; diff --git a/packages/rocketchat-emoji-emojione/emojiPicker.js b/packages/rocketchat-emoji-emojione/lib/emojiPicker.js similarity index 99% rename from packages/rocketchat-emoji-emojione/emojiPicker.js rename to packages/rocketchat-emoji-emojione/lib/emojiPicker.js index 08e552c4f47f..72125682f1a7 100644 --- a/packages/rocketchat-emoji-emojione/emojiPicker.js +++ b/packages/rocketchat-emoji-emojione/lib/emojiPicker.js @@ -1,9 +1,7 @@ -/* globals emojisByCategory:true, emojiCategories:true, toneList:true */ - /* * Mapping category hashes into human readable and translated names */ -emojiCategories = { +export const emojiCategories = { people: 'Smileys_and_People', nature: 'Animals_and_Nature', food: 'Food_and_Drink', @@ -14,7 +12,7 @@ emojiCategories = { flags: 'Flags', }; -toneList = { +export const toneList = { raised_hands: 1, clap: 1, wave: 1, @@ -101,7 +99,7 @@ toneList = { juggling: 1, }; -emojisByCategory = { +export const emojisByCategory = { people: [ 'grinning', 'grimacing', @@ -1525,5 +1523,3 @@ emojisByCategory = { 'flag_mf', ], }; - -/* exported emojisByCategory, emojiCategories, toneList */ diff --git a/packages/rocketchat-emoji-emojione/generateEmojiIndex.js b/packages/rocketchat-emoji-emojione/lib/generateEmojiIndex.js similarity index 97% rename from packages/rocketchat-emoji-emojione/generateEmojiIndex.js rename to packages/rocketchat-emoji-emojione/lib/generateEmojiIndex.js index f9b4a6c5ac08..8296f60fa401 100644 --- a/packages/rocketchat-emoji-emojione/generateEmojiIndex.js +++ b/packages/rocketchat-emoji-emojione/lib/generateEmojiIndex.js @@ -1,3 +1,4 @@ +/* eslint-disable */ // emoji.json from emojione@2.2.6 import fs from 'fs'; diff --git a/packages/rocketchat-emoji-emojione/rocketchat.js b/packages/rocketchat-emoji-emojione/lib/rocketchat.js similarity index 89% rename from packages/rocketchat-emoji-emojione/rocketchat.js rename to packages/rocketchat-emoji-emojione/lib/rocketchat.js index f2636c6ff451..552cac6ee8a4 100644 --- a/packages/rocketchat-emoji-emojione/rocketchat.js +++ b/packages/rocketchat-emoji-emojione/lib/rocketchat.js @@ -1,6 +1,8 @@ -/* globals emojione, emojisByCategory, emojiCategories, toneList */ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; +import { RocketChat } from 'meteor/rocketchat:lib'; +import { emojione } from 'meteor/emojione:emojione'; +import { emojisByCategory, emojiCategories, toneList } from './emojiPicker'; RocketChat.emoji.packages.emojione = emojione; RocketChat.emoji.packages.emojione.imageType = 'png'; diff --git a/packages/rocketchat-emoji-emojione/package.js b/packages/rocketchat-emoji-emojione/package.js index 83d58382488e..7c6d7a111b84 100644 --- a/packages/rocketchat-emoji-emojione/package.js +++ b/packages/rocketchat-emoji-emojione/package.js @@ -13,10 +13,6 @@ Package.onUse(function(api) { 'rocketchat:lib', ]); - api.addFiles('emojiPicker.js'); - - api.addFiles('rocketchat.js'); - - api.addFiles('client/sprites.css', 'client'); - api.addFiles('server/callbacks.js', 'server'); + api.mainModule('client/index.js', 'client'); + api.mainModule('server/index.js', 'server'); }); diff --git a/packages/rocketchat-emoji-emojione/server/callbacks.js b/packages/rocketchat-emoji-emojione/server/callbacks.js index fb9de727e019..2c0edcadee73 100644 --- a/packages/rocketchat-emoji-emojione/server/callbacks.js +++ b/packages/rocketchat-emoji-emojione/server/callbacks.js @@ -1,5 +1,6 @@ -/* globals emojione */ import { Meteor } from 'meteor/meteor'; +import { RocketChat } from 'meteor/rocketchat:lib'; +import { emojione } from 'meteor/emojione:emojione'; Meteor.startup(function() { RocketChat.callbacks.add('beforeSendMessageNotifications', (message) => emojione.shortnameToUnicode(message)); diff --git a/packages/rocketchat-emoji-emojione/server/index.js b/packages/rocketchat-emoji-emojione/server/index.js new file mode 100644 index 000000000000..c8e0898cfc01 --- /dev/null +++ b/packages/rocketchat-emoji-emojione/server/index.js @@ -0,0 +1,2 @@ +import '../lib/rocketchat'; +import './callbacks';