@hubspot/cli 7.5.7-experimental.0 → 7.5.7-experimental.1

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 (65) hide show
  1. package/api/migrate.d.ts +2 -3
  2. package/api/migrate.js +3 -20
  3. package/bin/cli.js +0 -2
  4. package/commands/account/clean.js +5 -38
  5. package/commands/account/info.js +0 -23
  6. package/commands/account/list.js +7 -23
  7. package/commands/account/remove.js +0 -28
  8. package/commands/account/use.js +0 -13
  9. package/commands/account.js +2 -7
  10. package/commands/app/migrate.d.ts +4 -4
  11. package/commands/auth.js +2 -6
  12. package/commands/config/set.d.ts +0 -10
  13. package/commands/config/set.js +29 -29
  14. package/commands/config.d.ts +1 -4
  15. package/commands/config.js +11 -45
  16. package/commands/init.js +10 -9
  17. package/commands/project/cloneApp.d.ts +1 -5
  18. package/commands/project/cloneApp.js +1 -1
  19. package/commands/project/dev/index.js +1 -1
  20. package/commands/project/installDeps.d.ts +1 -9
  21. package/commands/project/installDeps.js +30 -43
  22. package/commands/project/logs.d.ts +1 -13
  23. package/commands/project/logs.js +62 -69
  24. package/commands/project/migrateApp.d.ts +4 -4
  25. package/commands/project/upload.d.ts +0 -12
  26. package/commands/project/upload.js +54 -62
  27. package/commands/project/watch.js +0 -12
  28. package/commands/project.js +0 -2
  29. package/lang/en.js +3296 -2642
  30. package/lang/en.lyaml +36 -97
  31. package/lib/app/migrate.d.ts +4 -10
  32. package/lib/app/migrate.js +81 -124
  33. package/lib/app/migrate_legacy.d.ts +2 -2
  34. package/lib/app/migrate_legacy.js +4 -6
  35. package/lib/doctor/Diagnosis.d.ts +2 -1
  36. package/lib/doctor/Diagnosis.js +6 -10
  37. package/lib/doctor/DiagnosticInfoBuilder.d.ts +0 -1
  38. package/lib/doctor/DiagnosticInfoBuilder.js +0 -1
  39. package/lib/doctor/Doctor.d.ts +0 -1
  40. package/lib/doctor/Doctor.js +0 -18
  41. package/lib/middleware/configMiddleware.js +1 -5
  42. package/lib/projects/ProjectLogsManager.d.ts +1 -1
  43. package/lib/projects/ProjectLogsManager.js +1 -1
  44. package/lib/projects/index.d.ts +3 -4
  45. package/lib/projects/upload.d.ts +2 -2
  46. package/lib/projects/upload.js +2 -2
  47. package/lib/ui/index.d.ts +0 -1
  48. package/lib/ui/index.js +0 -5
  49. package/package.json +4 -5
  50. package/types/Yargs.d.ts +10 -0
  51. package/commands/account/auth.d.ts +0 -10
  52. package/commands/account/auth.js +0 -168
  53. package/commands/account/createOverride.d.ts +0 -10
  54. package/commands/account/createOverride.js +0 -104
  55. package/commands/account/removeOverride.d.ts +0 -10
  56. package/commands/account/removeOverride.js +0 -76
  57. package/commands/config/migrate.d.ts +0 -10
  58. package/commands/config/migrate.js +0 -84
  59. package/commands/project/migrate.d.ts +0 -11
  60. package/commands/project/migrate.js +0 -54
  61. package/lang/en.d.ts +0 -2838
  62. package/lib/configMigrate.d.ts +0 -2
  63. package/lib/configMigrate.js +0 -104
  64. package/lib/middleware/fireAlarmMiddleware.d.ts +0 -4
  65. package/lib/middleware/fireAlarmMiddleware.js +0 -137
package/api/migrate.d.ts CHANGED
@@ -50,12 +50,11 @@ export interface MigrationSuccess extends MigrationBaseStatus {
50
50
  }
51
51
  export interface MigrationFailed extends MigrationBaseStatus {
52
52
  status: typeof MIGRATION_STATUS.FAILURE;
53
- projectErrorDetail: string;
53
+ projectErrorsDetail?: string;
54
54
  componentErrorDetails: Record<string, string>;
55
55
  }
