@hubspot/cli 7.4.0-experimental.0 → 7.4.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.
Files changed (93) hide show
  1. package/api/migrate.d.ts +61 -0
  2. package/api/migrate.js +44 -0
  3. package/bin/cli.js +8 -183
  4. package/commands/account/auth.d.ts +10 -0
  5. package/commands/account/auth.js +168 -0
  6. package/commands/account/clean.js +38 -5
  7. package/commands/account/createOverride.d.ts +10 -0
  8. package/commands/account/createOverride.js +104 -0
  9. package/commands/account/info.js +38 -4
  10. package/commands/account/list.js +23 -5
  11. package/commands/account/remove.js +36 -2
  12. package/commands/account/removeOverride.d.ts +10 -0
  13. package/commands/account/removeOverride.js +76 -0
  14. package/commands/account/use.js +25 -3
  15. package/commands/account.js +7 -2
  16. package/commands/app/migrate.js +5 -4
  17. package/commands/auth.js +6 -2
  18. package/commands/cms/lighthouseScore.js +6 -2
  19. package/commands/config/migrate.d.ts +10 -0
  20. package/commands/config/migrate.js +84 -0
  21. package/commands/config/set.d.ts +10 -0
  22. package/commands/config/set.js +34 -29
  23. package/commands/config.d.ts +4 -1
  24. package/commands/config.js +45 -11
  25. package/commands/create/api-sample.js +3 -1
  26. package/commands/customObject/schema/delete.js +4 -1
  27. package/commands/customObject/schema/fetch-all.js +2 -1
  28. package/commands/customObject/schema/fetch.js +2 -1
  29. package/commands/init.js +9 -10
  30. package/commands/project/create.js +1 -0
  31. package/commands/project/dev/index.js +1 -1
  32. package/commands/project/installDeps.d.ts +9 -1
  33. package/commands/project/installDeps.js +43 -30
  34. package/commands/project/logs.d.ts +13 -1
  35. package/commands/project/logs.js +69 -62
  36. package/commands/project/upload.d.ts +12 -0
  37. package/commands/project/upload.js +62 -49
  38. package/commands/project/watch.js +12 -0
  39. package/lang/en.js +11 -3
  40. package/lang/en.lyaml +95 -12
  41. package/lib/DevServerManagerV2.d.ts +1 -2
  42. package/lib/DevServerManagerV2.js +1 -2
  43. package/lib/LocalDevManagerV2.js +10 -15
  44. package/lib/app/migrate.d.ts +0 -2
  45. package/lib/app/migrate.js +62 -165
  46. package/lib/app/migrate_legacy.d.ts +4 -0
  47. package/lib/app/migrate_legacy.js +129 -0
  48. package/lib/configMigrate.d.ts +2 -0
  49. package/lib/configMigrate.js +104 -0
  50. package/lib/doctor/Diagnosis.d.ts +1 -2
  51. package/lib/doctor/Diagnosis.js +10 -6
  52. package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -0
  53. package/lib/doctor/DiagnosticInfoBuilder.js +1 -0
  54. package/lib/doctor/Doctor.d.ts +1 -0
  55. package/lib/doctor/Doctor.js +18 -0
  56. package/lib/middleware/__test__/configMiddleware.test.d.ts +1 -0
  57. package/lib/middleware/__test__/configMiddleware.test.js +194 -0
  58. package/lib/middleware/__test__/gitMiddleware.test.d.ts +1 -0
  59. package/lib/middleware/__test__/gitMiddleware.test.js +76 -0
  60. package/lib/middleware/__test__/notificationsMiddleware.test.d.ts +1 -0
  61. package/lib/middleware/__test__/notificationsMiddleware.test.js +10 -0
  62. package/lib/middleware/__test__/requestMiddleware.test.d.ts +1 -0
  63. package/lib/middleware/__test__/requestMiddleware.test.js +20 -0
  64. package/lib/middleware/__test__/utils.test.d.ts +1 -0
  65. package/lib/middleware/__test__/utils.test.js +53 -0
  66. package/lib/middleware/__test__/yargsChecksMiddleware.test.d.ts +1 -0
  67. package/lib/middleware/__test__/yargsChecksMiddleware.test.js +81 -0
  68. package/lib/middleware/configMiddleware.d.ts +13 -0
  69. package/lib/middleware/configMiddleware.js +109 -0
  70. package/lib/middleware/fireAlarmMiddleware.d.ts +4 -0
  71. package/lib/middleware/fireAlarmMiddleware.js +137 -0
  72. package/lib/middleware/gitMiddleware.d.ts +2 -0
  73. package/lib/middleware/gitMiddleware.js +14 -0
  74. package/lib/middleware/notificationsMiddleware.d.ts +1 -0
  75. package/lib/middleware/notificationsMiddleware.js +38 -0
  76. package/lib/middleware/requestMiddleware.d.ts +1 -0
  77. package/lib/middleware/requestMiddleware.js +11 -0
  78. package/lib/middleware/utils.d.ts +8 -0
  79. package/lib/middleware/utils.js +17 -0
  80. package/lib/middleware/yargsChecksMiddleware.d.ts +4 -0
  81. package/lib/middleware/yargsChecksMiddleware.js +24 -0
  82. package/lib/projects/ProjectLogsManager.d.ts +1 -1
  83. package/lib/projects/ProjectLogsManager.js +1 -1
  84. package/lib/projects/index.d.ts +1 -1
  85. package/lib/projects/structure.d.ts +1 -2
  86. package/lib/projects/structure.js +0 -4
  87. package/lib/projects/upload.d.ts +1 -1
  88. package/lib/ui/SpinniesManager.d.ts +1 -1
  89. package/lib/ui/index.d.ts +1 -0
  90. package/lib/ui/index.js +5 -0
  91. package/lib/ui/spinniesUtils.d.ts +5 -5
  92. package/package.json +7 -6
  93. package/types/ProjectComponents.d.ts +0 -15
