Remove dependency between RocketChat namespace and migrations (#13133)

* 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
pull/13135/head^2
Marcos Spessatto Defendi 7 years ago committed by Rodrigo Nascimento
parent a71e78d203
commit aed4583ba6
  1. 2
      packages/rocketchat-authorization/client/index.js
  2. 1
      packages/rocketchat-metrics/package.js
  3. 8
      packages/rocketchat-metrics/server/lib/metrics.js
  4. 1
      packages/rocketchat-migrations/package.js
  5. 23
      packages/rocketchat-migrations/server/migrations.js
  6. 1
      packages/rocketchat-ui-utils/client/lib/openedRoom.js

@ -11,7 +11,7 @@ import './views/permissionsRole';
export {
hasAllPermission,
hasPermission,
hasAtLeastOnePermission,
hasRole,
hasPermission,
};

@ -8,7 +8,6 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'ecmascript',
'rocketchat:migrations',
'rocketchat:version',
]);
api.mainModule('server/index.js', 'server');

@ -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';
@ -9,6 +8,7 @@ client.collectDefaultMetrics();
export const metrics = {};
let Info;
let _Migrations;
// one sample metrics only - a counter
@ -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'),
@ -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);

@ -9,6 +9,7 @@ Package.onUse(function(api) {
api.use([
'ecmascript',
'rocketchat:version',
'rocketchat:utils',
'logging',
'check',
'mongo',

@ -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';
@ -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);
}
@ -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);
}
@ -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.

@ -1 +0,0 @@
export let openedRoom; //eslint-disable-line
Loading…
Cancel
Save