56
56
  export type MigrationStatus = MigrationInProgress | MigrationInputRequired | MigrationSuccess | MigrationFailed;
57
- export declare function isMigrationStatus(error: unknown): error is MigrationStatus;
58
- export declare function listAppsForMigration(accountId: number, platformVersion: string): HubSpotPromise<ListAppsResponse>;
57
+ export declare function listAppsForMigration(accountId: number): HubSpotPromise<ListAppsResponse>;
59
58
  export declare function initializeMigration(accountId: number, applicationId: number, platformVersion: string): HubSpotPromise<InitializeMigrationResponse>;
60
59
  export declare function continueMigration(portalId: number, migrationId: number, componentUids: Record<string, string>, projectName: string): HubSpotPromise<ContinueMigrationResponse>;
61
60
  export declare function checkMigrationStatusV2(accountId: number, id: number): HubSpotPromise<MigrationStatus>;
package/api/migrate.js CHANGED
@@ -1,30 +1,15 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isMigrationStatus = isMigrationStatus;
7
3
  exports.listAppsForMigration = listAppsForMigration;
8
4
  exports.initializeMigration = initializeMigration;
9
5
  exports.continueMigration = continueMigration;
10
6
  exports.checkMigrationStatusV2 = checkMigrationStatusV2;
11
7
  const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
12
8
  const http_1 = require("@hubspot/local-dev-lib/http");
13
- const logger_1 = require("@hubspot/local-dev-lib/logger");
14
- const util_1 = __importDefault(require("util"));
15
9
  const MIGRATIONS_API_PATH_V2 = 'dfs/migrations/v2';
16
- function isMigrationStatus(error) {
17
- return (typeof error === 'object' &&
18
- error !== null &&
19
- 'id' in error &&
20
- 'status' in error);
21
- }
22
- async function listAppsForMigration(accountId, platformVersion) {
10
+ async function listAppsForMigration(accountId) {
23
11
  return http_1.http.get(accountId, {
24
12
  url: `${MIGRATIONS_API_PATH_V2}/list-apps`,
25
- params: {
26
- platformVersion: mapPlatformVersionToEnum(platformVersion),
27
- },
28
13
  });
29
14
  }
30
15
  function mapPlatformVersionToEnum(platformVersion) {
@@ -52,10 +37,8 @@ async function continueMigration(portalId, migrationId, componentUids, projectNa
52
37
  },
53
38
  });
54
39
  }
