diff --git a/CHANGELOG.md b/CHANGELOG.md index fb41a8de..8e92ebf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added option `roundTemp` for currentweather and weatherforecast modules to display temperatures rounded to nearest integer. - Added abilty set the classes option to compliments module for style and text size of compliments. - Added ability to configure electronOptions +- Added console warning on startup when deprecated config options are used ### Updated - Modified translations for Frysk. diff --git a/config/.gitignore b/config/.gitignore index d85e3bd4..daeb6336 100644 --- a/config/.gitignore +++ b/config/.gitignore @@ -1,2 +1,3 @@ * !config.js.sample +!deprecated.js diff --git a/config/deprecated.js b/config/deprecated.js new file mode 100644 index 00000000..cf305582 --- /dev/null +++ b/config/deprecated.js @@ -0,0 +1,12 @@ +/* Magic Mirror Deprecated Config Options List + * + * By Michael Teeuw http://michaelteeuw.nl + * MIT Licensed. + */ + +var deprecated = [ + 'kioskmode' +]; + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== 'undefined') {module.exports = deprecated;} diff --git a/js/app.js b/js/app.js index 29036f69..e5ea72fb 100644 --- a/js/app.js +++ b/js/app.js @@ -42,6 +42,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) { @@ -58,6 +59,21 @@ var App = function() { } }; + var checkDeprecatedOptions = function(userConfig) { + var deprecatedOptions = require(__dirname + "/../config/deprecated.js"); + var usedDeprecated = []; + + deprecatedOptions.forEach(function(option) { + if (userConfig.hasOwnProperty(option)) { + usedDeprecated.push(option); + } + }); + + if (usedDeprecated.length > 0) { + console.error("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. *