mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Merge pull request #737 from roramirez/deprecated-options
Deprecated options
This commit is contained in:
commit
3badafaa82
@ -47,6 +47,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- Estonian Translation.
|
- Estonian Translation.
|
||||||
- Add test for compliments module for parts of day
|
- Add test for compliments module for parts of day
|
||||||
- Korean Translation.
|
- Korean Translation.
|
||||||
|
- Added console warning on startup when deprecated config options are used
|
||||||
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
22
js/app.js
22
js/app.js
@ -62,6 +62,7 @@ var App = function() {
|
|||||||
try {
|
try {
|
||||||
fs.accessSync(configFilename, fs.F_OK);
|
fs.accessSync(configFilename, fs.F_OK);
|
||||||
var c = require(configFilename);
|
var c = require(configFilename);
|
||||||
|
checkDeprecatedOptions(c);
|
||||||
var config = Object.assign(defaults, c);
|
var config = Object.assign(defaults, c);
|
||||||
callback(config);
|
callback(config);
|
||||||
} catch (e) {
|
} 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)
|
/* loadModule(module)
|
||||||
* Loads a specific module.
|
* Loads a specific module.
|
||||||
*
|
*
|
||||||
|
17
js/deprecated.js
Normal file
17
js/deprecated.js
Normal file
@ -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;}
|
@ -44,6 +44,7 @@
|
|||||||
"time-grunt": "latest"
|
"time-grunt": "latest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"colors": "^1.1.2",
|
||||||
"electron": "^1.4.7",
|
"electron": "^1.4.7",
|
||||||
"express": "^4.14.0",
|
"express": "^4.14.0",
|
||||||
"express-ipfilter": "latest",
|
"express-ipfilter": "latest",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user