@hubspot/cli 7.3.0 → 7.4.0-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.
Files changed (88) hide show
  1. package/api/migrate.d.ts +61 -0
  2. package/api/migrate.js +44 -0
  3. package/bin/cli.js +10 -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.d.ts +7 -0
  17. package/commands/app/migrate.js +95 -0
  18. package/commands/app.d.ts +6 -0
  19. package/commands/app.js +23 -0
  20. package/commands/auth.js +6 -2
  21. package/commands/cms/lighthouseScore.js +6 -2
  22. package/commands/config/migrate.d.ts +10 -0
  23. package/commands/config/migrate.js +84 -0
  24. package/commands/config/set.d.ts +10 -0
  25. package/commands/config/set.js +34 -29
  26. package/commands/config.d.ts +4 -1
  27. package/commands/config.js +45 -11
  28. package/commands/create/api-sample.js +3 -1
  29. package/commands/customObject/schema/delete.js +4 -1
  30. package/commands/customObject/schema/fetch-all.js +2 -1
  31. package/commands/customObject/schema/fetch.js +2 -1
  32. package/commands/init.js +9 -10
  33. package/commands/project/cloneApp.d.ts +9 -1
  34. package/commands/project/cloneApp.js +91 -76
  35. package/commands/project/migrateApp.d.ts +9 -1
  36. package/commands/project/migrateApp.js +43 -170
  37. package/commands/project/watch.js +12 -0
  38. package/lang/en.js +5 -2
  39. package/lang/en.lyaml +121 -10
  40. package/lib/app/migrate.d.ts +5 -0
  41. package/lib/app/migrate.js +242 -0
  42. package/lib/app/migrate_legacy.d.ts +4 -0
  43. package/lib/app/migrate_legacy.js +129 -0
  44. package/lib/configMigrate.d.ts +2 -0
  45. package/lib/configMigrate.js +104 -0
  46. package/lib/doctor/Diagnosis.d.ts +1 -2
  47. package/lib/doctor/Diagnosis.js +10 -6
  48. package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -0
  49. package/lib/doctor/DiagnosticInfoBuilder.js +1 -0
  50. package/lib/doctor/Doctor.d.ts +1 -0
  51. package/lib/doctor/Doctor.js +18 -0
  52. package/lib/middleware/__test__/configMiddleware.test.d.ts +1 -0
  53. package/lib/middleware/__test__/configMiddleware.test.js +194 -0
  54. package/lib/middleware/__test__/gitMiddleware.test.d.ts +1 -0
  55. package/lib/middleware/__test__/gitMiddleware.test.js +76 -0
  56. package/lib/middleware/__test__/notificationsMiddleware.test.d.ts +1 -0
  57. package/lib/middleware/__test__/notificationsMiddleware.test.js +10 -0
  58. package/lib/middleware/__test__/requestMiddleware.test.d.ts +1 -0
  59. package/lib/middleware/__test__/requestMiddleware.test.js +20 -0
  60. package/lib/middleware/__test__/utils.test.d.ts +1 -0
  61. package/lib/middleware/__test__/utils.test.js +53 -0
  62. package/lib/middleware/__test__/yargsChecksMiddleware.test.d.ts +1 -0
  63. package/lib/middleware/__test__/yargsChecksMiddleware.test.js +81 -0
  64. package/lib/middleware/configMiddleware.d.ts +13 -0
  65. package/lib/middleware/configMiddleware.js +109 -0
  66. package/lib/middleware/fireAlarmMiddleware.d.ts +4 -0
  67. package/lib/middleware/fireAlarmMiddleware.js +137 -0
  68. package/lib/middleware/gitMiddleware.d.ts +2 -0
  69. package/lib/middleware/gitMiddleware.js +14 -0
  70. package/lib/middleware/notificationsMiddleware.d.ts +1 -0
  71. package/lib/middleware/notificationsMiddleware.js +38 -0
  72. package/lib/middleware/requestMiddleware.d.ts +1 -0
  73. package/lib/middleware/requestMiddleware.js +11 -0
  74. package/lib/middleware/utils.d.ts +8 -0
  75. package/lib/middleware/utils.js +17 -0
  76. package/lib/middleware/yargsChecksMiddleware.d.ts +4 -0
  77. package/lib/middleware/yargsChecksMiddleware.js +24 -0
  78. package/lib/polling.d.ts +4 -0
  79. package/lib/polling.js +3 -3
  80. package/lib/prompts/promptUtils.d.ts +6 -4
  81. package/lib/prompts/promptUtils.js +3 -1
  82. package/lib/ui/SpinniesManager.d.ts +1 -1
  83. package/lib/ui/index.d.ts +3 -2
  84. package/lib/ui/index.js +11 -5
  85. package/lib/ui/spinniesUtils.d.ts +5 -5
  86. package/package.json +7 -6
  87. package/types/Prompts.d.ts +2 -2
  88. package/types/Yargs.d.ts +10 -0
