Skip to content

Commit 2894751

Browse files
committed
Remove another dynamic require and add similar deprecation notice
1 parent a8ce90c commit 2894751

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/extendStringPrototype.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ module['exports'] = function() {
9191

9292
colors.setTheme = function(theme) {
9393
if (typeof theme === 'string') {
94-
try {
95-
colors.themes[theme] = require(theme);
96-
applyTheme(colors.themes[theme]);
97-
return colors.themes[theme];
98-
} catch (err) {
99-
console.log(err);
100-
return err;
101-
}
94+
console.log('colors.setTheme now only accepts an object, not a string. ' +
95+
'If you are trying to set a theme from a file, it is now your (the ' +
96+
'caller\'s) responsibility to require the file. The old syntax ' +
97+
'looked like colors.setTheme(__dirname + ' +
98+
'\'/../themes/generic-logging.js\'); The new syntax looks like '+
99+
'colors.setTheme(require(__dirname + ' +
100+
'\'/../themes/generic-logging.js\'));');
101+
return;
102102
} else {
103103
applyTheme(theme);
104104
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "colors",
33
"description": "get colors in your node.js console",
4-
"version": "1.2.5",
4+
"version": "1.3.0",
55
"author": "Marak Squires",
66
"homepage": "https://github.com/Marak/colors.js",
77
"bugs": "https://github.com/Marak/colors.js/issues",

0 commit comments

Comments
 (0)