Skip to content

Commit

Permalink
Remove dependency between RocketChat namespace and migrations (#13133)
Browse files Browse the repository at this point in the history
* Move rocketchat settings to specific package

* WIP: Move models from rocketchat-lib to a specific package (server)

* Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models

* Move client models from rocketchat:lib to rocketchat:models

* Fix lint

* Move rocketchat.info from lib to utils

* Remove directly dependency between lib and migrations

* Move statistics Model to rocketchat:models

* Create rocketchat:metrics to be able to depacking rocketchat callbacks

* Move  callbacks to specific package

* Remove unused dependency

* Move rocketchat-notifications to a specific package

* Move rocketchat-promises to a specific package

* remove directly dependency from metrics and models

* Move CachedCollection from lib to models

* Move ui models/collections from ui to models

* Move authorization client/ui models to rocketchat:models to be able to remove lib dependency

* Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz

* Move some common functions to rocketchat:utils

* Change imports to dynamic imports to avoid directly dependency between some packages

* Move authz models to rocketchat:models

* Remove directly dependency between rocketchat:authz and rocketchat:lib

* Move some functions from rocketchat:lib to rocketchat:utils

* Add functions to settings package

* Convert rocketchat:file-upload to main module structure

* Import FileUpload where it is being used

* Remove FileUpload and fileUploadHandler from globals eslintrc

* Move some  functions to rocketchat:ui-utils

* Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils

* Remove dependency between lazy-load and lib

* Change imports of renderMessageBody from ui-message to ui-utils

* Add import of main ready from ui-utils

* Convert rocketchat-ui-sidenav to main module structure

* Add imports of toolbarSearch from ui-sidenav

* Remove toolbarSearch from eslintrc globals

* Move CachedCollection to a specific package

* Change imports of CachedCollection to new package

* Move some functions to rocketchat:ui-utils

* Remove directly dependency between tooltip and lib

*  Remove directly dependency between settings and metrics

* Move some settings client function from lib to settings

* Convert rocketchat-ui-master to main module structure

* Remove directly dependency between rocketchat:e2e and rocketchat:lib

* Fix wrong import and lint

* Convert rocketchat-webrtc to main module structure

* Fix missing export

* Remove directly dependency between rocketchat:emoji and lib

* Add emoji dependencies inside RocketChat namespace

* Merge branch 'develop' into globals/move-rocketchat-callbacks

* Move some functions to utils

* Fix lint

* Move some ui functions to ui-utils

* Fix import missed objects inside RocketChat namespace

* Fix lint

* Remove rocketchat:ui package dependency of RocketChat namespace

* Remove lib dependency in rocketchat:ui-sidenav

* Remove dependency between lib and ui-vrecord

* Add logger dependency in file-upload

* Convert rocketchat:ui to main module structure

* import variables that was broken due to conversion of rocketchat:ui

* Remove globals variables from eslintrc and add some to the eslintrc of livechat app

* Remove dependency between RocketChat namespace and migrations

* Revert commented test file
  • Loading branch information
MarcosSpessatto authored and rodrigok committed Jan 16, 2019
1 parent a71e78d commit aed4583
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/rocketchat-authorization/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import './views/permissionsRole';

export {
hasAllPermission,
hasPermission,
hasAtLeastOnePermission,
hasRole,
hasPermission,
};
1 change: 0 additions & 1 deletion packages/rocketchat-metrics/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'ecmascript',
'rocketchat:migrations',
'rocketchat:version',
]);
api.mainModule('server/index.js', 'server');
Expand Down
8 changes: 6 additions & 2 deletions packages/rocketchat-metrics/server/lib/metrics.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Meteor } from 'meteor/meteor';
import { Migrations } from 'meteor/rocketchat:migrations';
import client from 'prom-client';
import connect from 'connect';
import http from 'http';
Expand All @@ -9,6 +8,7 @@ client.collectDefaultMetrics();

export const metrics = {};
let Info;
let _Migrations;