@@ -1,188 +1,61 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // @ts-nocheck
4
- const path = require('path');
5
- const { addAccountOptions, addConfigOptions, addUseEnvironmentOptions, } = require('../../lib/commonOpts');
6
- const { trackCommandUsage, trackCommandMetadataUsage, } = require('../../lib/usageTracking');
7
- const { createProjectPrompt, } = require('../../lib/prompts/createProjectPrompt');
8
- const { i18n } = require('../../lib/lang');
9
- const { selectPublicAppPrompt, } = require('../../lib/prompts/selectPublicAppPrompt');
10
- const { poll } = require('../../lib/polling');
11
- const { uiBetaTag, uiLine, uiLink, uiCommandReference, uiAccountDescription, } = require('../../lib/ui');
12
- const SpinniesManager = require('../../lib/ui/SpinniesManager');
13
- const { logError, ApiErrorContext } = require('../../lib/errorHandlers/index');
14
- const { EXIT_CODES } = require('../../lib/enums/exitCodes');
15
- const { promptUser } = require('../../lib/prompts/promptUtils');
16
- const { isAppDeveloperAccount } = require('../../lib/accountTypes');
17
- const { ensureProjectExists } = require('../../lib/projects');
18
- const { handleKeypress } = require('../../lib/process');
19
- const { migrateApp, checkMigrationStatus, } = require('@hubspot/local-dev-lib/api/projects');
20
- const { getCwd, sanitizeFileName } = require('@hubspot/local-dev-lib/path');
21
- const { logger } = require('@hubspot/local-dev-lib/logger');
22
- const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
23
- const { downloadProject } = require('@hubspot/local-dev-lib/api/projects');
24
- const { extractZipArchive } = require('@hubspot/local-dev-lib/archive');
25
- const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
26
- const { fetchPublicAppMetadata, } = require('@hubspot/local-dev-lib/api/appsDev');
27
- const i18nKey = 'commands.project.subcommands.migrateApp';
3
+ exports.deprecated = exports.describe = exports.command = void 0;
4
+ exports.handler = handler;
5
+ exports.builder = builder;
6
+ const lang_1 = require("../../lib/lang");
7
+ const ui_1 = require("../../lib/ui");
8
+ const migrate_1 = require("../app/migrate");
9
+ const logger_1 = require("@hubspot/local-dev-lib/logger");
10
+ const commonOpts_1 = require("../../lib/commonOpts");
28
11
  exports.command = 'migrate-app';