@@ -1,83 +1,88 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // @ts-nocheck
4
- const { useV3Api } = require('../../lib/projects/buildAndDeploy');
5
- const { addAccountOptions, addConfigOptions, addUseEnvironmentOptions, } = require('../../lib/commonOpts');
6
- const chalk = require('chalk');
7
- const { logger } = require('@hubspot/local-dev-lib/logger');
8
- const { uiBetaTag, uiCommandReference } = require('../../lib/ui');
9
- const { trackCommandUsage } = require('../../lib/usageTracking');
10
- const { ensureProjectExists, getProjectConfig, logFeedbackMessage, validateProjectConfig, } = require('../../lib/projects');
11
- const { handleProjectUpload } = require('../../lib/projects/upload');
12
- const { displayWarnLogs, pollProjectBuildAndDeploy, } = require('../../lib/projects/buildAndDeploy');
13
- const { i18n } = require('../../lib/lang');
14
- const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
15
- const { isSpecifiedError } = require('@hubspot/local-dev-lib/errors/index');
16
- const { PROJECT_ERROR_TYPES } = require('../../lib/constants');
17
- const { logError, ApiErrorContext } = require('../../lib/errorHandlers/index');
18
- const { EXIT_CODES } = require('../../lib/enums/exitCodes');
6
+ exports.builder = exports.describe = exports.command = void 0;
7
+ exports.handler = handler;
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const logger_1 = require("@hubspot/local-dev-lib/logger");
10
+ const config_1 = require("@hubspot/local-dev-lib/config");
11
+ const index_1 = require("@hubspot/local-dev-lib/errors/index");
12
+ const buildAndDeploy_1 = require("../../lib/projects/buildAndDeploy");
13
+ const ui_1 = require("../../lib/ui");
14
+ const usageTracking_1 = require("../../lib/usageTracking");
15
+ const projects_1 = require("../../lib/projects");
16
+ const upload_1 = require("../../lib/projects/upload");
17
+ const buildAndDeploy_2 = require("../../lib/projects/buildAndDeploy");
18
+ const lang_1 = require("../../lib/lang");
19
+ const constants_1 = require("../../lib/constants");
20
+ const index_2 = require("../../lib/errorHandlers/index");
21
+ const exitCodes_1 = require("../../lib/enums/exitCodes");
22
+ const yargsUtils_1 = require("../../lib/yargsUtils");
19
23
  const i18nKey = 'commands.project.subcommands.upload';
20
24
  exports.command = 'upload';