// one sample metrics only - a counter

Expand Down Expand Up @@ -87,6 +87,10 @@ const setPrometheusData = async() => {
const Utils = await import('meteor/rocketchat:utils');
Info = Utils.Info;
}
if (!_Migrations) {
const { Migrations } = await import('meteor/rocketchat:migrations');
_Migrations = Migrations;
}

client.register.setDefaultLabels({
unique_id: settings.get('uniqueID'),
Expand All @@ -111,7 +115,7 @@ const setPrometheusData = async() => {
}

metrics.version.set({ version: statistics.version }, 1, date);
metrics.migration.set(Migrations._getControl().version, date);
metrics.migration.set(_Migrations._getControl().version, date);
metrics.instanceCount.set(statistics.instanceCount, date);
metrics.oplogEnabled.set({ enabled: statistics.oplogEnabled }, 1, date);

Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-migrations/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Package.onUse(function(api) {
api.use([
'ecmascript',
'rocketchat:version',
'rocketchat:utils',
'logging',
'check',
'mongo',
Expand Down
23 changes: 12 additions & 11 deletions packages/rocketchat-migrations/server/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import { Mongo } from 'meteor/mongo';
import { Log } from 'meteor/logging';
import { Info } from 'meteor/rocketchat:utils';
import _ from 'underscore';
import s from 'underscore.string';
import moment from 'moment';
Expand Down Expand Up @@ -202,14 +203,14 @@ Migrations.migrateTo = function(command) {
'Please make sure you are running the latest version and try again.',
'If the problem persists, please contact support.',
'',
`This Rocket.Chat version: ${ RocketChat.Info.version }`,
`This Rocket.Chat version: ${ Info.version }`,
`Database locked at version: ${ control.version }`,
`Database target version: ${ version === 'latest' ? _.last(this._list).version : version }`,
'',
`Commit: ${ RocketChat.Info.commit.hash }`,
`Date: ${ RocketChat.Info.commit.date }`,
`Branch: ${ RocketChat.Info.commit.branch }`,
`Tag: ${ RocketChat.Info.commit.tag }`,
`Commit: ${ Info.commit.hash }`,
`Date: ${ Info.commit.date }`,
`Branch: ${ Info.commit.branch }`,
`Tag: ${ Info.commit.tag }`,
]));
process.exit(1);
}
Expand Down Expand Up @@ -284,14 +285,14 @@ Migrations._migrateTo = function(version, rerun) {
'Please make sure you are running the latest version and try again.',
'If the problem persists, please contact support.',
'',
`This Rocket.Chat version: ${ RocketChat.Info.version }`,
`This Rocket.Chat version: ${ Info.version }`,
`Database locked at version: ${ control.version }`,
`Database target version: ${ version }`,
'',
`Commit: ${ RocketChat.Info.commit.hash }`,
`Date: ${ RocketChat.Info.commit.date }`,
`Branch: ${ RocketChat.Info.commit.branch }`,
`Tag: ${ RocketChat.Info.commit.tag }`,
`Commit: ${ Info.commit.hash }`,
`Date: ${ Info.commit.date }`,
`Branch: ${ Info.commit.branch }`,
`Tag: ${ Info.commit.tag }`,
]));
process.exit(1);
}
Expand All @@ -301,7 +302,7 @@ Migrations._migrateTo = function(version, rerun) {
function lock() {
const date = new Date();
const dateMinusInterval = moment(date).subtract(self.options.lockExpiration, 'minutes').toDate();
const build = RocketChat.Info ? RocketChat.Info.build.date : date;
const build = Info ? Info.build.date : date;

// This is atomic. The selector ensures only one caller at a time will see
// the unlocked control, and locking occurs in the same update's modifier.
Expand Down
1 change: 0 additions & 1 deletion packages/rocketchat-ui-utils/client/lib/openedRoom.js

This file was deleted.

0 comments on commit aed4583

Please sign in to comment.