@hubspot/cli 7.4.2-experimental.0 → 7.4.2

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 (95) hide show
  1. package/api/migrate.d.ts +62 -0
  2. package/api/migrate.js +61 -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.d.ts +4 -4
  17. package/commands/app/migrate.js +10 -4
  18. package/commands/auth.js +6 -2
  19. package/commands/cms/lighthouseScore.js +6 -2
  20. package/commands/config/migrate.d.ts +10 -0
  21. package/commands/config/migrate.js +84 -0
  22. package/commands/config/set.d.ts +10 -0
  23. package/commands/config/set.js +34 -29
  24. package/commands/config.d.ts +4 -1
  25. package/commands/config.js +45 -11
  26. package/commands/create/api-sample.js +3 -1
  27. package/commands/customObject/schema/delete.js +4 -1
  28. package/commands/customObject/schema/fetch-all.js +2 -1
  29. package/commands/customObject/schema/fetch.js +2 -1
  30. package/commands/init.js +9 -10
  31. package/commands/project/cloneApp.d.ts +5 -1
  32. package/commands/project/cloneApp.js +1 -1
  33. package/commands/project/dev/index.js +1 -1
  34. package/commands/project/installDeps.d.ts +9 -1
  35. package/commands/project/installDeps.js +43 -30
  36. package/commands/project/logs.d.ts +13 -1
  37. package/commands/project/logs.js +69 -62
  38. package/commands/project/migrate.d.ts +11 -0
  39. package/commands/project/migrate.js +54 -0
  40. package/commands/project/migrateApp.d.ts +4 -4
  41. package/commands/project/upload.d.ts +12 -0
  42. package/commands/project/upload.js +62 -49
  43. package/commands/project/watch.js +12 -0
  44. package/commands/project.js +2 -0
  45. package/lang/en.d.ts +2840 -0
  46. package/lang/en.js +2647 -3301
  47. package/lang/en.lyaml +100 -40
  48. package/lib/app/migrate.d.ts +10 -6
  49. package/lib/app/migrate.js +157 -232
  50. package/lib/app/migrate_legacy.d.ts +4 -0
  51. package/lib/app/migrate_legacy.js +131 -0
  52. package/lib/configMigrate.d.ts +2 -0
  53. package/lib/configMigrate.js +104 -0
  54. package/lib/doctor/Diagnosis.d.ts +1 -2
  55. package/lib/doctor/Diagnosis.js +10 -6
  56. package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -0
  57. package/lib/doctor/DiagnosticInfoBuilder.js +1 -0
  58. package/lib/doctor/Doctor.d.ts +1 -0
  59. package/lib/doctor/Doctor.js +18 -0
  60. package/lib/middleware/__test__/configMiddleware.test.d.ts +1 -0
  61. package/lib/middleware/__test__/configMiddleware.test.js +194 -0
  62. package/lib/middleware/__test__/gitMiddleware.test.d.ts +1 -0
  63. package/lib/middleware/__test__/gitMiddleware.test.js +76 -0
  64. package/lib/middleware/__test__/notificationsMiddleware.test.d.ts +1 -0
  65. package/lib/middleware/__test__/notificationsMiddleware.test.js +10 -0
  66. package/lib/middleware/__test__/requestMiddleware.test.d.ts +1 -0
  67. package/lib/middleware/__test__/requestMiddleware.test.js +20 -0
  68. package/lib/middleware/__test__/utils.test.d.ts +1 -0
  69. package/lib/middleware/__test__/utils.test.js +53 -0
  70. package/lib/middleware/__test__/yargsChecksMiddleware.test.d.ts +1 -0
  71. package/lib/middleware/__test__/yargsChecksMiddleware.test.js +81 -0
  72. package/lib/middleware/configMiddleware.d.ts +13 -0
  73. package/lib/middleware/configMiddleware.js +116 -0
  74. package/lib/middleware/fireAlarmMiddleware.d.ts +4 -0
  75. package/lib/middleware/fireAlarmMiddleware.js +137 -0
  76. package/lib/middleware/gitMiddleware.d.ts +2 -0
  77. package/lib/middleware/gitMiddleware.js +14 -0
  78. package/lib/middleware/notificationsMiddleware.d.ts +1 -0
  79. package/lib/middleware/notificationsMiddleware.js +38 -0
  80. package/lib/middleware/requestMiddleware.d.ts +1 -0
  81. package/lib/middleware/requestMiddleware.js +11 -0
  82. package/lib/middleware/utils.d.ts +8 -0
  83. package/lib/middleware/utils.js +17 -0
  84. package/lib/middleware/yargsChecksMiddleware.d.ts +4 -0
  85. package/lib/middleware/yargsChecksMiddleware.js +24 -0
  86. package/lib/projects/ProjectLogsManager.d.ts +1 -1
  87. package/lib/projects/ProjectLogsManager.js +1 -1
  88. package/lib/projects/index.d.ts +4 -3
  89. package/lib/projects/upload.d.ts +1 -1
  90. package/lib/ui/SpinniesManager.d.ts +1 -1
  91. package/lib/ui/index.d.ts +1 -0
  92. package/lib/ui/index.js +5 -0
  93. package/lib/ui/spinniesUtils.d.ts +5 -5
  94. package/package.json +7 -6
  95. package/types/Yargs.d.ts +0 -10
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.command = exports.describe = void 0;
7
+ exports.handler = handler;
8
+ exports.builder = builder;
9
+ const fs_extra_1 = __importDefault(require("fs-extra"));
10
+ const path_1 = __importDefault(require("path"));
11
+ const path_2 = require("@hubspot/local-dev-lib/path");
12
+ const logger_1 = require("@hubspot/local-dev-lib/logger");
13
+ const config_1 = require("@hubspot/local-dev-lib/constants/config");
14
+ const config_2 = require("@hubspot/local-dev-lib/config");
15
+ const lang_1 = require("../../lib/lang");
16
+ const promptUtils_1 = require("../../lib/prompts/promptUtils");
17
+ const exitCodes_1 = require("../../lib/enums/exitCodes");
18
+ const usageTracking_1 = require("../../lib/usageTracking");
19
+ const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
20
+ const index_1 = require("../../lib/errorHandlers/index");
21
+ exports.describe = (0, lang_1.i18n)('commands.account.subcommands.createOverride.describe', {
22
+ hsAccountFileName: config_1.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
23
+ });
24
+ exports.command = 'create-override [account]';
25
+ async function handler(args) {
26
+ let overrideDefaultAccount = args.account;
27
+ const accountOverride = (0, config_2.getCWDAccountOverride)();
28
+ const overrideFilePath = (0, config_2.getDefaultAccountOverrideFilePath)();
29
+ if (accountOverride && overrideFilePath) {
30
+ logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.createOverride.accountOverride', {
31
+ accountOverride,
32
+ overrideFilePath,
33
+ }));
34
+ const { replaceOverrideFile } = await (0, promptUtils_1.promptUser)({
35
+ type: 'confirm',
36
+ name: 'replaceOverrideFile',
37
+ message: (0, lang_1.i18n)('commands.account.subcommands.createOverride.prompts.replaceOverrideFile'),
38
+ });
39
+ logger_1.logger.log('');
40
+ if (!replaceOverrideFile) {
41
+ const accountId = (0, config_2.getAccountId)(accountOverride) || undefined;
42
+ (0, usageTracking_1.trackCommandMetadataUsage)('account-createOverride', {
43
+ command: 'hs account create-override',
44
+ step: 'Reject overwriting an override via prompt',
45
+ }, accountId);
46
+ process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
47
+ }
48
+ }
49
+ if (!overrideDefaultAccount) {
50
+ overrideDefaultAccount = await (0, accountsPrompt_1.selectAccountFromConfig)();
51
+ }
52
+ else if (!(0, config_2.getAccountId)(overrideDefaultAccount)) {
53
+ logger_1.logger.error((0, lang_1.i18n)('commands.account.subcommands.createOverride.errors.accountNotFound', {
54
+ configPath: (0, config_2.getConfigPath)() || '',
55
+ }));
56
+ overrideDefaultAccount = await (0, accountsPrompt_1.selectAccountFromConfig)();
57
+ }
58
+ const accountId = (0, config_2.getAccountId)(overrideDefaultAccount);
59
+ try {
60
+ const overrideFilePath = path_1.default.join((0, path_2.getCwd)(), config_1.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME);
61
+ await fs_extra_1.default.writeFile(overrideFilePath, accountId.toString(), 'utf8');
62
+ logger_1.logger.success((0, lang_1.i18n)('commands.account.subcommands.createOverride.success', {
63
+ overrideFilePath,
64
+ }));
65
+ const trackingId = accountId || undefined;
66
+ (0, usageTracking_1.trackCommandMetadataUsage)('config-migrate', {
67
+ command: 'hs config migrate',
68
+ step: 'Confirm overwriting an override via prompt',
69
+ successful: true,
70
+ }, trackingId);
71
+ process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
72
+ }
73
+ catch (e) {
74
+ (0, index_1.logError)(e);
75
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
76
+ }
77
+ }
78
+ function builder(yargs) {
79
+ yargs.positional('account', {
80
+ describe: (0, lang_1.i18n)('commands.account.subcommands.createOverride.options.account.describe'),
81
+ type: 'string',
82
+ });
83
+ yargs.example([
84
+ [
85
+ '$0 account create-override',
86
+ (0, lang_1.i18n)('commands.account.subcommands.createOverride.examples.default', {
87
+ hsAccountFileName: config_1.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
88
+ }),
89
+ ],
90
+ [
91
+ '$0 account create-override 12345678',
92
+ (0, lang_1.i18n)('commands.account.subcommands.createOverride.examples.idBased', {
93
+ hsAccountFileName: config_1.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
94
+ }),
95
+ ],
96
+ [
97
+ '$0 account create-override MyAccount',
98
+ (0, lang_1.i18n)('commands.account.subcommands.createOverride.examples.nameBased', {
99
+ hsAccountFileName: config_1.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
100
+ }),
101
+ ],
102
+ ]);
103
+ return yargs;
104
+ }
@@ -7,6 +7,7 @@ const config_1 = require("@hubspot/local-dev-lib/config");
7
7
  const personalAccessKey_1 = require("@hubspot/local-dev-lib/personalAccessKey");
