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

2
package-lock.json generated
View File

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

View File

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