mirror of
https://github.com/flynx/colors.js.git
synced 2025-10-28 18:40:09 +00:00
Remove another dynamic require and add similar deprecation notice
This commit is contained in:
parent
a8ce90c51c
commit
2894751d40
@ -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
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "colors",
|
||||
"version": "1.2.2",
|
||||
"version": "1.3.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user