Remove another dynamic require and add similar deprecation notice

This commit is contained in:
DABH 2018-05-20 15:08:12 -07:00
parent a8ce90c51c
commit 2894751d40
3 changed files with 10 additions and 10 deletions

View File

@ -91,14 +91,14 @@ module['exports'] = function() {
colors.setTheme = function(theme) {
if (typeof theme === 'string') {
try {
colors.themes[theme] = require(theme);
applyTheme(colors.themes[theme]);
return colors.themes[theme];
} catch (err) {
console.log(err);
return err;
}
console.log('colors.setTheme now only accepts an object, not a string. ' +
'If you are trying to set a theme from a file, it is now your (the ' +
'caller\'s) responsibility to require the file. The old syntax ' +
'looked like colors.setTheme(__dirname + ' +
'\'/../themes/generic-logging.js\'); The new syntax looks like '+
'colors.setTheme(require(__dirname + ' +
'\'/../themes/generic-logging.js\'));');
return;
} else {
applyTheme(theme);
}

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "colors",
"version": "1.2.2",
"version": "1.3.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,7 +1,7 @@
{
"name": "colors",
"description": "get colors in your node.js console",
"version": "1.2.5",
"version": "1.3.0",
"author": "Marak Squires",
"homepage": "https://github.com/Marak/colors.js",
"bugs": "https://github.com/Marak/colors.js/issues",