29
- exports.describe = uiBetaTag(i18n(`${i18nKey}.describe`), false);
30
- exports.handler = async (options) => {
31
- const { derivedAccountId } = options;
32
- const accountConfig = getAccountConfig(derivedAccountId);
33
- const accountName = uiAccountDescription(derivedAccountId);
34
- trackCommandUsage('migrate-app', {}, derivedAccountId);
35
- logger.log('');
36
- logger.log(uiBetaTag(i18n(`${i18nKey}.header.text`), false));
37
- logger.log(uiLink(i18n(`${i18nKey}.header.link`), 'https://developers.hubspot.com/docs/platform/migrate-a-public-app-to-projects'));
38
- logger.log('');
39
- if (!isAppDeveloperAccount(accountConfig)) {
40
- uiLine();
41
- logger.error(i18n(`${i18nKey}.errors.invalidAccountTypeTitle`));
42
- logger.log(i18n(`${i18nKey}.errors.invalidAccountTypeDescription`, {
43
- useCommand: uiCommandReference('hs accounts use'),
44
- authCommand: uiCommandReference('hs auth'),
45
- }));
46
- uiLine();
47
- process.exit(EXIT_CODES.SUCCESS);
48
- }
49
- const { appId } = 'appId' in options
50
- ? options
51
- : await selectPublicAppPrompt({
52
- accountId: derivedAccountId,
53
- accountName,
54
- isMigratingApp: true,
55
- });
56
- try {
57
- const { data: selectedApp } = await fetchPublicAppMetadata(appId, derivedAccountId);
58
- // preventProjectMigrations returns true if we have not added app to allowlist config.
59
- // listingInfo will only exist for marketplace apps
60
- const preventProjectMigrations = selectedApp.preventProjectMigrations;
61
- const listingInfo = selectedApp.listingInfo;
62
- if (preventProjectMigrations && listingInfo) {
63
- logger.error(i18n(`${i18nKey}.errors.invalidApp`, { appId }));
64
- process.exit(EXIT_CODES.ERROR);
65
- }
66
- }
67
- catch (error) {
68
- logError(error, new ApiErrorContext({ accountId: derivedAccountId }));
69
- process.exit(EXIT_CODES.ERROR);
70
- }
71
- let projectName;
72
- let projectDest;
73
- try {
74
- const createProjectPromptResponse = await createProjectPrompt(options);
75
- projectName = createProjectPromptResponse.name;
76
- projectDest = createProjectPromptResponse.dest;
77
- const { projectExists } = await ensureProjectExists(derivedAccountId, projectName, {
78
- allowCreate: false,
79
- noLogs: true,
80
- });
81
- if (projectExists) {
82
- logger.error(i18n(`${i18nKey}.errors.projectAlreadyExists`, {
83
- projectName,
84
- }));
85
- process.exit(EXIT_CODES.ERROR);
86
- }
87
- }
88
- catch (error) {
89
- logError(error, new ApiErrorContext({ accountId: derivedAccountId }));
90
- process.exit(EXIT_CODES.ERROR);
91
- }
92
- await trackCommandMetadataUsage('migrate-app', { status: 'STARTED' }, derivedAccountId);
93
- logger.log('');
94
- uiLine();
95
- logger.warn(i18n(`${i18nKey}.warning.title`));
96
- logger.log('');
97
- logger.log(i18n(`${i18nKey}.warning.projectConversion`));
98
- logger.log(i18n(`${i18nKey}.warning.appConfig`));
99
- logger.log('');
100
- logger.log(i18n(`${i18nKey}.warning.buildAndDeploy`));
101
- logger.log('');
102
- logger.log(i18n(`${i18nKey}.warning.existingApps`));
103
- logger.log('');
104
- logger.log(i18n(`${i18nKey}.warning.copyApp`));
105
- uiLine();
106
- const { shouldCreateApp } = await promptUser({
107
- name: 'shouldCreateApp',
108
- type: 'confirm',
109
- message: i18n(`${i18nKey}.createAppPrompt`),
110
- });
111
- process.stdin.resume();
112
- if (!shouldCreateApp) {
113
- process.exit(EXIT_CODES.SUCCESS);
114
- }
115
- try {
116
- SpinniesManager.init();
117
- SpinniesManager.add('migrateApp', {
118
- text: i18n(`${i18nKey}.migrationStatus.inProgress`),
119
- });
120
- handleKeypress(async (key) => {
121
- if ((key.ctrl && key.name === 'c') || key.name === 'q') {
122
- SpinniesManager.remove('migrateApp');
123
- logger.log(i18n(`${i18nKey}.migrationInterrupted`));
124
- process.exit(EXIT_CODES.SUCCESS);
125
- }
126
- });
127
- const { data: migrateResponse } = await migrateApp(derivedAccountId, appId, projectName);
128
- const { id } = migrateResponse;
129
- const pollResponse = await poll(() => checkMigrationStatus(derivedAccountId, id));
130
- const { status, project } = pollResponse;
131
- if (status === 'SUCCESS') {
132
- const absoluteDestPath = path.resolve(getCwd(), projectDest);
133
- const { env } = accountConfig;
134
- const baseUrl = getHubSpotWebsiteOrigin(env);
135
- const { data: zippedProject } = await downloadProject(derivedAccountId, projectName, 1);
136
- await extractZipArchive(zippedProject, sanitizeFileName(projectName), path.resolve(absoluteDestPath), { includesRootDir: true, hideLogs: true });
137
- SpinniesManager.succeed('migrateApp', {
138
- text: i18n(`${i18nKey}.migrationStatus.done`),
139
- succeedColor: 'white',
140
- });
141
- logger.log('');
142
- uiLine();
143
- logger.success(i18n(`${i18nKey}.migrationStatus.success`));
144
- logger.log('');
145
- logger.log(uiLink(i18n(`${i18nKey}.projectDetailsLink`), `${baseUrl}/developer-projects/${derivedAccountId}/project/${encodeURIComponent(project.name)}`));
146
- process.exit(EXIT_CODES.SUCCESS);
147
- }
148
- }
149
- catch (error) {
150
- await trackCommandMetadataUsage('migrate-app', { status: 'FAILURE' }, derivedAccountId);
151
- SpinniesManager.fail('migrateApp', {
152
- text: i18n(`${i18nKey}.migrationStatus.failure`),
153
- failColor: 'white',
154
- });
155
- if (error.errors) {
156
- error.errors.forEach(logError);
157
- }
158
- else {
159
- logError(error, new ApiErrorContext({ accountId: derivedAccountId }));
160
- }
161
- process.exit(EXIT_CODES.ERROR);
162
- }
163
- await trackCommandMetadataUsage('migrate-app', { status: 'SUCCESS' }, derivedAccountId);
164
- process.exit(EXIT_CODES.SUCCESS);
165
- };
166
- exports.builder = yargs => {
12
+ // TODO: Leave this as deprecated and remove in the next major release
13
+ exports.describe = (0, ui_1.uiDeprecatedTag)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.describe`), false);
14
+ exports.deprecated = true;
15
+ async function handler(yargs) {
16
+ logger_1.logger.warn((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.deprecationWarning`, {
17
+ oldCommand: (0, ui_1.uiCommandReference)('hs project migrate-app'),
18
+ newCommand: (0, ui_1.uiCommandReference)('hs app migrate'),
19
+ }));
20
+ await (0, migrate_1.handler)(yargs);
21
+ }
22
+ function builder(yargs) {
23
+ (0, commonOpts_1.addConfigOptions)(yargs);
24
+ (0, commonOpts_1.addAccountOptions)(yargs);
25
+ (0, commonOpts_1.addUseEnvironmentOptions)(yargs);
167
26
  yargs.options({
168
27
  name: {
169
- describe: i18n(`${i18nKey}.options.name.describe`),
28
+ describe: (0, lang_1.i18n)(`commands.project.subcommands.migrateApp.options.name.describe`),
170
29
  type: 'string',
171
30
  },
172
31
  dest: {
173
- describe: i18n(`${i18nKey}.options.dest.describe`),
32
+ describe: (0, lang_1.i18n)(`commands.project.subcommands.migrateApp.options.dest.describe`),
174
33
  type: 'string',
175
34
  },
176
35
  'app-id': {
177
- describe: i18n(`${i18nKey}.options.appId.describe`),
36
+ describe: (0, lang_1.i18n)(`commands.project.subcommands.migrateApp.options.appId.describe`),
178
37
  type: 'number',
179
38
  },
39
+ 'platform-version': {
40
+ type: 'string',
41
+ choices: migrate_1.validMigrationTargets,
42
+ hidden: true,
43
+ default: '2023.2',
44
+ },
180
45
  });
181
46
  yargs.example([
182
- ['$0 project migrate-app', i18n(`${i18nKey}.examples.default`)],
47
+ [
48
+ `$0 project migrate-app`,
49
+ (0, lang_1.i18n)(`commands.project.subcommands.migrateApp.examples.default`),
50
+ ],
183
51
  ]);
184
- addConfigOptions(yargs);
185
- addAccountOptions(yargs);
186
- addUseEnvironmentOptions(yargs);
187
52
  return yargs;
53
+ }
54
+ const migrateAppCommand = {
55
+ command: exports.command,
56
+ describe: exports.describe,
57
+ deprecated: exports.deprecated,
58
+ handler,
59
+ builder,
188
60
  };
