From 2baaba07e6521bb4c4182ab2353fa82898ce5640 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 20 Jul 2018 21:14:52 +0300 Subject: [PATCH] move the versions manager to its own module --- lib/core/engine.js | 6 +----- .../library_manager/index.js} | 7 ++----- lib/{versions => modules/library_manager}/npm.js | 0 lib/{versions => modules/library_manager}/npmTimer.js | 4 +--- 4 files changed, 4 insertions(+), 13 deletions(-) rename lib/{versions/library_manager.js => modules/library_manager/index.js} (93%) rename lib/{versions => modules/library_manager}/npm.js (100%) rename lib/{versions => modules/library_manager}/npmTimer.js (98%) diff --git a/lib/core/engine.js b/lib/core/engine.js index 53dc4a3f2..d480fc2c8 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -296,11 +296,7 @@ class Engine { } libraryManagerService(_options) { - const LibraryManager = require('../versions/library_manager.js'); - this.libraryManager = new LibraryManager({ - plugins: this.plugins, - config: this.config - }); + this.registerModule('library_manager'); } } diff --git a/lib/versions/library_manager.js b/lib/modules/library_manager/index.js similarity index 93% rename from lib/versions/library_manager.js rename to lib/modules/library_manager/index.js index 52508c064..55305da63 100644 --- a/lib/versions/library_manager.js +++ b/lib/modules/library_manager/index.js @@ -2,14 +2,11 @@ var Npm = require('./npm.js'); class LibraryManager { - constructor(options) { - this.plugins = options.plugins; - this.config = options.config; + constructor(embark) { + this.config = embark.config; this.contractsConfig = this.config.contractsConfig; this.storageConfig = this.config.storageConfig; - this.embark = this.plugins.createPlugin('libraryManager', {}); - this.determineVersions(); this.registerCommands(); diff --git a/lib/versions/npm.js b/lib/modules/library_manager/npm.js similarity index 100% rename from lib/versions/npm.js rename to lib/modules/library_manager/npm.js diff --git a/lib/versions/npmTimer.js b/lib/modules/library_manager/npmTimer.js similarity index 98% rename from lib/versions/npmTimer.js rename to lib/modules/library_manager/npmTimer.js index 12a58ef9d..c49c75002 100644 --- a/lib/versions/npmTimer.js +++ b/lib/modules/library_manager/npmTimer.js @@ -1,11 +1,9 @@ const {PerformanceObserver, performance} = require('perf_hooks'); require('colors'); const utils = require('../utils/utils.js'); -// TODO: remove this -const i18n = require('../core/i18n/i18n.js'); +const i18n = require('../../core/i18n/i18n.js'); i18n.setOrDetectLocale('en'); - class NpmTimer{ constructor(options){ this._logger = (options.logger && typeof options.logger.info == 'function') ? options.logger : console;