21
- exports.describe = uiBetaTag(i18n(`${i18nKey}.describe`), false);
22
- exports.handler = async (options) => {
23
- const { forceCreate, message, derivedAccountId, skipValidation } = options;
24
- const accountConfig = getAccountConfig(derivedAccountId);
25
+ exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`${i18nKey}.describe`), false);
26
+ async function handler(args) {
27
+ const { forceCreate, message, derivedAccountId, skipValidation } = args;
28
+ const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
25
29
  const accountType = accountConfig && accountConfig.accountType;
26
- const { projectConfig, projectDir } = await getProjectConfig();
27
- trackCommandUsage('project-upload', { type: accountType }, derivedAccountId);
28
- validateProjectConfig(projectConfig, projectDir);
29
- await ensureProjectExists(derivedAccountId, projectConfig.name, {
30
+ const { projectConfig, projectDir } = await (0, projects_1.getProjectConfig)();
31
+ (0, usageTracking_1.trackCommandUsage)('project-upload', { type: accountType }, derivedAccountId);
32
+ (0, projects_1.validateProjectConfig)(projectConfig, projectDir);
33
+ await (0, projects_1.ensureProjectExists)(derivedAccountId, projectConfig.name, {
30
34
  forceCreate,
31
35
  uploadCommand: true,
32
36
  });
33
37
  try {
34
- const { result, uploadError } = await handleProjectUpload(derivedAccountId, projectConfig, projectDir, pollProjectBuildAndDeploy, message, useV3Api(projectConfig?.platformVersion), skipValidation);
38
+ const { result, uploadError } = await (0, upload_1.handleProjectUpload)(derivedAccountId, projectConfig, projectDir, buildAndDeploy_2.pollProjectBuildAndDeploy, message, (0, buildAndDeploy_1.useV3Api)(projectConfig.platformVersion), skipValidation);
35
39
  if (uploadError) {
36
- if (isSpecifiedError(uploadError, {
37
- subCategory: PROJECT_ERROR_TYPES.PROJECT_LOCKED,
40
+ if ((0, index_1.isSpecifiedError)(uploadError, {
41
+ subCategory: constants_1.PROJECT_ERROR_TYPES.PROJECT_LOCKED,
38
42
  })) {
39
- logger.log();
40
- logger.error(i18n(`${i18nKey}.errors.projectLockedError`));
41
- logger.log();
43
+ logger_1.logger.log();
44
+ logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.projectLockedError`));
45
+ logger_1.logger.log();
42
46
  }
43
47
  else {
44
- logError(uploadError, new ApiErrorContext({
48
+ (0, index_2.logError)(uploadError, new index_2.ApiErrorContext({
45
49
  accountId: derivedAccountId,
46
50
  request: 'project upload',
47
51
  }));
48
52
  }
49
- process.exit(EXIT_CODES.ERROR);
53
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
50
54
  }
51
- if (result.succeeded && !result.buildResult.isAutoDeployEnabled) {
52
- logger.log(chalk.bold(i18n(`${i18nKey}.logs.buildSucceeded`, {
55
+ if (result && result.succeeded && !result.buildResult.isAutoDeployEnabled) {
56
+ logger_1.logger.log(chalk_1.default.bold((0, lang_1.i18n)(`${i18nKey}.logs.buildSucceeded`, {
53
57
  buildId: result.buildId,
54
58
  })));
55
- logger.log(i18n(`${i18nKey}.logs.autoDeployDisabled`, {
56
- deployCommand: uiCommandReference(`hs project deploy --build=${result.buildId}`),
59
+ logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.logs.autoDeployDisabled`, {
60
+ deployCommand: (0, ui_1.uiCommandReference)(`hs project deploy --build=${result.buildId}`),
57
61
  }));
58
- logFeedbackMessage(result.buildId);
59
- await displayWarnLogs(derivedAccountId, projectConfig.name, result.buildId);
60
- process.exit(EXIT_CODES.SUCCESS);
62
+ (0, projects_1.logFeedbackMessage)(result.buildId);
63
+ await (0, buildAndDeploy_2.displayWarnLogs)(derivedAccountId, projectConfig.name, result.buildId);
64
+ process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
61
65
  }
62
66
  }
63
67
  catch (e) {
64
- logError(e, new ApiErrorContext({
68
+ (0, index_2.logError)(e, new index_2.ApiErrorContext({
65
69
  accountId: derivedAccountId,
66
70
  request: 'project upload',
67
71
  }));
68
- process.exit(EXIT_CODES.ERROR);
72
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
69
73
  }
70
- };
71
- exports.builder = yargs => {
74
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
75
+ }
76
+ function projectUploadBuilder(yargs) {
72
77
  yargs.options({
73
78
  'force-create': {
74
- describe: i18n(`${i18nKey}.options.forceCreate.describe`),
79
+ describe: (0, lang_1.i18n)(`${i18nKey}.options.forceCreate.describe`),
75
80
  type: 'boolean',
76
81
  default: false,
77
82
  },
78
83
  message: {
79
84
  alias: 'm',
80
- describe: i18n(`${i18nKey}.options.message.describe`),
85
+ describe: (0, lang_1.i18n)(`${i18nKey}.options.message.describe`),
81
86
  type: 'string',
82
87
  default: '',
83
88
  },
@@ -87,9 +92,17 @@ exports.builder = yargs => {
87
92
  default: false,
88
93
  },
89
94
  });
90
- yargs.example([['$0 project upload', i18n(`${i18nKey}.examples.default`)]]);
91
- addConfigOptions(yargs);
92
- addAccountOptions(yargs);
93
- addUseEnvironmentOptions(yargs);
95
+ yargs.example([['$0 project upload', (0, lang_1.i18n)(`${i18nKey}.examples.default`)]]);
94
96
  return yargs;
97
+ }
98
+ exports.builder = (0, yargsUtils_1.makeYargsBuilder)(projectUploadBuilder, exports.command, exports.describe, {
99
+ useConfigOptions: true,
100
+ useAccountOptions: true,
101
+ useEnvironmentOptions: true,
102
+ });
103
+ module.exports = {
104
+ command: exports.command,
105
+ describe: exports.describe,
106
+ builder: exports.builder,
107
+ handler,
95
108
  };
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  // @ts-nocheck
4
+ const { uiLink } = require('../../lib/ui');
5
+ const { useV3Api } = require('../../lib/projects/buildAndDeploy');
6
+ const { uiCommandReference } = require('../../lib/ui');
4
7
  const { i18n } = require('../../lib/lang');
5
8
  const { createWatcher } = require('../../lib/projects/watch');
6
9
  const { logError, ApiErrorContext } = require('../../lib/errorHandlers/index');
@@ -61,6 +64,15 @@ exports.handler = async (options) => {
61
64
  const { initialUpload, derivedAccountId } = options;
62
65
  trackCommandUsage('project-watch', null, derivedAccountId);
63
66
  const { projectConfig, projectDir } = await getProjectConfig();
67
+ if (useV3Api(projectConfig?.platformVersion)) {
68
+ logger.error(i18n(`commands.project.subcommands.watch.errors.v3ApiError`, {
69
+ command: uiCommandReference('hs project watch'),
70
+ newCommand: uiCommandReference('hs project dev'),
71
+ platformVersion: projectConfig.platformVersion,
72
+ linkToDocs: uiLink('How to develop locally.', 'https://developers.hubspot.com/docs/guides/crm/ui-extensions/local-development'),
73
+ }));
74
+ return process.exit(EXIT_CODES.ERROR);
75
+ }
64
76
  validateProjectConfig(projectConfig, projectDir);
65
77
  await ensureProjectExists(derivedAccountId, projectConfig.name);
66
78
  try {
package/lang/en.js CHANGED
@@ -11,8 +11,6 @@ export const commands = {
11
11
  },
12
12
  srcIsProject: (src, command) =>
13
13
  `"${src}" is in a project folder. Did you mean "hs project ${command}"?`,
14
- setDefaultAccountMoved:
15
- 'This command has moved. Try `hs accounts use` instead',
16
14
  handleDeprecatedEnvVariables: {
17
15
  portalEnvVarDeprecated:
18
16
  'The HUBSPOT_PORTAL_ID environment variable is deprecated. Please use HUBSPOT_ACCOUNT_ID instead.',
@@ -2818,6 +2816,11 @@ export const lib = {
2818
2816
  fileFiltered: filename => `Ignore rule triggered for "${filename}"`,
2819
2817
  },
2820
2818
  },
2819
+ middleware: {
2820
+ fireAlarm: {
2821
+ failedToLoadBoxen: 'Failed to load boxen util.',
2822
+ },
2823
+ },
2821
2824
  ui: {
2822
2825
  betaTag: chalk.bold('[BETA]'),
2823
2826
  betaWarning: {
@@ -2841,7 +2844,7 @@ export const lib = {
2841
2844
  disabledUrlText: 'See all HubSpot CLI commands here.',
2842
2845
  featureHighlight: {
2843
2846
  defaultTitle: "What's next?",
2844
- commandKeys: {
2847
+ featureKeys: {
2845
2848
  accountOption: {
2846
2849
  command: '--account',
2847
2850
  message: command =>
@@ -2895,6 +2898,11 @@ export const lib = {
2895
2898
  message: command =>
2896
2899
  `Run ${command} to set up your test environment and start local development`,
2897
2900
  },
2901
+ projectInstallDepsCommand: {
2902
+ command: 'hs project install-deps',
2903
+ message: command =>
2904
+ `Run ${command} to install dependencies for your project components`,
2905
+ },
2898
2906
  sampleProjects: {
2899
2907
  linkText: "HubSpot's sample projects",
2900
2908
  url: 'https://developers.hubspot.com/docs/platform/sample-projects?utm_source=cli&utm_content=project_create_whats_next',
package/lang/en.lyaml CHANGED
@@ -6,11 +6,13 @@ en:
6
6
  cmsUpdateNotification: "{{#bold}}The CMS CLI is now the HubSpot CLI{{/bold}}\n\nTo upgrade, uninstall {{#bold}}{{ packageName }}{{/bold}}\nand then run {{ updateCommand }}"
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
- setDefaultAccountMoved: "This command has moved. Try `hs accounts use` instead"
10
9
  handleDeprecatedEnvVariables:
11
10
  portalEnvVarDeprecated: "The HUBSPOT_PORTAL_ID environment variable is deprecated. Please use HUBSPOT_ACCOUNT_ID instead."
12
11
  loadConfigMiddleware:
13
12
  configFileExists: "A configuration file already exists at {{ configPath }}. To specify a new configuration file, delete the existing one and try again."
13
+ injectAccountIdMiddleware:
14
+ invalidAccountId: "In the default override file ({{ hsAccountFileName }}), the account ID must be a number. Please delete the current file and generate a new one using {{ overrideCommand }}."
15
+ accountNotFound: "The account in the default override file ({{ hsAccountFileName }}) wasn't found in your configured accounts. You can authorize this account using {{ authCommand }}."
14
16
  completion:
15
17
  describe: "Enable bash completion shortcuts for commands. Concat the generated script to your .bashrc, .bash_profile, or .zshrc file."
16
18
  examples:
@@ -18,11 +20,51 @@ en:
18
20
  account:
19
21
  describe: "Commands for managing configured accounts."
20
22
  subcommands:
23
+ auth:
24
+ describe: "Configure authentication for your HubSpot account."
25
+ options:
26
+ account:
27
+ describe: "HubSpot account to authenticate"
28
+ errors:
29
+ failedToUpdateConfig: "Failed to update the configuration file. Please try again."
30
+ bothConfigFilesNotAllowed: "Unable to create config file, because there is an existing \"{{ deprecatedConfig }}\" file. To create a new config file, delete the existing one and try again."
31
+ success:
32
+ configFileCreated: "Created config file \"{{ configPath }}\""
33
+ configFileUpdated: "Connected account \"{{ account }}\" and set it as the default account"
34
+ createOverride:
35
+ describe: "Create a new default account override file ({{ hsAccountFileName }}) in the current working directory."
36
+ success: "Default account override file created at {{ overrideFilePath }}"
37
+ accountOverride: "An account override file already exists at {{ overrideFilePath }} associated with account \"{{ accountOverride }}\"."
38
+ prompts:
39
+ replaceOverrideFile: "Replace existing account override file?"
40
+ errors:
41
+ accountNotFound: "The specified account could not be found in the config file {{ configPath }}"
42
+ options:
43
+ account:
44
+ describe: "Name or ID of the account to create an override file for."
45
+ examples:
46
+ default: "Create a new default account override file ({{ hsAccountFileName }}) in the current working directory"
47
+ idBased: "Create a new default account override file ({{ hsAccountFileName }}) in the current working directory, using the account with accountId \"1234567\""
48
+ nameBased: "Create a new default account override file ({{ hsAccountFileName }}) in the current working directory, using the account with name \"MyAccount\""
49
+ removeOverride:
50
+ describe: "Remove the default account override file ({{ overrideFile }}) from the current working directory."
51
+ accountOverride: "There is an account override file at {{ overrideFilePath }} associated with account \"{{ accountOverride }}\"."
52
+ prompts:
53
+ deleteOverrideFile: "Delete account override file?"
54
+ success: "Removed the default account override file."
55
+ noOverrideFile: "No default account override file found in the current working directory. No action required."
56
+ options:
57
+ force:
58
+ describe: "Skip confirmation prompt when removing the override file"
21
59
  list:
22
- accounts: "{{#bold}}Accounts{{/bold}}:"
23
- defaultAccount: "{{#bold}}Default account{{/bold}}: {{ account }}"
24
60
  describe: "List names of accounts defined in config."
25
- configPath: "{{#bold}}Config path{{/bold}}: {{ configPath }}"
61
+ accounts: "{{#bold}}Accounts{{/bold}}:"
62
+ defaultAccountTitle: "{{#bold}}Default Account{{/bold}}"
63
+ defaultAccount: "Account: {{ account }}"
64
+ configPath: "Source: {{ configPath }}"
65
+ overrideFilePathTitle: "{{#bold}}Default Account Override{{/bold}}"
66
+ overrideFilePath: "Source: {{ overrideFilePath }}"
67
+ overrideAccount: "Account: {{ account }}"
26
68
  labels:
27
69
  accountId: "Account ID"
28
70
  authType: "Auth Type"
@@ -40,6 +82,8 @@ en:
40
82
  describe: "Set the Hubspot account to use as the default account. The default account can be overridden with the \"--account\" option."
41
83
  errors:
42
84
  accountNotFound: "The account \"{{ specifiedAccount }}\" could not be found in {{ configPath }}"
85
+ accountOverride: "This project currently has an account override set: \"{{ accountOverride }}\". Account \"{{accountOverride}}\" will continue to act as the default account for this project."
86
+ accountOverrideCommands: "Use {{ createOverrideCommand }} to change override accounts, or {{ removeOverrideCommand }} to remove the override and use your default account."
43
87
  examples:
44
88
  default: "Select a HubSpot account to use as the default account"
45
89
  idBased: "Set the default account to the account in the config with accountId equal to \"1234567\""
@@ -55,6 +99,7 @@ en:
55
99
  logs:
56
100
  replaceDefaultAccount: "The removed account was the default account."
57
101
  prompts:
102
+ deleteOverrideFile: "Delete the override file ({{ overrideFilePath }}) associated with {{ accountName }}?"
58
103
  selectAccountToRemove: "Select an account to remove from the config"
59
104
  errors:
60
105
  accountNotFound: "The account \"{{ specifiedAccount }}\" could not be found in {{ configPath }}"
@@ -70,6 +115,12 @@ en:
70
115
  info:
71
116
  accountId: "{{#bold}}Account ID{{/bold}}: {{ accountId }}"
72
117
  describe: "Print information about the default account, or about the account specified with the \"account\" option."
118
+ defaultAccountTitle: "{{#bold}}Default Account{{/bold}}"
119
+ defaultAccount: "Account: {{ account }}"
120
+ configPath: "Source: {{ configPath }}"
121
+ overrideFilePathTitle: "{{#bold}}Default Account Override{{/bold}}"
122
+ overrideFilePath: "Source: {{ overrideFilePath }}"
123
+ overrideAccount: "Account: {{ account }}"
73
124
  errors:
74
125
  notUsingPersonalAccessKey: "This command currently only supports fetching scopes for the personal access key auth type."
75
126
  options:
@@ -92,13 +143,15 @@ en:
92
143
  confirm:
93
144
  one: "Remove 1 inactive account from the CLI config?"
94
145
  other: "Remove {{ count }} inactive accounts from the CLI config?"
146
+ defaultAccountOverride: "\n(This will also delete the default account override file at {{ overrideFilePath }})"
147
+ replaceDefaultAccount: "The default account was removed."
95
148
  removeSuccess: "Removed {{ accountName }} from the CLI config."
96
149
  auth:
97
150
  describe: "Configure authentication for your HubSpot account."
98
151
  verboseDescribe: "Configure authentication for a HubSpot account. This will update the {{ configName }} file that stores your account information.\n\nThe recommended authentication method is {{#bold}}{{ authMethod }}{{/bold}}, which uses an access token tied to a specific user account."
99
152
  errors:
100
- noConfigFileFound: "No config file was found. To create a new config file, use the \"hs init\" command."
101
153
  unsupportedAuthType: "Unsupported auth type: {{ type }}. The only supported authentication protocols are {{ supportedProtocols }}."
154
+ globalConfigFileExists: "A global config file exists at {{ configPath }}. To authorize an account, please use {{ authCommand }}."
102
155
  options:
103
156
  authType:
104
157
  describe: "Authentication method"
@@ -109,6 +162,16 @@ en:
109
162
  config:
110
163
  describe: "Commands for managing the CLI config file."
111
164
  subcommands:
165
+ migrate:
166
+ describe: "Migrate from the deprecated {{ deprecatedConfigPath }} file to the new global config file at {{ globalConfigPath }}."
167
+ migrationAlreadyCompleted: "No {{ deprecatedConfigPath }} deprecated configuration file found. No migration necessary."
168
+ errors:
169
+ configNotFound: "A configuration file at {{ configPath }} could not be found. Please try again with a valid file path."
170
+ options:
171
+ force: "When merging a deprecated configuration file with an existing global configuration file, overwrite any conflicting values in the global config with the deprecated config values."
172
+ examples:
173
+ default: "Migrate from the deprecated {{ deprecatedConfigPath }} file to the new global config file at {{ globalConfigPath }}"
174
+ configFlag: "Migrate a specific config file (specified with the config flag) to the new global config file at {{ globalConfigPath }}"
112
175
  set:
113
176
  describe: "Set various configuration options within the hubspot.config.yml file."
114
177
  promptMessage: "Select a config option to update"
@@ -456,8 +519,6 @@ en:
456
519
  describe: "Authentication method"
457
520
  account:
458
521
  describe: "HubSpot account to authenticate"
459
- useHiddenConfig:
460
- describe: "Use the new HubSpot configuration file located in a hidden file in the user's home directory"
461
522
  success:
462
523
  configFileCreated: "Created config file \"{{ configPath }}\""
463
524
  configFileUpdated: "Connected account \"{{ account }}\" using \"{{ authType }}\" and set it as the default account"
@@ -465,7 +526,7 @@ en:
465
526
  updateConfig: "To update an existing config file, use the \"hs auth\" command."
466
527
  errors:
467
528
  configFileExists: "The config file {{ configPath }} already exists."
468
- bothConfigFilesNotAllowed: "Unable to create config file, because there is an existing one at \"{{ path }}\". To create a new config file, delete the existing one and try again."
529
+ globalConfigFileExists: "A global config file already exists at {{ configPath }}. To specify a new local config file, delete the existing one and try again."
469
530
  lint:
470
531
  issuesFound: "{{ count }} issues found."
471
532
  groupName: "Linting {{ path }}"
@@ -589,7 +650,6 @@ en:
589
650
  componentsToBeMigrated: "The following component types will be migrated: {{ components }}"
590
651
  componentsThatWillNotBeMigrated: "[NOTE] These component types are not yet supported for migration but will be available later: {{ components }}"
591
652
  errors:
592
- noApps: "No apps found in account {{ accountId }}"
593
653
  noAppsEligible: "No apps in account {{ accountId }} are currently migratable"
594
654
  noAccountConfig: "There is no account associated with {{ accountId }} in the config file. Please choose another account and try again, or authenticate {{ accountId }} using {{ authCommand }}."
595
655
  invalidAccountTypeTitle: "{{#bold}}Developer account not targeted{{/bold}}"
@@ -597,6 +657,7 @@ en:
597
657
  projectAlreadyExists: "A project with name {{ projectName }} already exists. Please choose another name."
598
658
  invalidApp: "Could not migrate appId {{ appId }}. This app cannot be migrated at this time. Please choose another public app."
599
659
  appWithAppIdNotFound: "Could not find an app with the id {{ appId }} "
660
+ migrationFailed: 'Migration Failed'
600
661
  prompt:
601
662
  chooseApp: 'Which app would you like to migrate?'
602
663
  inputName: '[--name] What would you like to name the project?'
@@ -605,7 +666,6 @@ en:
605
666
  proceed: 'Would you like to proceed?'
606
667
  spinners:
607
668
  beginningMigration: "Beginning migration"
608
- migrationStarted: "Migration started"
609
669
  unableToStartMigration: "Unable to begin migration"
610
670
  finishingMigration: "Wrapping up migration"
611
671
  migrationComplete: "Migration completed"
@@ -773,6 +833,7 @@ en:
773
833
  uploadFailed: "Failed to upload file \"{{ filePath }}\" to \"{{ remotePath }}\""
774
834
  deleteFileFailed: "Failed to delete file \"{{ remotePath }}\""
775
835
  deleteFolderFailed: "Failed to delete folder \"{{ remotePath }}\""
836
+ v3ApiError: "{{ command }} is not supported for platform version '{{ platformVersion}}', use {{ newCommand }} instead to develop locally. {{ linkToDocs }}"
776
837
  download:
777
838
  describe: "Download your project files from HubSpot."
778
839
  examples:
@@ -1109,6 +1170,7 @@ en:
1109
1170
  missingComponents: "Couldn't find the following components in the deployed build for this project: {{#bold}}'{{ missingComponents }}'{{/bold}}. This may cause issues in local development."
1110
1171
  defaultWarning: "{{#bold}}Changing project configuration requires a new project build.{{/bold}}"
1111
1172
  defaultPublicAppWarning: "{{#bold}}Changing project configuration requires a new project build.{{/bold}}\n\nThis will affect your public app's {{#bold}}{{ installCount }} existing {{ installText }}{{/bold}}. If your app has users in production, we strongly recommend creating a copy of this app to test your changes before proceding."
1173
+ defaultMarketplaceAppWarning: "{{#bold}}Changing project configuration requires creating a new project build.{{/bold}}\n\nYour marketplace app is currently installed in {{#bold}}{{ installCount }} {{ accountText }}{{/bold}}. Any uploaded changes will impact your app's users. We strongly recommend creating a copy of this app to test your changes before proceding."
1112
1174
  header: "{{ warning }} To reflect these changes and continue testing:"
1113
1175
  stopDev: " * Stop {{ command }}"
1114
1176
  runUpload: " * Run {{ command }}"
@@ -1195,6 +1257,9 @@ en:
1195
1257
  compressed: "Project files compressed: {{ byteCount }} bytes"
1196
1258
  compressing: "Compressing build files to \"{{ path }}\""
1197
1259
  fileFiltered: "Ignore rule triggered for \"{{ filename }}\""
1260
+ middleware:
1261
+ fireAlarm:
1262
+ failedToLoadBoxen: "Failed to load boxen util."
1198
1263
  ui:
1199
1264
  betaTag: "{{#bold}}[BETA]{{/bold}}"
1200
1265
  betaWarning:
@@ -1215,11 +1280,14 @@ en:
1215
1280
  command: "--account"
1216
1281
  message: "Use the {{ command }} option with any command to override the default account"
1217
1282
  accountsListCommand:
1218
- command: hs accounts list
1283
+ command: "hs account list"
1219
1284
  message: "Run {{ command }} to see a list of configured HubSpot accounts"
1220
1285
  accountsUseCommand:
1221
- command: "hs accounts use"
1286
+ command: "hs account use"
1222
1287
  message: "Run {{ command }} to set the Hubspot account that the CLI will target by default"
1288
+ accountAuthCommand:
1289
+ command: "hs account auth"
1290
+ message: "Run {{ command }} to connect the CLI to additional HubSpot accounts"
1223
1291
  authCommand:
1224
1292
  command: "hs auth"
1225
1293
  message: "Run {{ command }} to connect the CLI to additional HubSpot accounts"
@@ -1244,6 +1312,9 @@ en:
1244
1312
  projectDevCommand:
1245
1313
  command: "hs project dev"
1246
1314
  message: "Run {{ command }} to set up your test environment and start local development"
1315
+ projectInstallDepsCommand:
1316
+ command: "hs project install-deps"
1317
+ message: "Run {{ command }} to install dependencies for your project components"
1247
1318
  projectCommandTip:
1248
1319
  message: "Tip: All project commands must be run from within a project directory"
1249
1320
  sampleProjects:
@@ -1281,6 +1352,13 @@ en:
1281
1352
  describe: "Use environment variable config"
1282
1353
  debug:
1283
1354
  describe: "Set log level to debug"
1355
+ configMigrate:
1356
+ migrateConfigPrompt: "Migrate config?\n From deprecated config file: {{ deprecatedConfigPath }}\n To new global config file: {{ globalConfigPath }}\n (This action will delete the deprecated config file).\n"
1357
+ mergeConfigConflictPrompt: "Change the {{ property }} property in the global config from {{ newValue }} to {{ oldValue }}?"
1358
+ mergeConfigsPrompt: "Two config files detected. Merge them?\n Deprecated config file: {{ deprecatedConfigPath }}\n Global config: {{ globalConfigPath }}\n (This action will delete the deprecated config file).\n"
1359
+ migrationSuccess: "The deprecated config file has been migrated to the new global config file at {{ globalConfigPath }}."
1360
+ mergeSuccess: "The deprecated config file has been merged with the global config file at {{ globalConfigPath }}."
1361
+ skippedExistingAccounts: "\nThe following accounts were not merged, because they already exist in the global config: {{ skippedAccountIds }}.\n"
1284
1362
  prompts:
1285
1363
  projectDevTargetAccountPrompt:
1286
1364
  createNewSandboxOption: "<Test on a new development sandbox>"
@@ -1567,6 +1645,9 @@ en:
1567
1645
  doctor:
1568
1646
  runningDiagnostics: "Running diagnostics..."
1569
1647
  diagnosticsComplete: "Diagnostics complete"
1648
+ defaultAccountOverrideFileChecks:
1649
+ overrideActive: "Default account override file active: {{ defaultAccountOverrideFile }}"
1650
+ overrideAccountId: "Active account ID: {{ overrideAccountId }}"
1570
1651
  accountChecks:
1571
1652
  active: "Default account active"
1572
1653
  inactive: "Default account isn't active"
@@ -1618,6 +1699,8 @@ en:
1618
1699
  settings:
1619
1700
  httpUseLocalhost: "The setting {{#bold}}httpUseLocalhost{{/bold}} is enabled"
1620
1701
  httpUseLocalhostSecondary: "This setting causes all CLI requests to route to localhost"
1702
+ defaultAccountOverrideFile:
1703
+ header: "Default account override file path:"
1621
1704
  projectConfig:
1622
1705
  header: "Project configuration"
1623
1706
  projectDirSubHeader: "Project dir: {{#bold}}{{ projectDir }}{{/bold}}"
@@ -12,11 +12,10 @@ declare class DevServerManagerV2 {
12
12
  private devServers;
13
13
  constructor();
14
14
  iterateDevServers(callback: (serverInterface: DevServerInterface) => Promise<void>): Promise<void>;
15
- setup({ projectNodes, onUploadRequired, accountId, setActiveApp, }: {
15
+ setup({ projectNodes, accountId, setActiveApp, }: {
16
16
  projectNodes: {
17
17
  [key: string]: IntermediateRepresentationNodeLocalDev;
18
18
  };
19
- onUploadRequired: () => void;
20
19
  accountId: number;
21
20
  setActiveApp: (appUid: string | undefined) => Promise<void>;
22
21
  }): Promise<void>;
@@ -20,7 +20,7 @@ class DevServerManagerV2 {
20
20
  async iterateDevServers(callback) {
21
21
  await Promise.all(this.devServers.map(devServer => callback(devServer)));
22
22
  }
23
- async setup({ projectNodes, onUploadRequired, accountId, setActiveApp, }) {
23
+ async setup({ projectNodes, accountId, setActiveApp, }) {
24
24
  let env;
25
25
  const accountConfig = (0, config_1.getAccountConfig)(accountId);
26
26
  if (accountConfig) {
@@ -31,7 +31,6 @@ class DevServerManagerV2 {
31
31
  if (serverInterface.setup) {
32
32
  await serverInterface.setup({
33
33
  components: projectNodes,
34
- onUploadRequired,
35
34
  promptUser: promptUtils_1.promptUser,
36
35
  logger: logger_1.logger,
37
36
  urls: {
@@ -10,6 +10,7 @@ const logger_1 = require("@hubspot/local-dev-lib/logger");
10
10
  const localDevAuth_1 = require("@hubspot/local-dev-lib/api/localDevAuth");
11
11
  const appsDev_1 = require("@hubspot/local-dev-lib/api/appsDev");
12
12
  const config_1 = require("@hubspot/local-dev-lib/config");
13
+ const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
13
14
  const constants_1 = require("./constants");
14
15
  const SpinniesManager_1 = __importDefault(require("./ui/SpinniesManager"));
15
16
  const DevServerManagerV2_1 = __importDefault(require("./DevServerManagerV2"));
@@ -212,16 +213,13 @@ class LocalDevManagerV2 {
212
213
  : (0, ui_1.uiCommandReference)('hs project upload');
213
214
  }
214
215
  logUploadWarning(reason) {
215
- let warning;
216
- if (reason) {
217
- warning = reason;
218
- }
219
- else {
216
+ let warning = reason;
217
+ if (!warning) {
220
218
  warning =
221
219
  this.publicAppActiveInstalls && this.publicAppActiveInstalls > 0
222
- ? (0, lang_1.i18n)(`${i18nKey}.uploadWarning.defaultPublicAppWarning`, {
220
+ ? (0, lang_1.i18n)(`${i18nKey}.uploadWarning.defaultMarketplaceAppWarning`, {
223
221
  installCount: this.publicAppActiveInstalls,
224
- installText: this.publicAppActiveInstalls === 1 ? 'install' : 'installs',
222
+ accountText: this.publicAppActiveInstalls === 1 ? 'account' : 'accounts',
225
223
  })
226
224
  : (0, lang_1.i18n)(`${i18nKey}.uploadWarning.defaultWarning`);
227
225
  }
@@ -268,10 +266,10 @@ class LocalDevManagerV2 {
268
266
  const deployedComponentNames = this.deployedBuild.subbuildStatuses.map(subbuildStatus => subbuildStatus.buildName);
269
267
  const missingProjectNodes = [];
270
268
  Object.values(this.projectNodes).forEach(node => {
271
- if ((0, structure_1.isAppIRNode)(node) || (0, structure_1.isCardIRNode)(node)) {
272
- if (!deployedComponentNames.includes(node.uid)) {
273
- missingProjectNodes.push(`${(0, lang_1.i18n)(`${i18nKey}.uploadWarning.appLabel`)} ${node.uid}`);
274
- }
269
+ if (!deployedComponentNames.includes(node.uid)) {
270
+ const userFriendlyName = (0, project_parsing_lib_1.mapToUserFriendlyName)(node.componentType);
271
+ const label = userFriendlyName ? `[${userFriendlyName}] ` : '';
272
+ missingProjectNodes.push(`${label}${node.uid}`);
275
273
  }
276
274
  });
277
275
  if (missingProjectNodes.length) {
@@ -284,9 +282,7 @@ class LocalDevManagerV2 {
284
282
  this.watcher = chokidar_1.default.watch(this.projectDir, {
285
283
  ignoreInitial: true,
286
284
  });
287
- const configPaths = Object.values(this.projectNodes)
288
- .filter(structure_1.isAppIRNode)
289
- .map(component => component.localDev.componentConfigPath);
285
+ const configPaths = Object.values(this.projectNodes).map(component => component.localDev.componentConfigPath);
290
286
  const projectConfigPath = path_1.default.join(this.projectDir, constants_1.PROJECT_CONFIG_FILE);
291
287
  configPaths.push(projectConfigPath);
292
288
  this.watcher.on('add', filePath => {
@@ -317,7 +313,6 @@ class LocalDevManagerV2 {
317
313
  try {
318
314
  await DevServerManagerV2_1.default.setup({
319
315
  projectNodes: this.projectNodes,
320
- onUploadRequired: this.logUploadWarning.bind(this),
321
316
  accountId: this.targetTestingAccountId,
322
317
  setActiveApp: this.setActiveApp.bind(this),
323
318
  });
@@ -1,7 +1,5 @@
1
- import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
2
1
  import { ArgumentsCamelCase } from 'yargs';
3
2
  import { MigrateAppOptions } from '../../types/Yargs';
4
3
  export declare function downloadProjectFiles(derivedAccountId: number, projectName: string, buildId: number, projectDest: string): Promise<void>;
5
4
  export declare function migrateApp2025_2(derivedAccountId: number, options: ArgumentsCamelCase<MigrateAppOptions>): Promise<void>;
6
5
  export declare function logInvalidAccountError(i18nKey: string): void;
7
- export declare function migrateApp2023_2(derivedAccountId: number, options: ArgumentsCamelCase<MigrateAppOptions>, accountConfig: CLIAccount): Promise<void>;