8
8
  const yargsUtils_1 = require("../../lib/yargsUtils");
9
9
  const lang_1 = require("../../lib/lang");
10
+ const index_1 = require("../../lib/ui/index");
10
11
  const table_1 = require("../../lib/ui/table");
11
12
  exports.describe = (0, lang_1.i18n)(`commands.account.subcommands.info.describe`);
12
13
  exports.command = 'info [account]';
@@ -19,8 +20,32 @@ async function handler(args) {
19
20
  let scopeGroups = [];
20
21
  const response = await (0, personalAccessKey_1.getAccessToken)(personalAccessKey, env, derivedAccountId);
21
22
  scopeGroups = response.scopeGroups.map(s => [s]);
23
+ // If a default account is present in the config, display it
24
+ const configPath = (0, config_1.getConfigPath)();
25
+ if (configPath) {
26
+ logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.defaultAccountTitle`));
27
+ logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.info.configPath`, {
28
+ configPath,
29
+ })}`);
30
+ logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.info.defaultAccount`, {
31
+ account: (0, config_1.getDisplayDefaultAccount)(),
32
+ })}`);
33
+ }
34
+ // If a default account override is present, display it
35
+ const overrideFilePath = (0, config_1.getDefaultAccountOverrideFilePath)();
36
+ if (overrideFilePath) {
37
+ logger_1.logger.log('');
38
+ logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.overrideFilePathTitle`));
39
+ logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.info.overrideFilePath`, { overrideFilePath })}`);
40
+ logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.info.overrideAccount`, {
41
+ account: (0, config_1.getConfigDefaultAccount)(),
42
+ })}`);
43
+ }
44
+ logger_1.logger.log('');
22
45
  logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.name`, { name: name }));
23
- logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.accountId`, { accountId: derivedAccountId }));
46
+ logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.accountId`, {
47
+ accountId: derivedAccountId,
48
+ }));
24
49
  logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.scopeGroups`));