55
- async function checkMigrationStatusV2(accountId, id) {
56
- const response = await http_1.http.get(accountId, {
40
+ function checkMigrationStatusV2(accountId, id) {
41
+ return http_1.http.get(accountId, {
57
42
  url: `${MIGRATIONS_API_PATH_V2}/migrations/${id}/status`,
58
43
  });
59
- logger_1.logger.debug(util_1.default.inspect(response.data, { depth: null }));
60
- return response;
61
44
  }
package/bin/cli.js CHANGED
@@ -11,7 +11,6 @@ const { notifyAboutUpdates, } = require('../lib/middleware/notificationsMiddlewa
11
11
  const { checkAndWarnGitInclusionMiddleware, } = require('../lib/middleware/gitMiddleware');
12
12
  const { performChecks } = require('../lib/middleware/yargsChecksMiddleware');
13
13
  const { setRequestHeaders } = require('../lib/middleware/requestMiddleware');
14
- const { checkFireAlarms } = require('../lib/middleware/fireAlarmMiddleware');
15
14
  const removeCommand = require('../commands/remove');
16
15
  const initCommand = require('../commands/init');
17
16
  const logsCommand = require('../commands/logs');
@@ -73,7 +72,6 @@ const argv = yargs
73
72
  injectAccountIdMiddleware,
74
73
  checkAndWarnGitInclusionMiddleware,
75
74
  validateAccountOptions,
76
- checkFireAlarms,
77
75
  ])
78
76
  .exitProcess(false)
79
77
  .fail(handleFailure)
@@ -6,23 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.describe = exports.command = void 0;
7
7
  exports.handler = handler;
8
8
  exports.builder = builder;
9
- const fs_1 = __importDefault(require("fs"));
10
9
  const logger_1 = require("@hubspot/local-dev-lib/logger");
11
10
  const personalAccessKey_1 = require("@hubspot/local-dev-lib/personalAccessKey");
12
11
  const config_1 = require("@hubspot/local-dev-lib/config");
13
12
  const getAccountIdentifier_1 = require("@hubspot/local-dev-lib/config/getAccountIdentifier");
14
13
  const index_1 = require("@hubspot/local-dev-lib/errors/index");
15
- const config_2 = require("@hubspot/local-dev-lib/config");
16
14
  const usageTracking_1 = require("../../lib/usageTracking");
17
15
  const lang_1 = require("../../lib/lang");
18
16
  const exitCodes_1 = require("../../lib/enums/exitCodes");
19
17
  const commonOpts_1 = require("../../lib/commonOpts");
20
18
  const promptUtils_1 = require("../../lib/prompts/promptUtils");
21
- const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
22
19
  const table_1 = require("../../lib/ui/table");
23
20
  const SpinniesManager_1 = __importDefault(require("../../lib/ui/SpinniesManager"));
24
21
  const ui_1 = require("../../lib/ui");
25
- const errorHandlers_1 = require("../../lib/errorHandlers");
26
22
  exports.command = 'clean';
27
23
  exports.describe = (0, lang_1.i18n)(`commands.account.subcommands.clean.describe`);
28
24
  async function handler(args) {
@@ -73,54 +69,25 @@ async function handler(args) {
73
69
  logger_1.logger.log((0, table_1.getTableContents)(accountsToRemove.map(p => [
74
70
  (0, ui_1.uiAccountDescription)((0, getAccountIdentifier_1.getAccountIdentifier)(p)),
75
71
  ]), { border: { bodyLeft: ' ' } }));
76
- let promptMessage = (0, lang_1.i18n)(oneAccountFound
77
- ? `commands.account.subcommands.clean.confirm.one`
78
- : `commands.account.subcommands.clean.confirm.other`, {
79
- count: accountsToRemove.length,
80
- });
81
- const accountOverride = (0, config_2.getCWDAccountOverride)();
82
- const overrideFilePath = (0, config_2.getDefaultAccountOverrideFilePath)();
83
- const accountOverrideMatches = accountsToRemove.some(account => account.name === accountOverride ||
84
- // @ts-expect-error: Default account override files can only exist with global config
85
- account.accountId === accountOverride);
86
- if (overrideFilePath && accountOverride && accountOverrideMatches) {
87
- promptMessage = `${promptMessage}${(0, lang_1.i18n)(`commands.account.subcommands.clean.defaultAccountOverride`, {
88
- overrideFilePath,
89
- })}`;
90
- }
91
72
  const { accountsCleanPrompt } = await (0, promptUtils_1.promptUser)([
92
73
  {
93
74
  name: 'accountsCleanPrompt',
94
75
  type: 'confirm',
95
- message: promptMessage,
76
+ message: (0, lang_1.i18n)(oneAccountFound
77
+ ? `commands.account.subcommands.clean.confirm.one`
78
+ : `commands.account.subcommands.clean.confirm.other`, {
79
+ count: accountsToRemove.length,
80
+ }),
96
81
  },
97
82
  ]);
98
83
  if (accountsCleanPrompt) {
99
84
  logger_1.logger.log('');
100
- try {
101
- if (overrideFilePath) {
102
- fs_1.default.unlinkSync(overrideFilePath);
103
- }
104
- }
105
- catch (error) {
106
- (0, errorHandlers_1.logError)(error);
107
- }
108
85
  for (const accountToRemove of accountsToRemove) {
109
86
  await (0, config_1.deleteAccount)(accountToRemove.name);
110
87
  logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.clean.removeSuccess`, {
111
88
  accountName: accountToRemove.name,
112
89
  }));
113
90
  }
114
- // Get updated version of the config
115
- (0, config_1.loadConfig)((0, config_1.getConfigPath)());
116
- const defaultAccount = (0, config_1.getConfigDefaultAccount)();
117
- if (defaultAccount &&
118
- accountsToRemove.some(p => p.name === defaultAccount)) {
119
- logger_1.logger.log();
120
- logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.clean.replaceDefaultAccount`));
121
- const newDefaultAccount = await (0, accountsPrompt_1.selectAccountFromConfig)();
122
- (0, config_1.updateDefaultAccount)(newDefaultAccount);
123
- }
124
91
  }
125
92
  }
126
93
  else {
@@ -7,7 +7,6 @@ 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");
11
10
  const table_1 = require("../../lib/ui/table");
12
11
  exports.describe = (0, lang_1.i18n)(`commands.account.subcommands.info.describe`);
13
12
  exports.command = 'info [account]';
@@ -20,28 +19,6 @@ async function handler(args) {
20
19
  let scopeGroups = [];
21
20
  const response = await (0, personalAccessKey_1.getAccessToken)(personalAccessKey, env, derivedAccountId);
22
21
  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('');
45
22
  logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.name`, { name: name }));
46
23
  logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.accountId`, {
47
24
  accountId: derivedAccountId,
@@ -7,7 +7,6 @@ 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");
11
10
  const table_1 = require("../../lib/ui/table");
12
11
  const usageTracking_1 = require("../../lib/usageTracking");
13
12
  const accountTypes_1 = require("../../lib/accountTypes");
@@ -81,28 +80,13 @@ async function handler(args) {
81
80
  (0, lang_1.i18n)('commands.account.subcommands.list.labels.accountId'),
82
81
  (0, lang_1.i18n)('commands.account.subcommands.list.labels.authType'),
83
82
  ]));
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`));
83
+ logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.list.configPath', {
84
+ configPath: configPath,
85
+ }));
86
+ logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.list.defaultAccount', {
87
+ account: (0, config_1.getConfigDefaultAccount)(),
88
+ }));
89
+ logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.list.accounts'));
106
90
  logger_1.logger.log((0, table_1.getTableContents)(accountData, { border: { bodyLeft: ' ' } }));
107
91
  }
108
92
  function builder(yargs) {
@@ -1,18 +1,12 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.describe = exports.command = void 0;
7
4
  exports.handler = handler;
8
5
  exports.builder = builder;
9
- const fs_1 = __importDefault(require("fs"));
10
6
  const logger_1 = require("@hubspot/local-dev-lib/logger");
11
7
  const config_1 = require("@hubspot/local-dev-lib/config");
12
8
  const usageTracking_1 = require("../../lib/usageTracking");
13
9
  const lang_1 = require("../../lib/lang");
14
- const promptUtils_1 = require("../../lib/prompts/promptUtils");
15
- const errorHandlers_1 = require("../../lib/errorHandlers");
16
10
  const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
17
11
  const commonOpts_1 = require("../../lib/commonOpts");
18
12
  exports.command = 'remove [account]';
@@ -31,28 +25,6 @@ async function handler(args) {
31
25
  }
32
26
  (0, usageTracking_1.trackCommandUsage)('accounts-remove', undefined, (0, config_1.getAccountId)(accountToRemove));
33
27
  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
- }
56
28
  await (0, config_1.deleteAccount)(accountToRemove);
57
29
  logger_1.logger.success((0, lang_1.i18n)(`commands.account.subcommands.remove.success.accountRemoved`, {
58
30
  accountName: accountToRemove,
@@ -8,7 +8,6 @@ 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");
12
11
  exports.command = 'use [account]';
13
12
  exports.describe = (0, lang_1.i18n)('commands.account.subcommands.use.describe');
14
13
  async function handler(args) {
@@ -24,18 +23,6 @@ async function handler(args) {
24
23
  newDefaultAccount = await (0, accountsPrompt_1.selectAccountFromConfig)();
25
24
  }
26
25
  (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
- }
39
26
  (0, config_1.updateDefaultAccount)(newDefaultAccount);
40
27
  return logger_1.logger.success((0, lang_1.i18n)('commands.account.subcommands.use.success.defaultAccountUpdated', {
41
28
  accountName: newDefaultAccount,
@@ -37,29 +37,24 @@ 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"));
41
40
  const list = __importStar(require("./account/list"));
42
41
  const rename = __importStar(require("./account/rename"));
43
42
  const use = __importStar(require("./account/use"));
44
43
  const info = __importStar(require("./account/info"));
45
44
  const remove = __importStar(require("./account/remove"));
46
45
  const clean = __importStar(require("./account/clean"));
47
- const createOverride = __importStar(require("./account/createOverride"));
48
- const removeOverride = __importStar(require("./account/removeOverride"));
46
+ const i18nKey = 'commands.account';
49
47
  exports.command = ['account', 'accounts'];
50
- exports.describe = (0, lang_1.i18n)('commands.account.describe');
48
+ exports.describe = (0, lang_1.i18n)(`${i18nKey}.describe`);
51
49
  function builder(yargs) {
52
50
  (0, commonOpts_1.addGlobalOptions)(yargs);
53
51
  yargs
54
- .command(auth)
55
52
  .command(list)
56
53
  .command(rename)
57
54
  .command(use)
58
55
  .command(info)
59
56
  .command(remove)
60
57
  .command(clean)
61
- .command(createOverride)
62
- .command(removeOverride)
63
58
  .demandCommand(1, '');
64
59
  return yargs;
65
60
  }
@@ -1,7 +1,7 @@
1
1
  import { ArgumentsCamelCase, Argv, CommandModule } from 'yargs';
2
- import { MigrateAppArgs } from '../../lib/app/migrate';
2
+ import { MigrateAppOptions } from '../../types/Yargs';
3
3
  export declare const validMigrationTargets: string[];
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>;
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>;
7
7
  export default migrateCommand;
package/commands/auth.js CHANGED
@@ -47,12 +47,8 @@ async function handler(args) {
47
47
  if (configPath) {
48
48
  (0, git_1.checkAndWarnGitInclusion)(configPath);
49
49
  }
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
- }));
50
+ if (!(0, config_2.getConfigPath)(configFlagValue)) {
51
+ logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.noConfigFileFound`));
56
52
  process.exit(exitCodes_1.EXIT_CODES.ERROR);
