diff --git a/CHANGELOG.md b/CHANGELOG.md index e2652931..1138da27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Estonian Translation. - Add test for compliments module for parts of day - Korean Translation. +- Added console warning on startup when deprecated config options are used ### Fixed diff --git a/js/app.js b/js/app.js index c21935ea..43cbc5c9 100644 --- a/js/app.js +++ b/js/app.js @@ -62,6 +62,7 @@ var App = function() { try { fs.accessSync(configFilename, fs.F_OK); var c = require(configFilename); + checkDeprecatedOptions(c); var config = Object.assign(defaults, c); callback(config); } catch (e) { @@ -78,6 +79,27 @@ var App = function() { } }; + var checkDeprecatedOptions = function(userConfig) { + var deprecated = require(global.root_path + "/js/deprecated.js"); + var deprecatedOptions = deprecated.configs; + + var usedDeprecated = []; + + deprecatedOptions.forEach(function(option) { + if (userConfig.hasOwnProperty(option)) { + usedDeprecated.push(option); + } + }); + + if (usedDeprecated.length > 0) { + console.warn(deprecated.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.") + ); + } + } + /* loadModule(module) * Loads a specific module. * diff --git a/js/deprecated.js b/js/deprecated.js new file mode 100644 index 00000000..5df1d71f --- /dev/null +++ b/js/deprecated.js @@ -0,0 +1,17 @@ +/* Magic Mirror Deprecated Config Options List + * + * By Michael Teeuw http://michaelteeuw.nl + * MIT Licensed. + * + * 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 ***************/ +if (typeof module !== "undefined") {module.exports = deprecated;} diff --git a/package.json b/package.json index e687ecb8..704f8394 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "time-grunt": "latest" }, "dependencies": { + "colors": "^1.1.2", "electron": "^1.4.7", "express": "^4.14.0", "express-ipfilter": "latest",