25
50
  logger_1.logger.log((0, table_1.getTableContents)(scopeGroups, { border: { bodyLeft: ' ' } }));
26
51
  }
@@ -34,9 +59,18 @@ function accountInfoBuilder(yargs) {
34
59
  type: 'string',
35
60
  });
36
61
  yargs.example([
37
- ['$0 accounts info', (0, lang_1.i18n)(`commands.account.subcommands.info.examples.default`)],
38
- ['$0 accounts info MyAccount', (0, lang_1.i18n)(`commands.account.subcommands.info.examples.nameBased`)],
39
- ['$0 accounts info 1234567', (0, lang_1.i18n)(`commands.account.subcommands.info.examples.idBased`)],
62
+ [
63
+ '$0 accounts info',
64
+ (0, lang_1.i18n)(`commands.account.subcommands.info.examples.default`),
65
+ ],
66
+ [
67
+ '$0 accounts info MyAccount',
68
+ (0, lang_1.i18n)(`commands.account.subcommands.info.examples.nameBased`),
69
+ ],
70
+ [
71
+ '$0 accounts info 1234567',
72
+ (0, lang_1.i18n)(`commands.account.subcommands.info.examples.idBased`),
73
+ ],
40
74
  ]);
41
75
  return yargs;
42
76
  }
@@ -7,6 +7,7 @@ const logger_1 = require("@hubspot/local-dev-lib/logger");
7
7
  const config_1 = require("@hubspot/local-dev-lib/config");
8
8
  const getAccountIdentifier_1 = require("@hubspot/local-dev-lib/config/getAccountIdentifier");
