Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove another dynamic require and add similar deprecation notice
  • Loading branch information
DABH committed May 20, 2018
1 parent a8ce90c commit 2894751
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions lib/extendStringPrototype.js
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -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",
Expand Down

0 comments on commit 2894751

Please sign in to comment.