diff --git a/bin/cli.js b/bin/cli.js index da0673faf..66cf1d431 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -9,6 +9,7 @@ const { logger } = require('@hubspot/local-dev-lib/logger'); const { addUserAgentHeader } = require('@hubspot/local-dev-lib/http'); const { loadConfig, + getAndLoadConfigIfNeeded, configFileExists, getConfigPath, } = require('@hubspot/local-dev-lib/config'); @@ -148,6 +149,7 @@ const setRequestHeaders = () => { }; const loadConfigMiddleware = async options => { + // Load the new config and check for the conflicting config flag if (configFileExists(true)) { loadConfig('', options); @@ -159,6 +161,7 @@ const loadConfigMiddleware = async options => { ); process.exit(EXIT_CODES.ERROR); } + return; } // We need to load the config when options.config exists, @@ -166,7 +169,12 @@ const loadConfigMiddleware = async options => { if (options.config && fs.existsSync(options.config)) { const { config: configPath } = options; await loadConfig(configPath, options); + return; } + + // Load deprecated config without a config flag and with no warnings + getAndLoadConfigIfNeeded(options); + return; }; const checkAndWarnGitInclusionMiddleware = () => { diff --git a/lib/validation.ts b/lib/validation.ts index e141bffaf..e770e2348 100644 --- a/lib/validation.ts +++ b/lib/validation.ts @@ -10,7 +10,6 @@ const { } = require('@hubspot/local-dev-lib/constants/auth'); const { commaSeparatedValues } = require('@hubspot/local-dev-lib/text'); const { - loadConfig, getConfigPath, validateConfig, getAccountConfig, @@ -30,9 +29,6 @@ const { EXIT_CODES } = require('./enums/exitCodes'); const { logError } = require('./errorHandlers/index'); async function loadAndValidateOptions(options, shouldValidateAccount = true) { - const { config: configPath } = options; - loadConfig(configPath, options); - let validAccount = true; if (shouldValidateAccount) { validAccount = await validateAccount(options);