61
+ exports.default = migrateAppCommand;
@@ -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: {
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 }}"
@@ -570,6 +631,7 @@ en:
570
631
  header:
571
632
  text: "Migrate an app to the projects framework"
572
633
  link: "Learn more about migrating apps to the projects framework"
634
+ deprecationWarning: "The {{ oldCommand }} command is deprecated and will be removed. Use {{ newCommand }} going forward."
573
635
  migrationStatus:
574
636
  inProgress: "Converting app configuration to {{#bold}}public-app.json{{/bold}} component definition ..."
575
637
  success: "{{#bold}}Your app was converted and build #1 is deployed{{/bold}}"
@@ -585,11 +647,40 @@ en:
585
647
  migrationInterrupted: "\nThe command is terminated, but app migration is still in progress. Please check your account to ensure that the project and associated app have been created successfully."
586
648
  createAppPrompt: "Proceed with migrating this app to a project component (this process can't be aborted)?"
587
649
  projectDetailsLink: "View project details in your developer account"
650
+ componentsToBeMigrated: "The following component types will be migrated: {{ components }}"
651
+ componentsThatWillNotBeMigrated: "[NOTE] These component types are not yet supported for migration but will be available later: {{ components }}"
588
652
  errors:
653
+ noAppsEligible: "No apps in account {{ accountId }} are currently migratable"
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 }}."
589
655
  invalidAccountTypeTitle: "{{#bold}}Developer account not targeted{{/bold}}"
