Skip to content

Commit

Permalink
Convert rocketchat-oembed to main module structure (#12775)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosSpessatto authored and rodrigok committed Dec 3, 2018
1 parent eaa001f commit e5c797b
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 34 deletions.
16 changes: 16 additions & 0 deletions packages/rocketchat-oembed/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import './baseWidget.html';
import './baseWidget';
import './oembedImageWidget.html';
import './oembedImageWidget';
import './oembedAudioWidget.html';
import './oembedAudioWidget';
import './oembedVideoWidget.html';
import './oembedVideoWidget';
import './oembedYoutubeWidget.html';
import './oembedYoutubeWidget';
import './oembedUrlWidget.html';
import './oembedUrlWidget';
import './oembedFrameWidget.html';
import './oembedFrameWidget';
import './oembedSandstormGrain.html';
import './oembedSandstormGrain';
1 change: 1 addition & 0 deletions packages/rocketchat-oembed/client/oembedAudioWidget.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';

Template.oembedAudioWidget.helpers({
collapsed() {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-oembed/client/oembedFrameWidget.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';

Template.oembedFrameWidget.helpers({
collapsed() {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-oembed/client/oembedImageWidget.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';

Template.oembedImageWidget.helpers({
loadImage() {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-oembed/client/oembedUrlWidget.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Blaze } from 'meteor/blaze';
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';
import _ from 'underscore';

const getTitle = function(self) {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-oembed/client/oembedVideoWidget.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';

const getTitle = function(self) {
if (self.meta == null) {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-oembed/client/oembedYoutubeWidget.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';

Template.oembedYoutubeWidget.helpers({
collapsed() {
Expand Down
33 changes: 2 additions & 31 deletions packages/rocketchat-oembed/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,6 @@ Package.onUse(function(api) {
'konecty:change-case',
'rocketchat:lib',
]);

api.addFiles('client/baseWidget.html', 'client');
api.addFiles('client/baseWidget.js', 'client');

api.addFiles('client/oembedImageWidget.html', 'client');
api.addFiles('client/oembedImageWidget.js', 'client');

api.addFiles('client/oembedAudioWidget.html', 'client');
api.addFiles('client/oembedAudioWidget.js', 'client');

api.addFiles('client/oembedVideoWidget.html', 'client');
api.addFiles('client/oembedVideoWidget.js', 'client');

api.addFiles('client/oembedYoutubeWidget.html', 'client');
api.addFiles('client/oembedYoutubeWidget.js', 'client');

api.addFiles('client/oembedUrlWidget.html', 'client');
api.addFiles('client/oembedUrlWidget.js', 'client');

api.addFiles('client/oembedFrameWidget.html', 'client');
api.addFiles('client/oembedFrameWidget.js', 'client');

api.addFiles('client/oembedSandstormGrain.html', 'client');
api.addFiles('client/oembedSandstormGrain.js', 'client');

api.addFiles('server/server.js', 'server');
api.addFiles('server/providers.js', 'server');
api.addFiles('server/jumpToMessage.js', 'server');
api.addFiles('server/models/OEmbedCache.js', 'server');

api.export('OEmbed', 'server');
api.mainModule('client/index.js', 'client');
api.mainModule('server/index.js', 'server');
});
8 changes: 8 additions & 0 deletions packages/rocketchat-oembed/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import './models/OEmbedCache';
import './jumpToMessage';
import './providers';
import { OEmbed } from './server';

export {
OEmbed,
};
3 changes: 2 additions & 1 deletion packages/rocketchat-oembed/server/jumpToMessage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* globals getAvatarUrlFromUsername */
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { getAvatarUrlFromUsername } from 'meteor/rocketchat:ui';
import _ from 'underscore';
import URL from 'url';
import QueryString from 'querystring';
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-oembed/server/models/OEmbedCache.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RocketChat } from 'meteor/rocketchat:lib';

RocketChat.models.OEmbedCache = new class extends RocketChat.models._Base {
constructor() {
Expand Down
3 changes: 2 additions & 1 deletion packages/rocketchat-oembed/server/providers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals changeCase */
import { changeCase } from 'meteor/konecty:change-case';
import { RocketChat } from 'meteor/rocketchat:lib';
import _ from 'underscore';
import URL from 'url';
import QueryString from 'querystring';
Expand Down
6 changes: 5 additions & 1 deletion packages/rocketchat-oembed/server/server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* globals HTTPInternals, changeCase */
import { Meteor } from 'meteor/meteor';
import { HTTPInternals } from 'meteor/http';
import { changeCase } from 'meteor/konecty:change-case';
import { RocketChat } from 'meteor/rocketchat:lib';
import _ from 'underscore';
import URL from 'url';
import querystring from 'querystring';
Expand Down Expand Up @@ -294,3 +296,5 @@ RocketChat.settings.get('API_Embed', function(key, value) {
return RocketChat.callbacks.remove('afterSaveMessage', 'API_Embed');
}
});

export { OEmbed };

0 comments on commit e5c797b

Please sign in to comment.