From cf1a5bf0f757924cbd7620b771b25d3b8b42022a Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Tue, 20 Apr 2021 09:25:26 +0100 Subject: [PATCH 1/2] Add deprecation warning for .coffee settings files --- libraries/settings/Settings.coffee | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libraries/settings/Settings.coffee b/libraries/settings/Settings.coffee index 4e0c26db57..672b89dc73 100755 --- a/libraries/settings/Settings.coffee +++ b/libraries/settings/Settings.coffee @@ -12,8 +12,14 @@ merge = (settings, defaults) -> defaultSettingsPath = path.normalize(__dirname + "/../../config/settings.defaults") -if fs.existsSync("#{defaultSettingsPath}.coffee") or fs.existsSync("#{defaultSettingsPath}.js") - defaults = require(defaultSettingsPath) +if fs.existsSync("#{defaultSettingsPath}.js") + console.log "Using default settings from #{defaultSettingsPath}.js" + defaults = require("#{defaultSettingsPath}.js") + settingsExist = true +else if fs.existsSync("#{defaultSettingsPath}.coffee") + console.warn "CoffeeScript settings file #{defaultSettingsPath}.coffee is deprecated, please convert to JavaScript" + console.log "Using default settings from #{defaultSettingsPath}.coffee" + defaults = require("#{defaultSettingsPath}.coffee") settingsExist = true else defaults = {} @@ -31,6 +37,8 @@ else for file in possibleConfigFiles if fs.existsSync(file) + if file.endsWith('.coffee') + console.warn "CoffeeScript settings file #{file}.coffee is deprecated, please convert to JavaScript" console.log "Using settings from " + file module.exports = merge(require(file), defaults) settingsExist = true From be098ee993e79124cb358410dc31d4daa34454c1 Mon Sep 17 00:00:00 2001 From: Alf Eaton <75253002+aeaton-overleaf@users.noreply.github.com> Date: Mon, 26 Apr 2021 09:09:00 +0100 Subject: [PATCH 2/2] Update Settings.coffee Co-authored-by: nate stemen --- libraries/settings/Settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/settings/Settings.coffee b/libraries/settings/Settings.coffee index 672b89dc73..7b32d24d27 100755 --- a/libraries/settings/Settings.coffee +++ b/libraries/settings/Settings.coffee @@ -38,7 +38,7 @@ else for file in possibleConfigFiles if fs.existsSync(file) if file.endsWith('.coffee') - console.warn "CoffeeScript settings file #{file}.coffee is deprecated, please convert to JavaScript" + console.warn "CoffeeScript settings file #{file} is deprecated, please convert to JavaScript" console.log "Using settings from " + file module.exports = merge(require(file), defaults) settingsExist = true