590
656
  invalidAccountTypeDescription: "Only public apps created in a developer account can be converted to a project component. Select a connected developer account with {{useCommand}} or {{authCommand}} and try again."
591
657
  projectAlreadyExists: "A project with name {{ projectName }} already exists. Please choose another name."
592
658
  invalidApp: "Could not migrate appId {{ appId }}. This app cannot be migrated at this time. Please choose another public app."
659
+ appWithAppIdNotFound: "Could not find an app with the id {{ appId }} "
660
+ migrationFailed: 'Migration Failed'
661
+ prompt:
662
+ chooseApp: 'Which app would you like to migrate?'
663
+ inputName: '[--name] What would you like to name the project?'
664
+ inputDest: '[--dest] Where would you like to save the project?'
665
+ uidForComponent: 'What UID would you like to use for {{ componentName }}?'
666
+ proceed: 'Would you like to proceed?'
667
+ spinners:
668
+ beginningMigration: "Beginning migration"
669
+ unableToStartMigration: "Unable to begin migration"
670
+ finishingMigration: "Wrapping up migration"
671
+ migrationComplete: "Migration completed"
672
+ migrationFailed: "Migration failed"
673
+ downloadingProjectContents: "Downloading migrated project files"
674
+ downloadingProjectContentsComplete: "Migrated project files downloaded"
675
+ downloadingProjectContentsFailed: "Unable to download migrated project files"
676
+ copyingProjectFiles: "Copying migrated project files"
677
+ copyingProjectFilesComplete: "Migrated project files copied"
678
+ copyingProjectFilesFailed: "Unable to copy migrated project files"
679
+ unmigratableReasons:
680
+ upToDate: 'App is already up to date'
681
+ isPrivateApp: 'Private apps are not currently migratable'
682
+ listedInMarketplace: 'Listed apps are not currently migratable'
683
+ generic: "Unable to migrate app: {{ reasonCode }}"
593
684
  cloneApp:
594
685
  describe: "Clone a public app using the projects framework."
595
686
  examples:
@@ -608,6 +699,7 @@ en:
608
699
  invalidAccountTypeTitle: "{{#bold}}Developer account not targeted{{/bold}}"
609
700
  invalidAccountTypeDescription: "Only public apps created in a developer account can be converted to a project component. Select a connected developer account with {{useCommand}} or {{authCommand}} and try again."
610
701
  couldNotWriteConfigPath: "Failed to write project config at {{ configPath }}"
