Skip to content

Commit

Permalink
Convert rocketchat-file to main module structure (#12644)
Browse files Browse the repository at this point in the history
* Convert rocketchat-file to main module structure

* Import RocketChatFile in packages that use it
  • Loading branch information
MarcosSpessatto authored and rodrigok committed Nov 16, 2018
1 parent bda3f7a commit 515a372
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 12 deletions.
11 changes: 4 additions & 7 deletions packages/rocketchat-file/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ Package.describe({
});

Package.onUse(function(api) {
api.use('rocketchat:lib');
api.use('rocketchat:version');
api.use('ecmascript');

api.addFiles('file.server.js', 'server');

api.export('RocketChatFile', 'server');
api.use([
'ecmascript',
]);
api.mainModule('server/index.js', 'server');
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import mkdirp from 'mkdirp';
Grid.prototype.tryParseObjectId = function() {
return false;
};
// TODO: REMOVE RocketChatFile from globals
RocketChatFile = {};

const RocketChatFile = {};

RocketChatFile.bufferToStream = function(buffer) {
const bufferStream = new stream.PassThrough();
Expand Down Expand Up @@ -229,3 +229,5 @@ RocketChatFile.FileSystem = class {
}
}
};

export { RocketChatFile };
3 changes: 3 additions & 0 deletions packages/rocketchat-file/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { RocketChatFile } from './file.server';

export { RocketChatFile };
1 change: 1 addition & 0 deletions packages/rocketchat-importer-csv/server/importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
SelectionChannel,
SelectionUser,
} from 'meteor/rocketchat:importer';
import { RocketChatFile } from 'meteor/rocketchat:file';

export class CsvImporter extends Base {
constructor(info) {
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-importer-hipchat/server/importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SelectionChannel,
SelectionUser,
} from 'meteor/rocketchat:importer';

import { RocketChatFile } from 'meteor/rocketchat:file';
import _ from 'underscore';
import s from 'underscore.string';
import moment from 'moment';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Selection,
SelectionUser,
} from 'meteor/rocketchat:importer';
import { RocketChatFile } from 'meteor/rocketchat:file';

export class SlackUsersImporter extends Base {
constructor(info) {
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-importer-slack/server/importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
SelectionChannel,
SelectionUser,
} from 'meteor/rocketchat:importer';
import { RocketChatFile } from 'meteor/rocketchat:file';

import _ from 'underscore';

Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-ldap/server/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { RocketChatFile } from 'meteor/rocketchat:file';
import _ from 'underscore';
import LDAP from './ldap';

Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-lib/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Package.onUse(function(api) {
api.use('rocketchat:mailer');
api.use('mizzao:timesync');
api.use('rocketchat:custom-oauth');
api.use('rocketchat:file');
api.use('rocketchat:authorization', { unordered: true });
api.use('rocketchat:push-notifications', { unordered: true });

Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-lib/server/functions/setUserAvatar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { HTTP } from 'meteor/http';

import { RocketChatFile } from 'meteor/rocketchat:file';
RocketChat.setUserAvatar = function(user, dataURI, contentType, service) {
let encoding;
let image;
Expand Down
1 change: 1 addition & 0 deletions server/startup/initialData.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { RocketChatFile } from 'meteor/rocketchat:file';
import _ from 'underscore';

Meteor.startup(function() {
Expand Down
2 changes: 1 addition & 1 deletion server/startup/migrations/v002.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* globals getAvatarSuggestionForUser */

import { RocketChatFile } from 'meteor/rocketchat:file';
RocketChat.Migrations.add({
version: 2,
up() {
Expand Down
1 change: 1 addition & 0 deletions server/startup/migrations/v099.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Meteor } from 'meteor/meteor';
import { Match } from 'meteor/check';
import { Mongo } from 'meteor/mongo';
import { RocketChatFile } from 'meteor/rocketchat:file';
import fs from 'fs';
import path from 'path';

Expand Down

0 comments on commit 515a372

Please sign in to comment.