From eaf8c35f40a05038a33526de3570ee36443d021f Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Fri, 2 Mar 2018 18:59:37 +0200 Subject: [PATCH] Warn about old config folder --- src/command-line/index.js | 2 ++ src/command-line/utils.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/command-line/index.js b/src/command-line/index.js index d83ecd7e..b052a431 100644 --- a/src/command-line/index.js +++ b/src/command-line/index.js @@ -35,6 +35,8 @@ if (!fs.existsSync(path.join( Helper.setHome(process.env.THELOUNGE_HOME || Utils.defaultHome()); +Utils.checkOldHome(); + // Merge config key-values passed as CLI options into the main config _.merge(Helper.config, program.config); diff --git a/src/command-line/utils.js b/src/command-line/utils.js index e598ecdf..f27c10f5 100644 --- a/src/command-line/utils.js +++ b/src/command-line/utils.js @@ -20,6 +20,23 @@ class Utils { ].forEach((e) => log.raw(e)); } + // TODO: Remove in a couple of releases + static checkOldHome() { + const currentHome = Helper.getHomePath(); + const oldHome = currentHome.replace(/\.thelounge$/, ".lounge"); + + if (currentHome === oldHome || !fs.existsSync(oldHome)) { + return; + } + + console.log(); // eslint-disable-line no-console + log.warn(`Folder ${colors.bold.red(oldHome)} still exists.`); + log.warn(`In v3, we renamed the default configuration folder to ${colors.bold.green(".thelounge")} for consistency.`); + log.warn(`You might want to rename the folder from ${colors.bold.red(".lounge")} to ${colors.bold.green(".thelounge")} to keep existing configuration.`); + log.warn("Make sure to look at the release notes to see other breaking changes."); + console.log(); // eslint-disable-line no-console + } + static defaultHome() { if (home) { return home;