702
+ noAccountConfig: "There is no account associated with {{ accountId }} in the config file. Please choose another account and try again, or authenticate {{ accountId }} using {{ authCommand }}."
611
703
  add:
612
704
  describe: "Create a new component within a project."
613
705
  options:
@@ -741,6 +833,7 @@ en:
741
833
  uploadFailed: "Failed to upload file \"{{ filePath }}\" to \"{{ remotePath }}\""
742
834
  deleteFileFailed: "Failed to delete file \"{{ remotePath }}\""
743
835
  deleteFolderFailed: "Failed to delete folder \"{{ remotePath }}\""
836
+ v3ApiError: "{{ command }} is not supported for platform version '{{ platformVersion}}', use {{ newCommand }} instead to develop locally. {{ linkToDocs }}"
744
837
  download:
745
838
  describe: "Download your project files from HubSpot."
746
839
  examples:
@@ -1164,6 +1257,9 @@ en:
1164
1257
  compressed: "Project files compressed: {{ byteCount }} bytes"
1165
1258
  compressing: "Compressing build files to \"{{ path }}\""
1166
1259
  fileFiltered: "Ignore rule triggered for \"{{ filename }}\""
1260
+ middleware:
1261
+ fireAlarm:
1262
+ failedToLoadBoxen: "Failed to load boxen util."
1167
1263
  ui:
1168
1264
  betaTag: "{{#bold}}[BETA]{{/bold}}"
1169
1265
  betaWarning:
@@ -1184,11 +1280,14 @@ en:
1184
1280
  command: "--account"
1185
1281
  message: "Use the {{ command }} option with any command to override the default account"
1186
1282
  accountsListCommand:
1187
- command: hs accounts list
1283
+ command: "hs account list"
1188
1284
  message: "Run {{ command }} to see a list of configured HubSpot accounts"
1189
1285
  accountsUseCommand:
1190
- command: "hs accounts use"
1286
+ command: "hs account use"
1191
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"
1192
1291
  authCommand:
1193
1292
  command: "hs auth"
1194
1293
  message: "Run {{ command }} to connect the CLI to additional HubSpot accounts"
@@ -1253,6 +1352,13 @@ en:
1253
1352
  describe: "Use environment variable config"
1254
1353
  debug:
1255
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"
1256
1362
  prompts:
1257
1363
  projectDevTargetAccountPrompt:
1258
1364
  createNewSandboxOption: "<Test on a new development sandbox>"
@@ -1539,6 +1645,9 @@ en:
1539
1645
  doctor:
1540
1646
  runningDiagnostics: "Running diagnostics..."
1541
1647
  diagnosticsComplete: "Diagnostics complete"
1648
+ defaultAccountOverrideFileChecks:
1649
+ overrideActive: "Default account override file active: {{ defaultAccountOverrideFile }}"
1650
+ overrideAccountId: "Active account ID: {{ overrideAccountId }}"
1542
1651
  accountChecks:
1543
1652
  active: "Default account active"
1544
1653
  inactive: "Default account isn't active"
@@ -1590,6 +1699,8 @@ en:
1590
1699
  settings:
1591
1700
  httpUseLocalhost: "The setting {{#bold}}httpUseLocalhost{{/bold}} is enabled"
1592
1701
  httpUseLocalhostSecondary: "This setting causes all CLI requests to route to localhost"
1702
+ defaultAccountOverrideFile:
1703
+ header: "Default account override file path:"
1593
1704
  projectConfig:
1594
1705
  header: "Project configuration"
1595
1706
  projectDirSubHeader: "Project dir: {{#bold}}{{ projectDir }}{{/bold}}"
@@ -0,0 +1,5 @@
1
+ import { ArgumentsCamelCase } from 'yargs';
2
+ import { MigrateAppOptions } from '../../types/Yargs';
3
+ export declare function downloadProjectFiles(derivedAccountId: number, projectName: string, buildId: number, projectDest: string): Promise<void>;
4
+ export declare function migrateApp2025_2(derivedAccountId: number, options: ArgumentsCamelCase<MigrateAppOptions>): Promise<void>;
5
+ export declare function logInvalidAccountError(i18nKey: string): void;