From ddff2b2982f93ecfa6e316c824a4b723895e4951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Tue, 28 Feb 2017 01:41:21 -0300 Subject: [PATCH] Move colors into utils file --- js/app.js | 4 ++-- js/deprecated.js | 3 --- js/utils.js | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 js/utils.js diff --git a/js/app.js b/js/app.js index 43cbc5c9..6c1f6ea2 100644 --- a/js/app.js +++ b/js/app.js @@ -7,6 +7,7 @@ var fs = require("fs"); var Server = require(__dirname + "/server.js"); +var Utils = require(__dirname + "/utils.js"); var defaultModules = require(__dirname + "/../modules/default/defaultmodules.js"); var path = require("path"); @@ -90,9 +91,8 @@ var App = function() { usedDeprecated.push(option); } }); - if (usedDeprecated.length > 0) { - console.warn(deprecated.colors.warn( + console.warn(Utils.colors.warn( "WARNING! Your config is using deprecated options: " + usedDeprecated.join(", ") + ". Check README and CHANGELOG for more up-to-date ways of getting the same functionality.") diff --git a/js/deprecated.js b/js/deprecated.js index 5df1d71f..96f081cd 100644 --- a/js/deprecated.js +++ b/js/deprecated.js @@ -5,12 +5,9 @@ * * Olex S. original idea this deprecated option */ -var colors = require("colors/safe"); -colors.setTheme({warn: "yellow"}) var deprecated = { configs: ["kioskmode"], - colors: colors }; /*************** DO NOT EDIT THE LINE BELOW ***************/ diff --git a/js/utils.js b/js/utils.js new file mode 100644 index 00000000..7f548afa --- /dev/null +++ b/js/utils.js @@ -0,0 +1,17 @@ +/* exported Utils */ +/* Magic Mirror + * Utils + * + * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com + * MIT Licensed. + */ + +var colors = require("colors/safe"); + +var Utils = { + colors: { + warn: colors.yellow + } +}; + +if (typeof module !== "undefined") {module.exports = Utils;}