9
9
  const commonOpts_1 = require("../../lib/commonOpts");
10
+ const index_1 = require("../../lib/ui/index");
10
11
  const table_1 = require("../../lib/ui/table");
11
12
  const usageTracking_1 = require("../../lib/usageTracking");
12
13
  const accountTypes_1 = require("../../lib/accountTypes");
@@ -80,11 +81,28 @@ async function handler(args) {
80
81
  (0, lang_1.i18n)('commands.account.subcommands.list.labels.accountId'),
81
82
  (0, lang_1.i18n)('commands.account.subcommands.list.labels.authType'),
82
83
  ]));
83
- logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.list.configPath', { configPath: configPath }));
84
- logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.list.defaultAccount', {
85
- account: (0, config_1.getConfigDefaultAccount)(),
86
- }));
87
- logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.list.accounts'));
84
+ // If a default account is present in the config, display it
85
+ if (configPath) {
86
+ logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.list.defaultAccountTitle`));
87
+ logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.list.configPath`, {
88
+ configPath,
89
+ })}`);
90
+ logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.list.defaultAccount`, {
91
+ account: (0, config_1.getDisplayDefaultAccount)(),
92
+ })}`);
93
+ logger_1.logger.log('');
94
+ }
95
+ // If a default account override is present, display it
96
+ const overrideFilePath = (0, config_1.getDefaultAccountOverrideFilePath)();
97
+ if (overrideFilePath) {
98
+ logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.list.overrideFilePathTitle`));
99
+ logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.list.overrideFilePath`, { overrideFilePath })}`);
100
+ logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.list.overrideAccount`, {
101
+ account: (0, config_1.getConfigDefaultAccount)(),
102
+ })}`);
103
+ logger_1.logger.log('');
104
+ }
105
+ logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.list.accounts`));
88
106
  logger_1.logger.log((0, table_1.getTableContents)(accountData, { border: { bodyLeft: ' ' } }));
89
107
  }
90
108
  function builder(yargs) {
@@ -1,12 +1,18 @@
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
6
  exports.describe = exports.command = void 0;
4
7
  exports.handler = handler;
5
8
  exports.builder = builder;
9
+ const fs_1 = __importDefault(require("fs"));
6
10
  const logger_1 = require("@hubspot/local-dev-lib/logger");
7
11
  const config_1 = require("@hubspot/local-dev-lib/config");
8
12
  const usageTracking_1 = require("../../lib/usageTracking");
9
13
  const lang_1 = require("../../lib/lang");
14
+ const promptUtils_1 = require("../../lib/prompts/promptUtils");
15
+ const errorHandlers_1 = require("../../lib/errorHandlers");
10
16
  const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
11
17
  const commonOpts_1 = require("../../lib/commonOpts");
12
18
  exports.command = 'remove [account]';
@@ -25,6 +31,28 @@ async function handler(args) {
25
31
  }
26
32
  (0, usageTracking_1.trackCommandUsage)('accounts-remove', undefined, (0, config_1.getAccountId)(accountToRemove));
27
33
  const currentDefaultAccount = (0, config_1.getConfigDefaultAccount)();
34
+ const accountOverride = (0, config_1.getCWDAccountOverride)();
35
+ const overrideFilePath = (0, config_1.getDefaultAccountOverrideFilePath)();
36
+ if (overrideFilePath &&
37
+ accountOverride &&
38
+ accountOverride === accountToRemove) {
39
+ const { deleteOverrideFile } = await (0, promptUtils_1.promptUser)({
40
+ type: 'confirm',
41
+ name: 'deleteOverrideFile',
42
+ message: (0, lang_1.i18n)(`commands.account.subcommands.remove.prompts.deleteOverrideFile`, {
43
+ overrideFilePath,
44
+ accountName: accountToRemove,
45
+ }),
46
+ });
47
+ try {
48
+ if (deleteOverrideFile) {
49
+ fs_1.default.unlinkSync(overrideFilePath);
50
+ }
51
+ }
52
+ catch (error) {
53
+ (0, errorHandlers_1.logError)(error);
54
+ }
55
+ }
28
56
  await (0, config_1.deleteAccount)(accountToRemove);
29
57
  logger_1.logger.success((0, lang_1.i18n)(`commands.account.subcommands.remove.success.accountRemoved`, {
30
58
  accountName: accountToRemove,
@@ -45,8 +73,14 @@ function builder(yargs) {
45
73
  type: 'string',
46
74
  });
47
75
  yargs.example([
48
- ['$0 accounts remove', (0, lang_1.i18n)(`commands.account.subcommands.remove.examples.default`)],
49
- ['$0 accounts remove MyAccount', (0, lang_1.i18n)(`commands.account.subcommands.remove.examples.byName`)],
76
+ [
77
+ '$0 accounts remove',
78
+ (0, lang_1.i18n)(`commands.account.subcommands.remove.examples.default`),
79
+ ],
80
+ [
81
+ '$0 accounts remove MyAccount',
82
+ (0, lang_1.i18n)(`commands.account.subcommands.remove.examples.byName`),
83
+ ],
50
84
  ]);
51
85
  return yargs;
52
86
  }
@@ -0,0 +1,10 @@
1
+ import { Argv, ArgumentsCamelCase } from 'yargs';
2
+ import { CommonArgs } from '../../types/Yargs';
3
+ export declare const describe: string;
4
+ export declare const command = "remove-override";
5
+ type RemoveOverrideArgs = CommonArgs & {
6
+ force?: boolean;
7
+ };
8
+ export declare function handler(args: ArgumentsCamelCase<RemoveOverrideArgs>): Promise<void>;
9
+ export declare function builder(yargs: Argv): Argv<RemoveOverrideArgs>;
10
+ export {};
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.command = exports.describe = void 0;
7
+ exports.handler = handler;
8
+ exports.builder = builder;
9
+ const fs_extra_1 = __importDefault(require("fs-extra"));
10
+ const logger_1 = require("@hubspot/local-dev-lib/logger");
11
+ const config_1 = require("@hubspot/local-dev-lib/config");
12
+ const config_2 = require("@hubspot/local-dev-lib/constants/config");
13
+ const lang_1 = require("../../lib/lang");
14
+ const promptUtils_1 = require("../../lib/prompts/promptUtils");
15
+ const usageTracking_1 = require("../../lib/usageTracking");
16
+ const exitCodes_1 = require("../../lib/enums/exitCodes");
17
+ const index_1 = require("../../lib/errorHandlers/index");
18
+ exports.describe = (0, lang_1.i18n)('commands.account.subcommands.removeOverride.describe', {
19
+ overrideFile: config_2.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
20
+ });
21
+ exports.command = 'remove-override';
22
+ async function handler(args) {
23
+ const { force } = args;
24
+ const accountOverride = (0, config_1.getCWDAccountOverride)();
25
+ const overrideFilePath = (0, config_1.getDefaultAccountOverrideFilePath)();
26
+ if (accountOverride && overrideFilePath) {
27
+ const accountId = (0, config_1.getAccountId)(accountOverride) || undefined;
28
+ if (!force) {
29
+ logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.removeOverride.accountOverride', {
30
+ accountOverride,
31
+ overrideFilePath,
32
+ }));
33
+ const { deleteOverrideFile } = await (0, promptUtils_1.promptUser)({
34
+ type: 'confirm',
35
+ name: 'deleteOverrideFile',
36
+ message: (0, lang_1.i18n)('commands.account.subcommands.removeOverride.prompts.deleteOverrideFile', {
37
+ accountOverride,
38
+ overrideFilePath,
39
+ }),
40
+ });
41
+ logger_1.logger.log('');
42
+ if (!deleteOverrideFile) {
43
+ (0, usageTracking_1.trackCommandMetadataUsage)('account-removeOverride', {
44
+ command: 'hs account remove-override',
45
+ step: 'Reject removing override via prompt',
46
+ }, accountId);
47
+ process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
48
+ }
49
+ }
50
+ try {
51
+ fs_extra_1.default.unlinkSync(overrideFilePath);
52
+ logger_1.logger.success((0, lang_1.i18n)('commands.account.subcommands.removeOverride.success'));
53
+ (0, usageTracking_1.trackCommandMetadataUsage)('account-removeOverride', {
54
+ command: 'hs account remove-override',
55
+ step: 'Confirm removing override file (via prompt/force)',
56
+ successful: true,
57
+ }, accountId);
58
+ process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
59
+ }
60
+ catch (error) {
61
+ (0, index_1.logError)(error);
62
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
63
+ }
64
+ }
65
+ else {
66
+ logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.removeOverride.noOverrideFile'));
67
+ process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
68
+ }
69
+ }
70
+ function builder(yargs) {
71
+ yargs.options('force', {
72
+ describe: (0, lang_1.i18n)('commands.account.subcommands.removeOverride.options.force.describe'),
73
+ type: 'boolean',
74
+ });
75
+ return yargs;
76
+ }
@@ -8,6 +8,7 @@ const config_1 = require("@hubspot/local-dev-lib/config");
8
8
  const usageTracking_1 = require("../../lib/usageTracking");
9
9
  const lang_1 = require("../../lib/lang");
10
10
  const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
11
+ const ui_1 = require("../../lib/ui");
11
12
  exports.command = 'use [account]';
12
13
  exports.describe = (0, lang_1.i18n)('commands.account.subcommands.use.describe');
13
14
  async function handler(args) {
@@ -23,6 +24,18 @@ async function handler(args) {
23
24
  newDefaultAccount = await (0, accountsPrompt_1.selectAccountFromConfig)();
24
25
  }
25
26
  (0, usageTracking_1.trackCommandUsage)('accounts-use', undefined, (0, config_1.getAccountId)(newDefaultAccount));
27
+ const accountOverride = (0, config_1.getCWDAccountOverride)();
28
+ const overrideFilePath = (0, config_1.getDefaultAccountOverrideFilePath)();
29
+ if (accountOverride && overrideFilePath) {
30
+ logger_1.logger.warn((0, lang_1.i18n)(`commands.account.subcommands.use.accountOverride`, {
31
+ accountOverride,
32
+ }));
33
+ logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.use.accountOverrideCommands`, {
34
+ createOverrideCommand: (0, ui_1.uiCommandReference)('hs account create-override'),
35
+ removeOverrideCommand: (0, ui_1.uiCommandReference)('hs account remove-override'),
36
+ }));
37
+ logger_1.logger.log('');
38
+ }
26
39
  (0, config_1.updateDefaultAccount)(newDefaultAccount);
