Skip to content

Commit

Permalink
deprecate the HUBSPOT_PORTAL_ID instead of remove
Browse files Browse the repository at this point in the history
  • Loading branch information
brandenrodgers committed Jan 10, 2025
1 parent bd71b17 commit f5162b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const { getIsInProject } = require('../lib/projects');
const pkg = require('../package.json');
const { i18n } = require('../lib/lang');
const { EXIT_CODES } = require('../lib/enums/exitCodes');
const { UI_COLORS, uiCommandReference } = require('../lib/ui');
const { UI_COLORS, uiCommandReference, uiDeprecatedTag } = require('../lib/ui');
const { checkAndWarnGitInclusion } = require('../lib/ui/git');

const removeCommand = require('../commands/remove');
Expand Down Expand Up @@ -183,19 +183,19 @@ const injectAccountIdMiddleware = async options => {

if (options.useEnv && process.env.HUBSPOT_ACCOUNT_ID) {
options.derivedAccountId = parseInt(process.env.HUBSPOT_ACCOUNT_ID, 10);
return;
}

if (options.useEnv && process.env.HUBSPOT_PORTAL_ID) {
logger.error(
} else if (options.useEnv && process.env.HUBSPOT_PORTAL_ID) {
// HUBSPOT_PORTAL_ID is deprecated, but we'll still support it for now
// The HubSpot GH Deploy Action still uses HUBSPOT_PORTAL_ID
uiDeprecatedTag(
i18n(`${i18nKey}.injectAccountIdMiddleware.portalEnvVarDeprecated`, {
configPath: getConfigPath(),
})
);
process.exit(EXIT_CODES.ERROR);
process.env.HUBSPOT_ACCOUNT_ID = process.env.HUBSPOT_PORTAL_ID;
options.derivedAccountId = parseInt(process.env.HUBSPOT_ACCOUNT_ID, 10);
} else {
options.derivedAccountId = getAccountIdFromConfig(account);
}

options.derivedAccountId = getAccountIdFromConfig(account);
};

const loadConfigMiddleware = async options => {
Expand Down Expand Up @@ -283,8 +283,8 @@ const argv = yargs
.middleware([
setLogLevel,
setRequestHeaders,
loadConfigMiddleware,
injectAccountIdMiddleware,
loadConfigMiddleware,
checkAndWarnGitInclusionMiddleware,
validateAccountOptions,
])
Expand Down
2 changes: 1 addition & 1 deletion lang/en.lyaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ en:
srcIsProject: "\"{{ src }}\" is in a project folder. Did you mean \"hs project {{command}}\"?"
setDefaultAccountMoved: "This command has moved. Try `hs accounts use` instead"
injectAccountIdMiddleware:
portalEnvVarDeprecated: "The HUBSPOT_PORTAL_ID environment variable is deprecatted. Please use HUBSPOT_ACCOUNT_ID instead."
portalEnvVarDeprecated: "The HUBSPOT_PORTAL_ID environment variable is deprecated. Please use HUBSPOT_ACCOUNT_ID instead."
loadConfigMiddleware:
configFileExists: "A configuration file already exists at {{ configPath }}. To specify a new configuration file, delete the existing one and try again."
completion:
Expand Down

0 comments on commit f5162b4

Please sign in to comment.