From 2894751d40e66ba3b6ff7930e50f6446c7b3b50f Mon Sep 17 00:00:00 2001 From: DABH Date: Sun, 20 May 2018 15:08:12 -0700 Subject: [PATCH] Remove another dynamic require and add similar deprecation notice --- lib/extendStringPrototype.js | 16 ++++++++-------- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/extendStringPrototype.js b/lib/extendStringPrototype.js index ed608f6..0d48614 100644 --- a/lib/extendStringPrototype.js +++ b/lib/extendStringPrototype.js @@ -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); } diff --git a/package-lock.json b/package-lock.json index 5d856db..85f36a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "colors", - "version": "1.2.2", + "version": "1.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 123e2b0..8b83cf4 100644 --- a/package.json +++ b/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",