@hubspot/cli 7.0.0 → 7.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -5,16 +5,16 @@ const updateNotifier = require('update-notifier');
5
5
  const chalk = require('chalk');
6
6
  const { logger } = require('@hubspot/local-dev-lib/logger');
7
7
  const { addUserAgentHeader } = require('@hubspot/local-dev-lib/http');
8
- const { loadConfig, configFileExists, getConfigPath, validateConfig, } = require('@hubspot/local-dev-lib/config');
8
+ const { loadConfig, getAccountId, configFileExists, getConfigPath, validateConfig, } = require('@hubspot/local-dev-lib/config');
9
9
  const { logError } = require('../lib/errorHandlers/index');
10
- const { setLogLevel, getCommandName, injectAccountIdMiddleware, } = require('../lib/commonOpts');
10
+ const { setLogLevel, getCommandName } = require('../lib/commonOpts');
11
11
  const { validateAccount } = require('../lib/validation');
12
12
  const { trackHelpUsage, trackConvertFieldsUsage, } = require('../lib/usageTracking');
13
13
  const { getIsInProject } = require('../lib/projects');
14
14
  const pkg = require('../package.json');
15
15
  const { i18n } = require('../lib/lang');
16
16
  const { EXIT_CODES } = require('../lib/enums/exitCodes');
17
- const { UI_COLORS, uiCommandReference } = require('../lib/ui');
17
+ const { UI_COLORS, uiCommandReference, uiDeprecatedTag } = require('../lib/ui');
18
18
  const { checkAndWarnGitInclusion } = require('../lib/ui/git');
19
19
  const removeCommand = require('../commands/remove');
20
20
  const initCommand = require('../commands/init');
@@ -141,6 +141,32 @@ const SKIP_CONFIG_VALIDATION = {
141
141
  init: { target: true },
142
142
  auth: { target: true },
143
143
  };
144
+ const handleDeprecatedEnvVariables = options => {
145
+ // HUBSPOT_PORTAL_ID is deprecated, but we'll still support it for now
146
+ // The HubSpot GH Deploy Action still uses HUBSPOT_PORTAL_ID
147
+ if (options.useEnv &&
148
+ process.env.HUBSPOT_PORTAL_ID &&
149
+ !process.env.HUBSPOT_ACCOUNT_ID) {
150
+ uiDeprecatedTag(i18n(`${i18nKey}.handleDeprecatedEnvVariables.portalEnvVarDeprecated`, {
151
+ configPath: getConfigPath(),
152
+ }));
153
+ process.env.HUBSPOT_ACCOUNT_ID = process.env.HUBSPOT_PORTAL_ID;
154
+ }
155
+ };
156
+ /**
157
+ * Auto-injects the derivedAccountId flag into all commands
158
+ */
159
+ const injectAccountIdMiddleware = async (options) => {
160
+ const { account } = options;
161
+ // Preserves the original --account flag for certain commands.
162
+ options.providedAccountId = account;
163
+ if (options.useEnv && process.env.HUBSPOT_ACCOUNT_ID) {
164
+ options.derivedAccountId = parseInt(process.env.HUBSPOT_ACCOUNT_ID, 10);
165
+ }
166
+ else {
167
+ options.derivedAccountId = getAccountId(account);
168
+ }
169
+ };
144
170
  const loadConfigMiddleware = async (options) => {
145
171
  // Skip this when no command is provided
146
172
  if (!options._.length) {
@@ -213,6 +239,7 @@ const argv = yargs
213
239
  .middleware([
214
240
  setLogLevel,
215
241
  setRequestHeaders,
242
+ handleDeprecatedEnvVariables,
216
243
  loadConfigMiddleware,
217
244
  injectAccountIdMiddleware,
218
245
  checkAndWarnGitInclusionMiddleware,
package/lang/en.lyaml CHANGED
@@ -7,6 +7,8 @@ en:
7
7
  cliUpdateNotification: "HubSpot CLI version {{#cyan}}{{#bold}}{currentVersion}{{/bold}}{{/cyan}} is outdated.\nRun {{ updateCommand }} to upgrade to version {{#cyan}}{{#bold}}{latestVersion}{{/bold}}{{/cyan}}"
8
8
  srcIsProject: "\"{{ src }}\" is in a project folder. Did you mean \"hs project {{command}}\"?"
9
9
  setDefaultAccountMoved: "This command has moved. Try `hs accounts use` instead"
10
+ handleDeprecatedEnvVariables:
11
+ portalEnvVarDeprecated: "The HUBSPOT_PORTAL_ID environment variable is deprecated. Please use HUBSPOT_ACCOUNT_ID instead."
10
12
  loadConfigMiddleware:
11
13
  configFileExists: "A configuration file already exists at {{ configPath }}. To specify a new configuration file, delete the existing one and try again."
12
14
  completion:
@@ -24,13 +24,6 @@ export declare function getCommandName(argv: Arguments<{
24
24
  export declare function getAccountId(options: Arguments<{
25
25
  account?: number | string;
26
26
  }>): number | null;
27
- /**
28
- * Auto-injects the derivedAccountId flag into all commands
29
- */
30
- export declare function injectAccountIdMiddleware(options: Arguments<{
31
- derivedAccountId?: number | null;
32
- account?: number | string;
33
- }>): Promise<void>;
34
27
  export declare function getCmsPublishMode(options: Arguments<{
35
28
  cmsPublishMode?: CmsPublishMode;
36
29
  }>): CmsPublishMode;
package/lib/commonOpts.js CHANGED
@@ -10,7 +10,6 @@ exports.addUseEnvironmentOptions = addUseEnvironmentOptions;
10
10
  exports.setLogLevel = setLogLevel;
11
11
  exports.getCommandName = getCommandName;
12
12
  exports.getAccountId = getAccountId;
13
- exports.injectAccountIdMiddleware = injectAccountIdMiddleware;
14
13
  exports.getCmsPublishMode = getCmsPublishMode;
15
14
  const logger_1 = require("@hubspot/local-dev-lib/logger");
16
15
  const files_1 = require("@hubspot/local-dev-lib/constants/files");
@@ -94,19 +93,6 @@ function getAccountId(options) {
94
93
  }
95
94
  return (0, config_1.getAccountId)(account);
96
95
  }
97
- /**
98
- * Auto-injects the derivedAccountId flag into all commands
99
- */
100
- async function injectAccountIdMiddleware(options) {
101
- const { account } = options;
102
- // Preserves the original --account flag for certain commands.
103
- options.providedAccountId = account;
104
- if (options.useEnv && process.env.HUBSPOT_ACCOUNT_ID) {
105
- options.derivedAccountId = parseInt(process.env.HUBSPOT_ACCOUNT_ID, 10);
106
- return;
107
- }
108
- options.derivedAccountId = (0, config_1.getAccountId)(account);
109
- }
110
96
  function getCmsPublishMode(options) {
111
97
  // 1. --cmsPublishMode
112
98
  const { cmsPublishMode } = options;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "7.0.0",
3
+ "version": "7.0.1-beta.0",
4
4
  "description": "The official CLI for developing on HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/HubSpot/hubspot-cli",
7
7
  "dependencies": {
8
- "@hubspot/local-dev-lib": "3.1.0",
8
+ "@hubspot/local-dev-lib": "3.1.1",
9
9
  "@hubspot/serverless-dev-runtime": "7.0.1",
10
10
  "@hubspot/theme-preview-dev-server": "0.0.10",
11
11
  "@hubspot/ui-extensions-dev-server": "0.8.40",