27
40
  return logger_1.logger.success((0, lang_1.i18n)('commands.account.subcommands.use.success.defaultAccountUpdated', {
28
41
  accountName: newDefaultAccount,
@@ -34,9 +47,18 @@ function builder(yargs) {
34
47
  type: 'string',
35
48
  });
36
49
  yargs.example([
37
- ['$0 accounts use', (0, lang_1.i18n)('commands.account.subcommands.use.examples.default')],
38
- ['$0 accounts use MyAccount', (0, lang_1.i18n)('commands.account.subcommands.use.examples.nameBased')],
39
- ['$0 accounts use 1234567', (0, lang_1.i18n)('commands.account.subcommands.use.examples.idBased')],
50
+ [
51
+ '$0 accounts use',
52
+ (0, lang_1.i18n)('commands.account.subcommands.use.examples.default'),
53
+ ],
54
+ [
55
+ '$0 accounts use MyAccount',
56
+ (0, lang_1.i18n)('commands.account.subcommands.use.examples.nameBased'),
57
+ ],
58
+ [
59
+ '$0 accounts use 1234567',
60
+ (0, lang_1.i18n)('commands.account.subcommands.use.examples.idBased'),
61
+ ],
40
62
  ]);
41
63
  return yargs;
42
64
  }
@@ -37,24 +37,29 @@ exports.describe = exports.command = void 0;
37
37
  exports.builder = builder;
38
38
  const commonOpts_1 = require("../lib/commonOpts");
39
39
  const lang_1 = require("../lib/lang");
40
+ const auth = __importStar(require("./account/auth"));
40
41
  const list = __importStar(require("./account/list"));
41
42
  const rename = __importStar(require("./account/rename"));
42
43
  const use = __importStar(require("./account/use"));
43
44
  const info = __importStar(require("./account/info"));
44
45
  const remove = __importStar(require("./account/remove"));
45
46
  const clean = __importStar(require("./account/clean"));
46
- const i18nKey = 'commands.account';
47
+ const createOverride = __importStar(require("./account/createOverride"));
48
+ const removeOverride = __importStar(require("./account/removeOverride"));
47
49
  exports.command = ['account', 'accounts'];
48
- exports.describe = (0, lang_1.i18n)(`${i18nKey}.describe`);
50
+ exports.describe = (0, lang_1.i18n)('commands.account.describe');
49
51
  function builder(yargs) {
50
52
  (0, commonOpts_1.addGlobalOptions)(yargs);
51
53
  yargs
54
+ .command(auth)
52
55
  .command(list)
53
56
  .command(rename)
54
57
  .command(use)
55
58
  .command(info)
56
59
  .command(remove)
57
60
  .command(clean)
61
+ .command(createOverride)
62
+ .command(removeOverride)
58
63
  .demandCommand(1, '');
59
64
  return yargs;
60
65
  }
@@ -1,7 +1,7 @@
1
1
  import { ArgumentsCamelCase, Argv, CommandModule } from 'yargs';
2
- import { MigrateAppOptions } from '../../types/Yargs';
2
+ import { MigrateAppArgs } from '../../lib/app/migrate';
3
3
  export declare const validMigrationTargets: string[];
4
- export declare function handler(options: ArgumentsCamelCase<MigrateAppOptions>): Promise<never>;
5
- export declare function builder(yargs: Argv): Argv<MigrateAppOptions>;
6
- declare const migrateCommand: CommandModule<unknown, MigrateAppOptions>;
4
+ export declare function handler(options: ArgumentsCamelCase<MigrateAppArgs>): Promise<never>;
5
+ export declare function builder(yargs: Argv): Argv<MigrateAppArgs>;
6
+ declare const migrateCommand: CommandModule<unknown, MigrateAppArgs>;
7
7
  export default migrateCommand;
@@ -3,16 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validMigrationTargets = void 0;
4
4
  exports.handler = handler;
5
5
  exports.builder = builder;
6
+ const logger_1 = require("@hubspot/local-dev-lib/logger");
7
+ const config_1 = require("@hubspot/local-dev-lib/config");
8
+ const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
6
9
  const commonOpts_1 = require("../../lib/commonOpts");
7
10
  const usageTracking_1 = require("../../lib/usageTracking");
8
11
  const lang_1 = require("../../lib/lang");
9
12
  const errorHandlers_1 = require("../../lib/errorHandlers");
10
13
  const exitCodes_1 = require("../../lib/enums/exitCodes");
11
- const config_1 = require("@hubspot/local-dev-lib/config");
12
14
  const migrate_1 = require("../../lib/app/migrate");
13
- const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
14
- const logger_1 = require("@hubspot/local-dev-lib/logger");
15
15
  const ui_1 = require("../../lib/ui");
16
+ const migrate_legacy_1 = require("../../lib/app/migrate_legacy");
17
+ const projects_2 = require("../../lib/projects");
16
18
  const { v2023_2, v2025_2, unstable } = projects_1.PLATFORM_VERSIONS;
17
19
  exports.validMigrationTargets = [v2023_2, v2025_2, unstable];
18
20
  const command = 'migrate';
@@ -31,10 +33,14 @@ async function handler(options) {
31
33
  logger_1.logger.log('');
32
34
  try {
33
35
  if (platformVersion === v2025_2 || platformVersion === unstable) {
36
+ if ((0, projects_2.getIsInProject)()) {
37
+ logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.errors.notAllowedWithinProject`, { command: (0, ui_1.uiCommandReference)('hs project migrate') }));
38
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
39
+ }
34
40
  await (0, migrate_1.migrateApp2025_2)(derivedAccountId, options);
35
41
  }
36
42
  else {
37
- await (0, migrate_1.migrateApp2023_2)(derivedAccountId, options, accountConfig);
43
+ await (0, migrate_legacy_1.migrateApp2023_2)(derivedAccountId, options, accountConfig);
38
44
  }
39
45
  }
40
46
  catch (error) {
package/commands/auth.js CHANGED
@@ -47,8 +47,12 @@ async function handler(args) {
47
47
  if (configPath) {
48
48
  (0, git_1.checkAndWarnGitInclusion)(configPath);
49
49
  }
50
- if (!(0, config_2.getConfigPath)(configFlagValue)) {
51
- logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.noConfigFileFound`));
50
+ if ((0, config_2.configFileExists)(true)) {
51
+ const globalConfigPath = (0, config_2.getConfigPath)('', true);
52
+ logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.globalConfigFileExists`, {
53
+ configPath: globalConfigPath,
54
+ authCommand: (0, ui_1.uiCommandReference)('hs account auth'),
55
+ }));
52
56
  process.exit(exitCodes_1.EXIT_CODES.ERROR);
53
57
  }
54
58
  (0, usageTracking_1.trackCommandUsage)('auth');
@@ -67,7 +67,9 @@ exports.handler = async (options) => {
67
67
  isValidTheme = false;
68
68
  }
69
69
  if (!isValidTheme) {
70
- logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.themeNotFound`, { theme: themeToCheck }));
70
+ logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.themeNotFound`, {
71
+ theme: themeToCheck,
72
+ }));
71
73
  process.exit(EXIT_CODES.ERROR);
72
74
  }
73
75
  }
@@ -206,7 +208,9 @@ exports.handler = async (options) => {
206
208
  });
207
209
  }
208
210
  logger.log();
209
- logger.info(i18n(`commands.cms.subcommands.lighthouseScore.info.targetDeviceNote`, { target }));
211
+ logger.info(i18n(`commands.cms.subcommands.lighthouseScore.info.targetDeviceNote`, {
212
+ target,
213
+ }));
210
214
  }
211
215
  else {
212
216
  logger.log(`Theme: ${themeToCheck}`);
@@ -0,0 +1,10 @@
1
+ import { Argv, ArgumentsCamelCase } from 'yargs';
2
+ import { CommonArgs, ConfigArgs } from '../../types/Yargs';
3
+ export declare const describe: string;
4
+ export declare const command = "migrate";
5
+ type ConfigMigrateArgs = CommonArgs & ConfigArgs & {
6
+ force?: boolean;
7
+ };
8
+ export declare function handler(args: ArgumentsCamelCase<ConfigMigrateArgs>): Promise<void>;
9
+ export declare function builder(yargs: Argv): Argv<ConfigMigrateArgs>;
10
+ export {};
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.command = exports.describe = void 0;
7
+ exports.handler = handler;
8
+ exports.builder = builder;
9
+ const fs_1 = __importDefault(require("fs"));
10
+ const config_1 = require("@hubspot/local-dev-lib/constants/config");
11
+ const migrate_1 = require("@hubspot/local-dev-lib/config/migrate");
12
+ const logger_1 = require("@hubspot/local-dev-lib/logger");
13
+ const configMigrate_1 = require("../../lib/configMigrate");
14
+ const commonOpts_1 = require("../../lib/commonOpts");
15
+ const lang_1 = require("../../lib/lang");
16
+ const usageTracking_1 = require("../../lib/usageTracking");
17
+ const index_1 = require("../../lib/errorHandlers/index");
18
+ const exitCodes_1 = require("../../lib/enums/exitCodes");
19
+ exports.describe = (0, lang_1.i18n)('commands.config.subcommands.migrate.describe', {
20
+ deprecatedConfigPath: config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
21
+ globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
22
+ });
23
+ exports.command = 'migrate';
24
+ async function handler(args) {
25
+ const { config: configPath, force, derivedAccountId } = args;
26
+ if (configPath && !fs_1.default.existsSync(configPath)) {
27
+ logger_1.logger.log((0, lang_1.i18n)('commands.config.subcommands.migrate.errors.configNotFound', {
28
+ configPath,
29
+ }));
30
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
31
+ }
32
+ const deprecatedConfigExists = (0, migrate_1.configFileExists)(false, configPath);
33
+ const globalConfigExists = (0, migrate_1.configFileExists)(true);
34
+ if (!deprecatedConfigExists) {
35
+ logger_1.logger.log((0, lang_1.i18n)('commands.config.subcommands.migrate.migrationAlreadyCompleted', {
36
+ deprecatedConfigPath: config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
37
+ }));
38
+ process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
39
+ }
40
+ try {
41
+ if (!globalConfigExists) {
42
+ await (0, configMigrate_1.handleMigration)(derivedAccountId, configPath);
43
+ }
44
+ else {
45
+ await (0, configMigrate_1.handleMerge)(derivedAccountId, configPath, force);
46
+ }
47
+ process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
48
+ }
49
+ catch (error) {
50
+ (0, usageTracking_1.trackCommandMetadataUsage)('config-migrate', {
51
+ command: 'hs config migrate',
52
+ type: 'Migration/merge',
53
+ successful: false,
54
+ }, derivedAccountId);
55
+ (0, index_1.logError)(error);
56
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
57
+ }
58
+ }
59
+ function builder(yargs) {
60
+ (0, commonOpts_1.addConfigOptions)(yargs);
61
+ yargs
62
+ .option('force', {
63
+ alias: 'f',
64
+ type: 'boolean',
65
+ default: false,
66
+ description: (0, lang_1.i18n)('commands.config.subcommands.migrate.options.force'),
67
+ })
68
+ .example([
69
+ [
70
+ '$0 config migrate',
71
+ (0, lang_1.i18n)('commands.config.subcommands.migrate.examples.default', {
72
+ deprecatedConfigPath: config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
73
+ globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
74
+ }),
75
+ ],
76
+ [
77
+ '$0 config migrate --config=/path/to/config.yml',
78
+ (0, lang_1.i18n)('commands.config.subcommands.migrate.examples.configFlag', {
79
+ globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
80
+ }),
81
+ ],
82
+ ]);
83
+ return yargs;
84
+ }
@@ -1 +1,11 @@
1
+ import { ArgumentsCamelCase, Argv } from 'yargs';
2
+ import { CommonArgs } from '../../types/Yargs';
3
+ import { CmsPublishMode } from '@hubspot/local-dev-lib/types/Files';
4
+ type ConfigSetArgs = CommonArgs & {
5
+ defaultCmsPublishMode: CmsPublishMode;
6
+ allowUsageTracking?: boolean;
7
+ httpTimeout?: string;
8
+ };
9
+ export declare function handler(args: ArgumentsCamelCase<ConfigSetArgs>): Promise<void>;
10
+ export declare function builder(yargs: Argv): Argv<ConfigSetArgs>;
1
11
  export {};