57
53
  }
58
54
  (0, usageTracking_1.trackCommandUsage)('auth');
@@ -1,11 +1 @@
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>;
11
1
  export {};
@@ -1,21 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handler = handler;
4
- exports.builder = builder;
5
- const lang_1 = require("../../lib/lang");
6
- const usageTracking_1 = require("../../lib/usageTracking");
7
- const promptUtils_1 = require("../../lib/prompts/promptUtils");
8
- const exitCodes_1 = require("../../lib/enums/exitCodes");
9
- const configOptions_1 = require("../../lib/configOptions");
3
+ // @ts-nocheck
4
+ const { i18n } = require('../../lib/lang');
5
+ const { trackCommandUsage } = require('../../lib/usageTracking');
6
+ const { promptUser } = require('../../lib/prompts/promptUtils');
7
+ const { EXIT_CODES } = require('../../lib/enums/exitCodes');
8
+ const { setDefaultCmsPublishMode, setHttpTimeout, setAllowUsageTracking, } = require('../../lib/configOptions');
10
9
  exports.command = 'set';
11
- exports.describe = (0, lang_1.i18n)(`commands.config.subcommands.set.describe`);
12
- async function selectOptions() {
13
- const { cmsPublishMode } = await (0, promptUtils_1.promptUser)([
10
+ exports.describe = i18n(`commands.config.subcommands.set.describe`);
11
+ const selectOptions = async () => {
12
+ const { cmsPublishMode } = await promptUser([
14
13
  {
15
14
  type: 'list',
15
+ look: false,
16
16
  name: 'cmsPublishMode',
17
17
  pageSize: 20,
18
- message: (0, lang_1.i18n)(`commands.config.subcommands.set.promptMessage`),
18
+ message: i18n(`commands.config.subcommands.set.promptMessage`),
19
19
  choices: [
20
20
  {
21
21
  name: 'Default CMS publish mode',
@@ -27,46 +27,46 @@ async function selectOptions() {
27
27
  },
28
28
  ]);
29
29
  return cmsPublishMode;
30
- }
31
- async function handleConfigUpdate(accountId, options) {
30
+ };
31
+ const handleConfigUpdate = async (accountId, options) => {
32
32
  const { allowUsageTracking, defaultCmsPublishMode, httpTimeout } = options;
33
33
  if (typeof defaultCmsPublishMode !== 'undefined') {
34
- await (0, configOptions_1.setDefaultCmsPublishMode)({ defaultCmsPublishMode, accountId });
34
+ await setDefaultCmsPublishMode({ defaultCmsPublishMode, accountId });
35
35
  return true;
36
36
  }
37
37
  else if (typeof httpTimeout !== 'undefined') {
38
- await (0, configOptions_1.setHttpTimeout)({ httpTimeout, accountId });
38
+ await setHttpTimeout({ httpTimeout, accountId });
39
39
  return true;
40
40
  }
41
41
  else if (typeof allowUsageTracking !== 'undefined') {
42
- await (0, configOptions_1.setAllowUsageTracking)({ allowUsageTracking, accountId });
42
+ await setAllowUsageTracking({ allowUsageTracking, accountId });
43
43
  return true;
44
44
  }
45
45
  return false;
46
- }
47
- async function handler(args) {
48
- const { derivedAccountId } = args;
49
- (0, usageTracking_1.trackCommandUsage)('config-set', {}, derivedAccountId);
50
- const configUpdated = await handleConfigUpdate(derivedAccountId, args);
46
+ };
47
+ exports.handler = async (options) => {
48
+ const { derivedAccountId } = options;
49
+ trackCommandUsage('config-set', null, derivedAccountId);
50
+ const configUpdated = await handleConfigUpdate(derivedAccountId, options);
51
51
  if (!configUpdated) {
52
52
  const selectedOptions = await selectOptions();
53
53
  await handleConfigUpdate(derivedAccountId, selectedOptions);
54
54
  }
55
- process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
56
- }
57
- function builder(yargs) {
55
+ process.exit(EXIT_CODES.SUCCESS);
56
+ };
57
+ exports.builder = yargs => {
58
58
  yargs
59
59
  .options({
60
60
  'default-cms-publish-mode': {
61
- describe: (0, lang_1.i18n)(`commands.config.subcommands.set.options.defaultMode.describe`),
61
+ describe: i18n(`commands.config.subcommands.set.options.defaultMode.describe`),
62
62
  type: 'string',
63
63
  },
64
64
  'allow-usage-tracking': {
65
- describe: (0, lang_1.i18n)(`commands.config.subcommands.set.options.allowUsageTracking.describe`),
65
+ describe: i18n(`commands.config.subcommands.set.options.allowUsageTracking.describe`),
66
66
  type: 'boolean',
67
67
  },
68
68
  'http-timeout': {
69
- describe: (0, lang_1.i18n)(`commands.config.subcommands.set.options.httpTimeout.describe`),
69
+ describe: i18n(`commands.config.subcommands.set.options.httpTimeout.describe`),
70
70
  type: 'string',
71
71
  },
72
72
  })
@@ -76,8 +76,8 @@ function builder(yargs) {
76
76
  .example([
77
77
  [
78
78
  '$0 config set',
79
- (0, lang_1.i18n)(`commands.config.subcommands.set.examples.default`),
79
+ i18n(`commands.config.subcommands.set.examples.default`),
80
80
  ],
81
81
  ]);
82
82
  return yargs;
83
- }
83
+ };
@@ -1,4 +1 @@
1
- import { Argv } from 'yargs';
2
- export declare const command = "config";
3
- export declare const describe: string;
4
- export declare function builder(yargs: Argv): Argv;
1
+ export {};
@@ -1,49 +1,15 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.describe = exports.command = void 0;
37
- exports.builder = builder;
38
- const commonOpts_1 = require("../lib/commonOpts");
39
- const lang_1 = require("../lib/lang");
40
- const set = __importStar(require("./config/set"));
41
- const migrate = __importStar(require("./config/migrate"));
3
+ // @ts-nocheck
4
+ const { addConfigOptions, addGlobalOptions } = require('../lib/commonOpts');
5
+ const { i18n } = require('../lib/lang');
6
+ const set = require('./config/set');
7
+ const i18nKey = 'commands.config';
42
8
  exports.command = 'config';
43
- exports.describe = (0, lang_1.i18n)('commands.config.describe');
44
- function builder(yargs) {
45
- (0, commonOpts_1.addConfigOptions)(yargs);
46
- (0, commonOpts_1.addGlobalOptions)(yargs);
47
- yargs.command(set).command(migrate).demandCommand(1, '');
9
+ exports.describe = i18n(`${i18nKey}.describe`);
10
+ exports.builder = yargs => {
11
+ addConfigOptions(yargs);
12
+ addGlobalOptions(yargs);
13
+ yargs.command(set).demandCommand(1, '');
48
14
  return yargs;
49
- }
15
+ };
package/commands/init.js CHANGED
@@ -78,13 +78,6 @@ async function handler(args) {
78
78
  });
79
79
  }
80
80
  const env = args.qa ? environments_1.ENVIRONMENTS.QA : environments_1.ENVIRONMENTS.PROD;
81
- if ((0, config_1.configFileExists)(true)) {
82
- const globalConfigPath = (0, config_1.getConfigPath)('', true);
83
- logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.globalConfigFileExists`, {
84
- configPath: globalConfigPath,
85
- }));
86
- process.exit(exitCodes_1.EXIT_CODES.ERROR);
87
- }
88
81
  if (fs_extra_1.default.existsSync(configPath)) {
89
82
  logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.configFileExists`, {
90
83
  configPath: configPath,
@@ -121,16 +114,19 @@ async function handler(args) {
121
114
  accountId = oauthResult.accountId;
122
115
  name = oauthResult.name;
123
116
  }
124
- const configPath = (0, config_1.getConfigPath)();
125
117
  try {
126
118
  (0, gitignore_1.checkAndAddConfigToGitignore)(configPath);
127
119
  }
128
120
  catch (e) {
129
121
  (0, index_1.debugError)(e);
130
122
  }
123
+ let newConfigPath = configPath;
124
+ if (!newConfigPath && !useHiddenConfig) {
125
+ newConfigPath = `${(0, path_2.getCwd)()}/${config_2.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME}`;
126
+ }
131
127
  logger_1.logger.log('');
132
128
  logger_1.logger.success((0, lang_1.i18n)(`${i18nKey}.success.configFileCreated`, {
133
- configPath: configPath,
129
+ configPath: newConfigPath,
134
130
  }));
135
131
  logger_1.logger.success((0, lang_1.i18n)(`${i18nKey}.success.configFileUpdated`, {
136
132
  authType: AUTH_TYPE_NAMES[authType],
@@ -171,6 +167,11 @@ function initBuilder(yargs) {
171
167
  hidden: true,
172
168
  default: false,
173
169
  },
170
+ 'use-hidden-config': {
171
+ describe: (0, lang_1.i18n)(`${i18nKey}.options.useHiddenConfig.describe`),
172
+ hidden: true,
173
+ type: 'boolean',
174
+ },
174
175
  });
175
176
  yargs.conflicts('use-hidden-config', 'config');
176
177
  return yargs;
@@ -1,12 +1,8 @@
1
1
  import { ArgumentsCamelCase, Argv, CommandModule } from 'yargs';
2
- import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs } from '../../types/Yargs';
2
+ import { CloneAppArgs } from '../../types/Yargs';
3
3
  export declare const command = "clone-app";
4
4
  export declare const describe: string | undefined;
5
5
  export declare const deprecated = true;
6
- export type CloneAppArgs = ConfigArgs & EnvironmentArgs & AccountArgs & CommonArgs & {
7
- dest: string;
8
- appId: number;
9
- };
10
6
  export declare const handler: (options: ArgumentsCamelCase<CloneAppArgs>) => Promise<never>;
11
7
  export declare const builder: (yargs: Argv) => Argv<CloneAppArgs>;
12
8
  declare const cloneAppCommand: CommandModule<unknown, CloneAppArgs>;
@@ -39,7 +39,7 @@ const handler = async (options) => {
39
39
  throw new Error((0, lang_1.i18n)(`commands.projects.subcommands.cloneApp.errors.noAccountConfig`));
40
40
  }
41
41
  if (!(0, accountTypes_1.isAppDeveloperAccount)(accountConfig)) {
42
- (0, migrate_1.logInvalidAccountError)();
42
+ (0, migrate_1.logInvalidAccountError)(i18nKey);
43
43
  process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
44
44
  }
45
45
  let appId;