@hubspot/cli 7.4.8 → 7.4.9-beta.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 (206) hide show
  1. package/commands/account/auth.d.ts +3 -7
  2. package/commands/account/auth.js +19 -9
  3. package/commands/account/clean.d.ts +3 -7
  4. package/commands/account/clean.js +16 -9
  5. package/commands/account/createOverride.d.ts +3 -7
  6. package/commands/account/createOverride.js +23 -6
  7. package/commands/account/info.d.ts +3 -7
  8. package/commands/account/info.js +13 -5
  9. package/commands/account/list.d.ts +3 -7
  10. package/commands/account/list.js +15 -8
  11. package/commands/account/remove.d.ts +3 -7
  12. package/commands/account/remove.js +21 -9
  13. package/commands/account/removeOverride.d.ts +3 -7
  14. package/commands/account/removeOverride.js +23 -6
  15. package/commands/account/rename.d.ts +3 -7
  16. package/commands/account/rename.js +16 -9
  17. package/commands/account/use.d.ts +5 -9
  18. package/commands/account/use.js +14 -6
  19. package/commands/account.d.ts +3 -4
  20. package/commands/account.js +35 -58
  21. package/commands/cms/convertFields.d.ts +7 -1
  22. package/commands/cms/convertFields.js +57 -41
  23. package/commands/cms/getReactModule.d.ts +7 -1
  24. package/commands/cms/getReactModule.js +52 -34
  25. package/commands/cms/lighthouseScore.d.ts +8 -1
  26. package/commands/cms/lighthouseScore.js +129 -100
  27. package/commands/cms.d.ts +3 -1
  28. package/commands/cms.js +24 -15
  29. package/commands/completion.d.ts +3 -1
  30. package/commands/completion.js +25 -12
  31. package/commands/config/migrate.d.ts +1 -1
  32. package/commands/config/migrate.js +16 -12
  33. package/commands/create/api-sample.d.ts +3 -1
  34. package/commands/create/api-sample.js +34 -38
  35. package/commands/create/app.d.ts +3 -1
  36. package/commands/create/app.js +9 -7
  37. package/commands/create/function.d.ts +3 -1
  38. package/commands/create/function.js +11 -10
  39. package/commands/create/index.d.ts +5 -1
  40. package/commands/create/index.js +23 -11
  41. package/commands/create/module.d.ts +3 -1
  42. package/commands/create/module.js +14 -13
  43. package/commands/create/react-app.d.ts +3 -1
  44. package/commands/create/react-app.js +10 -7
  45. package/commands/create/template.d.ts +3 -1
  46. package/commands/create/template.js +14 -14
  47. package/commands/create/vue-app.d.ts +3 -1
  48. package/commands/create/vue-app.js +10 -7
  49. package/commands/create/webpack-serverless.d.ts +3 -1
  50. package/commands/create/webpack-serverless.js +10 -7
  51. package/commands/create/website-theme.d.ts +3 -1
  52. package/commands/create/website-theme.js +10 -9
  53. package/commands/create.d.ts +4 -24
  54. package/commands/create.js +63 -74
  55. package/commands/customObject/create.d.ts +4 -9
  56. package/commands/customObject/create.js +17 -10
  57. package/commands/customObject/schema/create.d.ts +4 -9
  58. package/commands/customObject/schema/create.js +18 -11
  59. package/commands/customObject/schema/delete.d.ts +4 -9
  60. package/commands/customObject/schema/delete.js +17 -10
  61. package/commands/customObject/schema/fetch-all.d.ts +4 -9
  62. package/commands/customObject/schema/fetch-all.js +17 -10
  63. package/commands/customObject/schema/fetch.d.ts +4 -9
  64. package/commands/customObject/schema/fetch.js +17 -10
  65. package/commands/customObject/schema/list.d.ts +4 -8
  66. package/commands/customObject/schema/list.js +17 -10
  67. package/commands/customObject/schema/update.d.ts +4 -9
  68. package/commands/customObject/schema/update.js +18 -11
  69. package/commands/customObject/schema.d.ts +3 -5
  70. package/commands/customObject/schema.js +27 -54
  71. package/commands/customObject.d.ts +3 -4
  72. package/commands/customObject.js +20 -45
  73. package/commands/feedback.d.ts +4 -1
  74. package/commands/feedback.js +40 -47
  75. package/commands/fetch.d.ts +12 -1
  76. package/commands/fetch.js +49 -33
  77. package/commands/filemanager/fetch.d.ts +4 -9
  78. package/commands/filemanager/fetch.js +18 -11
  79. package/commands/filemanager/upload.d.ts +4 -9
  80. package/commands/filemanager/upload.js +17 -11
  81. package/commands/filemanager.d.ts +3 -4
  82. package/commands/filemanager.js +20 -41
  83. package/commands/function/deploy.d.ts +6 -1
  84. package/commands/function/deploy.js +70 -50
  85. package/commands/function/list.d.ts +6 -1
  86. package/commands/function/list.js +44 -32
  87. package/commands/function/server.d.ts +10 -1
  88. package/commands/function/server.js +49 -38
  89. package/commands/function.d.ts +5 -1
  90. package/commands/function.js +24 -10
  91. package/commands/hubdb/clear.d.ts +4 -9
  92. package/commands/hubdb/clear.js +17 -10
  93. package/commands/hubdb/create.d.ts +4 -9
  94. package/commands/hubdb/create.js +17 -10
  95. package/commands/hubdb/delete.d.ts +4 -9
  96. package/commands/hubdb/delete.js +17 -10
  97. package/commands/hubdb/fetch.d.ts +4 -9
  98. package/commands/hubdb/fetch.js +17 -10
  99. package/commands/hubdb.d.ts +3 -2
  100. package/commands/hubdb.js +23 -45
  101. package/commands/lint.d.ts +6 -4
  102. package/commands/lint.js +44 -43
  103. package/commands/logs.d.ts +10 -1
  104. package/commands/logs.js +53 -44
  105. package/commands/module/marketplace-validate.d.ts +6 -1
  106. package/commands/module/marketplace-validate.js +39 -27
  107. package/commands/module.d.ts +3 -1
  108. package/commands/module.js +22 -10
  109. package/commands/project/cloneApp.d.ts +1 -1
  110. package/commands/project/create.js +3 -3
  111. package/commands/project/deploy.d.ts +1 -0
  112. package/commands/project/deploy.js +40 -12
  113. package/commands/project/dev/index.d.ts +1 -4
  114. package/commands/project/dev/index.js +44 -15
  115. package/commands/project/dev/unifiedFlow.d.ts +2 -1
  116. package/commands/project/dev/unifiedFlow.js +52 -20
  117. package/commands/project/migrate.d.ts +1 -0
  118. package/commands/project/profile/add.d.ts +7 -0
  119. package/commands/project/profile/add.js +190 -0
  120. package/commands/project/profile/remove.d.ts +6 -0
  121. package/commands/project/profile/remove.js +119 -0
  122. package/commands/project/profile.d.ts +3 -0
  123. package/commands/project/profile.js +25 -0
  124. package/commands/project/upload.d.ts +1 -0
  125. package/commands/project/upload.js +38 -8
  126. package/commands/project.js +2 -0
  127. package/commands/sandbox/create.d.ts +4 -9
  128. package/commands/sandbox/create.js +18 -11
  129. package/commands/sandbox/delete.d.ts +4 -9
  130. package/commands/sandbox/delete.js +18 -11
  131. package/commands/sandbox.d.ts +3 -4
  132. package/commands/sandbox.js +20 -43
  133. package/commands/secret/addSecret.d.ts +4 -9
  134. package/commands/secret/addSecret.js +17 -10
  135. package/commands/secret/deleteSecret.d.ts +4 -9
  136. package/commands/secret/deleteSecret.js +17 -10
  137. package/commands/secret/listSecret.d.ts +4 -9
  138. package/commands/secret/listSecret.js +17 -10
  139. package/commands/secret/updateSecret.d.ts +4 -9
  140. package/commands/secret/updateSecret.js +17 -10
  141. package/commands/secret.d.ts +3 -4
  142. package/commands/secret.js +25 -48
  143. package/commands/theme/generate-selectors.d.ts +3 -7
  144. package/commands/theme/generate-selectors.js +14 -6
  145. package/commands/theme/marketplace-validate.d.ts +4 -9
  146. package/commands/theme/marketplace-validate.js +17 -10
  147. package/commands/theme/preview.d.ts +4 -9
  148. package/commands/theme/preview.js +16 -9
  149. package/commands/theme.d.ts +3 -4
  150. package/commands/theme.js +23 -46
  151. package/commands/upload.d.ts +12 -1
  152. package/commands/upload.js +118 -97
  153. package/commands/watch.d.ts +14 -1
  154. package/commands/watch.js +76 -65
  155. package/lang/en.d.ts +654 -558
  156. package/lang/en.js +443 -353
  157. package/lang/en.lyaml +23 -13
  158. package/lib/app/migrate.d.ts +23 -0
  159. package/lib/app/migrate.js +14 -3
  160. package/lib/app/migrate_legacy.js +5 -5
  161. package/lib/configMigrate.js +24 -10
  162. package/lib/constants.d.ts +6 -0
  163. package/lib/constants.js +7 -1
  164. package/lib/errorHandlers/suppressError.js +12 -19
  165. package/lib/filesystem.d.ts +1 -1
  166. package/lib/interpolation.d.ts +2 -3
  167. package/lib/lang.d.ts +2 -3
  168. package/lib/middleware/configMiddleware.js +8 -0
  169. package/lib/projectProfiles.d.ts +6 -0
  170. package/lib/projectProfiles.js +65 -0
  171. package/lib/projects/buildAndDeploy.js +17 -2
  172. package/lib/projects/localDev/AppDevModeInterface.d.ts +25 -0
  173. package/lib/projects/localDev/AppDevModeInterface.js +117 -0
  174. package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
  175. package/lib/projects/localDev/DevServerManagerV2.js +19 -15
  176. package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
  177. package/lib/projects/localDev/LocalDevLogger.js +158 -0
  178. package/lib/projects/localDev/LocalDevManager.js +2 -3
  179. package/lib/projects/localDev/LocalDevProcess.d.ts +27 -0
  180. package/lib/projects/localDev/LocalDevProcess.js +171 -0
  181. package/lib/projects/localDev/LocalDevState.d.ts +37 -0
  182. package/lib/projects/localDev/LocalDevState.js +78 -0
  183. package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
  184. package/lib/projects/localDev/LocalDevWatcher.js +56 -0
  185. package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +17 -0
  186. package/lib/projects/localDev/LocalDevWebsocketServer.js +92 -0
  187. package/lib/projects/localDev/helpers.d.ts +1 -1
  188. package/lib/projects/localDev/helpers.js +2 -1
  189. package/lib/projects/upload.d.ts +2 -1
  190. package/lib/projects/upload.js +2 -2
  191. package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
  192. package/lib/prompts/createTemplatePrompt.d.ts +22 -4
  193. package/lib/testUtils.d.ts +3 -3
  194. package/lib/testUtils.js +8 -9
  195. package/lib/upload.d.ts +1 -1
  196. package/lib/validation.js +4 -5
  197. package/lib/yargsUtils.d.ts +4 -0
  198. package/lib/yargsUtils.js +6 -0
  199. package/package.json +5 -3
  200. package/types/Cms.d.ts +30 -0
  201. package/types/Cms.js +2 -0
  202. package/types/LocalDev.d.ts +24 -0
  203. package/types/LocalDev.js +2 -0
  204. package/types/Yargs.d.ts +8 -1
  205. package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
  206. package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
package/lang/en.lyaml CHANGED
@@ -22,6 +22,7 @@ en:
22
22
  subcommands:
23
23
  auth:
24
24
  describe: "Configure authentication for your HubSpot account."
25
+ verboseDescribe: "Configure authentication for a HubSpot account. This will create or update the global config file at {{ globalConfigPath }} 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.\nIf a deprecated config file exists, you will be prompted to migrate it to the new global config file. If both deprecated and global config files exist, you will be prompted to merge them. If any conflicts exist between the two files, you will be prompted to reconcile them."
25
26
  options:
26
27
  account:
27
28
  describe: "HubSpot account to authenticate"
@@ -39,6 +40,7 @@ en:
39
40
  prompts:
40
41
  replaceOverrideFile: "Replace existing account override file?"
41
42
  errors:
43
+ globalConfigNotFound: "This command is only compatible with our new global config. Run {{ authCommand }} to get started."
42
44
  accountNotFound: "The specified account could not be found in the config file {{ configPath }}"
43
45
  options:
44
46
  account:
@@ -54,6 +56,8 @@ en:
54
56
  deleteOverrideFile: "Delete account override file?"
55
57
  success: "Removed the default account override file."
56
58
  noOverrideFile: "No default account override file found in the current working directory. No action required."
59
+ errors:
60
+ globalConfigNotFound: "This command is only compatible with our new global config. Run {{ authCommand }} to get started."
57
61
  options:
58
62
  force:
59
63
  describe: "Skip confirmation prompt when removing the override file"
@@ -165,6 +169,7 @@ en:
165
169
  subcommands:
166
170
  migrate:
167
171
  describe: "Migrate from the deprecated {{ deprecatedConfigPath }} file to the new global config file at {{ globalConfigPath }}."
172
+ verboseDescribe: "This command will create a new global configuration file in your root directory and rename the deprecated config to {{ archivedConfigPath }}. If any conflicting values are detected, we will prompt you to reconcile them unless the \"--force\" flag is supplied."
168
173
  migrationAlreadyCompleted: "No {{ deprecatedConfigPath }} deprecated configuration file found. No migration necessary."
169
174
  errors:
170
175
  configNotFound: "A configuration file at {{ configPath }} could not be found. Please try again with a valid file path."
@@ -597,6 +602,9 @@ en:
597
602
  invalidUnifiedAppsAccount: "Local development of Unified Apps is currently only supported in standard and developer accounts. Target a standard or developer account with {{ authCommand }} and try again."
598
603
  examples:
599
604
  default: "Start local dev for the current project"
605
+ options:
606
+ profile:
607
+ describe: "The profile to target during local dev"
600
608
  create:
601
609
  describe: "Create a new project."
602
610
  errors:
@@ -715,6 +723,8 @@ en:
715
723
  describe: "Project build ID to be deployed"
716
724
  project:
717
725
  describe: "Project name"
726
+ profile:
727
+ describe: "The profile to target with this deploy"
718
728
  listBuilds:
719
729
  describe: "List the project's builds."
720
730
  continueOrExitPrompt: "Press <enter> to load more, or ctrl+c to exit"
@@ -782,6 +792,8 @@ en:
782
792
  describe: "Automatically create project if it does not exist"
783
793
  message:
784
794
  describe: "Add a message when you upload your project and create a build"
795
+ profile:
796
+ describe: "The profile to target with this upload"
785
797
  watch:
786
798
  describe: "Watch your local project for changes and automatically upload changed files to a new build in HubSpot."
787
799
  examples:
@@ -841,18 +853,10 @@ en:
841
853
  default: "Opens the projects page for the specified account"
842
854
  success: "Successfully opened \"{{ projectName }}\""
843
855
  feedback:
844
- describe: "Leave feedback on HubSpot projects or file a bug report."
845
- feedbackType:
846
- prompt: "What type of feedback would you like to leave?"
847
- bug: "[--bug] Report a bug"
848
- general: "[--general] Tell us about your experience with HubSpot's developer tools"
849
- openPrompt: "Create a Github issue in your browser?"
856
+ describe: "Leave feedback or file a bug report."
857
+ openPrompt: "Open the feedback form in your browser?"
850
858
  success: "We opened {{ url }} in your browser."
851
- options:
852
- bug:
853
- describe: "Open Github issues in your browser to report a bug."
854
- general:
855
- describe: "Open Github issues in your browser to give feedback."
859
+ error: "Navigate to {{ url }} to leave feedback."
856
860
  installDeps:
857
861
  help:
858
862
  describe: "Install the dependencies for your project, or add a dependency to a subcomponent of a project."
@@ -1329,9 +1333,15 @@ en:
1329
1333
  debug:
1330
1334
  describe: "Set log level to debug"
1331
1335
  configMigrate:
1332
- 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"
1336
+ migrationHeader: "Migrate your existing configuration file to the new global location?"
1337
+ migrationDescription: "This action will create a new global configuration file in your root directory and rename the deprecated config to {{ archivedConfigPath}}. If any conflicting values are detected, we will prompt you to reconcile them unless the \"--force\" flag is supplied."
1338
+ mergeHeader: "Merge your existing configuration file with the global config?"
1339
+ mergeDescription: "This action will merge your deprecated config file with the global config file located in your root directory. It will also rename the deprecated config to {{ archivedConfigPath }}. If any conflicting values are detected, we will prompt you to reconcile them unless the \"--force\" flag is supplied."
1340
+ migrateConfigPromptDescription: "From deprecated config file: {{ deprecatedConfigPath }}\nTo new global config file: {{ globalConfigPath }}"
1341
+ migrateConfigPrompt: "Migrate to the new config?"
1333
1342
  mergeConfigConflictPrompt: "Change the {{ property }} property in the global config from {{ newValue }} to {{ oldValue }}?"
1334
- 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"
1343
+ mergeConfigsPromptDescription: "Two config files detected. \nDeprecated config file: {{ deprecatedConfigPath }}\nGlobal config: {{ globalConfigPath }}"
1344
+ mergeConfigsPrompt: "Merge configs?"
1335
1345
  migrationSuccess: "The deprecated config file has been migrated to the new global config file at {{ globalConfigPath }}."
1336
1346
  mergeSuccess: "The deprecated config file has been merged with the global config file at {{ globalConfigPath }}."
1337
1347
  skippedExistingAccounts: "\nThe following accounts were not merged, because they already exist in the global config: {{ skippedAccountIds }}.\n"
@@ -1,11 +1,34 @@
1
1
  import { ArgumentsCamelCase } from 'yargs';
2
2
  import { LoadedProjectConfig } from '../projects/config';
3
+ import { MigrationApp, MigrationFailed, MigrationStatus } from '../../api/migrate';
3
4
  import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs } from '../../types/Yargs';
4
5
  export type MigrateAppArgs = CommonArgs & AccountArgs & EnvironmentArgs & ConfigArgs & {
5
6
  name?: string;
6
7
  dest?: string;
7
8
  appId?: number;
8
9
  platformVersion: string;
10
+ unstable: boolean;
9
11
  };
12
+ export declare function getUnmigratableReason(reasonCode: string, projectName: string | undefined, accountId: number): string;
13
+ export declare function generateFilterAppsByProjectNameFunction(projectConfig?: LoadedProjectConfig): (app: MigrationApp) => boolean;
14
+ export declare function buildErrorMessageFromMigrationStatus(error: MigrationFailed): string;
15
+ export declare function fetchMigrationApps(appId: MigrateAppArgs['appId'], derivedAccountId: number, platformVersion: string, projectConfig?: LoadedProjectConfig): Promise<MigrationApp[]>;
16
+ export declare function promptForAppToMigrate(allApps: MigrationApp[], derivedAccountId: number): Promise<number>;
17
+ export declare function selectAppToMigrate(allApps: MigrationApp[], derivedAccountId: number, appId?: number): Promise<{
18
+ proceed: boolean;
19
+ appIdToMigrate?: number;
20
+ }>;
21
+ export declare function handleMigrationSetup(derivedAccountId: number, options: ArgumentsCamelCase<MigrateAppArgs>, projectConfig?: LoadedProjectConfig): Promise<{
22
+ appIdToMigrate?: number | undefined;
23
+ projectName?: string;
24
+ projectDest?: string;
25
+ }>;
26
+ export declare function beginMigration(derivedAccountId: number, appId: number, platformVersion: string): Promise<{
27
+ migrationId: number;
28
+ uidMap: Record<string, string>;
29
+ } | undefined>;
30
+ export declare function pollMigrationStatus(derivedAccountId: number, migrationId: number, successStates?: string[]): Promise<MigrationStatus>;
31
+ export declare function finalizeMigration(derivedAccountId: number, migrationId: number, uidMap: Record<string, string>, projectName: string): Promise<number>;
32
+ export declare function downloadProjectFiles(derivedAccountId: number, projectName: string, buildId: number, projectDest: string, projectConfig?: LoadedProjectConfig): Promise<void>;
10
33
  export declare function migrateApp2025_2(derivedAccountId: number, options: ArgumentsCamelCase<MigrateAppArgs>, projectConfig?: LoadedProjectConfig): Promise<void>;
11
34
  export declare function logInvalidAccountError(): void;
@@ -3,6 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getUnmigratableReason = getUnmigratableReason;
7
+ exports.generateFilterAppsByProjectNameFunction = generateFilterAppsByProjectNameFunction;
8
+ exports.buildErrorMessageFromMigrationStatus = buildErrorMessageFromMigrationStatus;
9
+ exports.fetchMigrationApps = fetchMigrationApps;
10
+ exports.promptForAppToMigrate = promptForAppToMigrate;
11
+ exports.selectAppToMigrate = selectAppToMigrate;
12
+ exports.handleMigrationSetup = handleMigrationSetup;
13
+ exports.beginMigration = beginMigration;
14
+ exports.pollMigrationStatus = pollMigrationStatus;
15
+ exports.finalizeMigration = finalizeMigration;
16
+ exports.downloadProjectFiles = downloadProjectFiles;
6
17
  exports.migrateApp2025_2 = migrateApp2025_2;
7
18
  exports.logInvalidAccountError = logInvalidAccountError;
8
19
  const path_1 = __importDefault(require("path"));
@@ -43,7 +54,7 @@ function getUnmigratableReason(reasonCode, projectName, accountId) {
43
54
  return en_1.lib.migrate.errors.unmigratableReasons.generic(reasonCode);
44
55
  }
45
56
  }
46
- function filterAppsByProjectName(projectConfig) {
57
+ function generateFilterAppsByProjectNameFunction(projectConfig) {
47
58
  return (app) => {
48
59
  if (projectConfig) {
49
60
  return app.projectName === projectConfig?.projectConfig?.name;
@@ -65,8 +76,8 @@ function buildErrorMessageFromMigrationStatus(error) {
65
76
  }
66
77
  async function fetchMigrationApps(appId, derivedAccountId, platformVersion, projectConfig) {
67
78
  const { data: { migratableApps, unmigratableApps }, } = await (0, migrate_1.listAppsForMigration)(derivedAccountId, platformVersion);
68
- const filteredMigratableApps = migratableApps.filter(filterAppsByProjectName(projectConfig));
69
- const filteredUnmigratableApps = unmigratableApps.filter(filterAppsByProjectName(projectConfig));
79
+ const filteredMigratableApps = migratableApps.filter(generateFilterAppsByProjectNameFunction(projectConfig));
80
+ const filteredUnmigratableApps = unmigratableApps.filter(generateFilterAppsByProjectNameFunction(projectConfig));
70
81
  const allApps = [...filteredMigratableApps, ...filteredUnmigratableApps];
71
82
  if (allApps.length > 1 && projectConfig) {
72
83
  throw new Error(en_1.lib.migrate.errors.project.multipleApps);
@@ -30,7 +30,7 @@ async function migrateApp2023_2(derivedAccountId, options, accountConfig) {
30
30
  const defaultAccountIsUnified = await (0, accountTypes_1.isUnifiedAccount)(accountConfig);
31
31
  if (!(0, accountTypes_1.isAppDeveloperAccount)(accountConfig) && !defaultAccountIsUnified) {
32
32
  (0, migrate_1.logInvalidAccountError)();
33
- process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
33
+ return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
34
34
  }
35
35
  let appId = options.appId;
36
36
  if (!appId) {
@@ -51,12 +51,12 @@ async function migrateApp2023_2(derivedAccountId, options, accountConfig) {
51
51
  logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.errors.invalidApp`, {
52
52
  appId,
53
53
  }));
54
- process.exit(exitCodes_1.EXIT_CODES.ERROR);
54
+ return process.exit(exitCodes_1.EXIT_CODES.ERROR);
55
55
  }
56
56
  }
57
57
  catch (error) {
58
58
  (0, errorHandlers_1.logError)(error, new errorHandlers_1.ApiErrorContext({ accountId: derivedAccountId }));
59
- process.exit(exitCodes_1.EXIT_CODES.ERROR);
59
+ return process.exit(exitCodes_1.EXIT_CODES.ERROR);
60
60
  }
61
61
  const createProjectPromptResponse = await (0, createProjectPrompt_1.createProjectPrompt)(options);
62
62
  const { name: projectName, dest: projectDest } = createProjectPromptResponse;
@@ -86,7 +86,7 @@ async function migrateApp2023_2(derivedAccountId, options, accountConfig) {
86
86
  });
87
87
  process.stdin.resume();
88
88
  if (!shouldCreateApp) {
89
- process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
89
+ return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
90
90
  }
91
91
  try {
92
92
  SpinniesManager_1.default.init();
@@ -97,7 +97,7 @@ async function migrateApp2023_2(derivedAccountId, options, accountConfig) {
97
97
  if ((key.ctrl && key.name === 'c') || key.name === 'q') {
98
98
  SpinniesManager_1.default.remove('migrateApp');
99
99
  logger_1.logger.log((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.migrationInterrupted`));
100
- process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
100
+ return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
101
101
  }
102
102
  });
103
103
  const { data: migrateResponse } = await (0, projects_1.migrateApp)(derivedAccountId, appId, projectName);
@@ -9,14 +9,21 @@ const promptUtils_1 = require("./prompts/promptUtils");
9
9
  const lang_1 = require("./lang");
10
10
  const usageTracking_1 = require("./usageTracking");
11
11
  async function handleMigration(accountId, configPath) {
12
+ logger_1.logger.log((0, lang_1.i18n)('lib.configMigrate.migrationHeader'));
13
+ logger_1.logger.log('');
14
+ logger_1.logger.log((0, lang_1.i18n)('lib.configMigrate.migrationDescription', {
15
+ archivedConfigPath: config_1.ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME,
16
+ }));
17
+ logger_1.logger.log('');
18
+ logger_1.logger.log((0, lang_1.i18n)('lib.configMigrate.migrateConfigPromptDescription', {
19
+ deprecatedConfigPath: (0, migrate_1.getConfigPath)(configPath, false) ||
20
+ config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
21
+ globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
22
+ }));
12
23
  const { shouldMigrateConfig } = await (0, promptUtils_1.promptUser)({
13
24
  name: 'shouldMigrateConfig',
14
25
  type: 'confirm',
15
- message: (0, lang_1.i18n)('lib.configMigrate.migrateConfigPrompt', {
16
- deprecatedConfigPath: (0, migrate_1.getConfigPath)(configPath, false) ||
17
- config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
18
- globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
19
- }),
26
+ message: (0, lang_1.i18n)('lib.configMigrate.migrateConfigPrompt'),
20
27
  });
21
28
  if (!shouldMigrateConfig) {
22
29
  (0, usageTracking_1.trackCommandMetadataUsage)('config-migrate', {
@@ -62,14 +69,21 @@ async function mergeConfigProperties(globalConfig, deprecatedConfig, force) {
62
69
  return initialConfig;
63
70
  }
64
71
  async function handleMerge(accountId, configPath, force) {
72
+ logger_1.logger.log((0, lang_1.i18n)('lib.configMigrate.mergeHeader'));
73
+ logger_1.logger.log('');
74
+ logger_1.logger.log((0, lang_1.i18n)('lib.configMigrate.mergeDescription', {
75
+ archivedConfigPath: config_1.ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME,
76
+ }));
77
+ logger_1.logger.log('');
78
+ logger_1.logger.log((0, lang_1.i18n)('lib.configMigrate.mergeConfigsPromptDescription', {
79
+ deprecatedConfigPath: (0, migrate_1.getConfigPath)(configPath, false) ||
80
+ config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
81
+ globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
82
+ }));
65
83
  const { shouldMergeConfigs } = await (0, promptUtils_1.promptUser)({
66
84
  name: 'shouldMergeConfigs',
67
85
  type: 'confirm',
68
- message: (0, lang_1.i18n)('lib.configMigrate.mergeConfigsPrompt', {
69
- deprecatedConfigPath: (0, migrate_1.getConfigPath)(configPath, false) ||
70
- config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
71
- globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
72
- }),
86
+ message: (0, lang_1.i18n)('lib.configMigrate.mergeConfigsPrompt'),
73
87
  });
74
88
  if (!shouldMergeConfigs) {
75
89
  (0, usageTracking_1.trackCommandMetadataUsage)('config-migrate', {
@@ -78,3 +78,9 @@ export declare const FEATURES: {
78
78
  readonly UNIFIED_THEME_PREVIEW: "cms:react:unifiedThemePreview";
79
79
  readonly UNIFIED_APPS: "Developers:UnifiedApps:PrivateBeta";
80
80
  };
81
+ export declare const LOCAL_DEV_UI_WEBSOCKET_MESSAGE_TYPES: {
82
+ readonly UPLOAD: "upload";
83
+ readonly INSTALL_DEPS: "installDeps";
84
+ readonly APP_INSTALLED: "appInstalled";
85
+ readonly UPDATE_PROJECT_NODES: "updateProjectNodes";
86
+ };
package/lib/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FEATURES = exports.APP_AUTH_TYPES = exports.APP_DISTRIBUTION_TYPES = exports.IR_COMPONENT_TYPES = exports.PLATFORM_VERSION_ERROR_TYPES = exports.PROJECT_COMPONENT_TYPES = exports.PROJECT_TASK_TYPES = exports.PROJECT_ERROR_TYPES = exports.PROJECT_DEPLOY_TEXT = exports.PROJECT_BUILD_TEXT = exports.PROJECT_DEPLOY_STATES = exports.PROJECT_BUILD_STATES = exports.PROJECT_CONFIG_FILE = exports.DEFAULT_POLLING_DELAY = exports.MARKETPLACE_FOLDER = exports.HUBSPOT_FOLDER = exports.FEEDBACK_INTERVAL = exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = void 0;
3
+ exports.LOCAL_DEV_UI_WEBSOCKET_MESSAGE_TYPES = exports.FEATURES = exports.APP_AUTH_TYPES = exports.APP_DISTRIBUTION_TYPES = exports.IR_COMPONENT_TYPES = exports.PLATFORM_VERSION_ERROR_TYPES = exports.PROJECT_COMPONENT_TYPES = exports.PROJECT_TASK_TYPES = exports.PROJECT_ERROR_TYPES = exports.PROJECT_DEPLOY_TEXT = exports.PROJECT_BUILD_TEXT = exports.PROJECT_DEPLOY_STATES = exports.PROJECT_BUILD_STATES = exports.PROJECT_CONFIG_FILE = exports.DEFAULT_POLLING_DELAY = exports.MARKETPLACE_FOLDER = exports.HUBSPOT_FOLDER = exports.FEEDBACK_INTERVAL = exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = void 0;
4
4
  exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = 'HubSpot/hubspot-project-components';
5
5
  exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = 'main';
6
6
  exports.FEEDBACK_INTERVAL = 10;
@@ -73,3 +73,9 @@ exports.FEATURES = {
73
73
  UNIFIED_THEME_PREVIEW: 'cms:react:unifiedThemePreview',
74
74
  UNIFIED_APPS: 'Developers:UnifiedApps:PrivateBeta',
75
75
  };
76
+ exports.LOCAL_DEV_UI_WEBSOCKET_MESSAGE_TYPES = {
77
+ UPLOAD: 'upload',
78
+ INSTALL_DEPS: 'installDeps',
79
+ APP_INSTALLED: 'appInstalled',
80
+ UPDATE_PROJECT_NODES: 'updateProjectNodes',
81
+ };
@@ -9,22 +9,15 @@ const ui_1 = require("../ui");
9
9
  function createPlatformVersionError(err, subCategory) {
10
10
  let translationKey = 'unspecifiedPlatformVersion';
11
11
  let platformVersion = 'unspecified platformVersion';
12
- const errorContext = err.data.context;
13
- switch (subCategory) {
14
- case constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED:
15
- translationKey = 'platformVersionRetired';
16
- if (errorContext && errorContext[subCategory]) {
17
- platformVersion = errorContext[subCategory];
18
- }
19
- break;
20
- case constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST:
21
- translationKey = 'nonExistentPlatformVersion';
22
- if (errorContext && errorContext[subCategory]) {
23
- platformVersion = errorContext[subCategory];
24
- }
25
- break;
26
- default:
27
- break;
12
+ const errorContext = err?.data?.context;
13
+ if (subCategory === constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED) {
14
+ platformVersion = errorContext?.RETIRED_PLATFORM_VERSION ?? platformVersion;
15
+ translationKey = 'platformVersionRetired';
16
+ }
17
+ else if (subCategory ===
18
+ constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST) {
19
+ platformVersion = errorContext?.PLATFORM_VERSION ?? platformVersion;
20
+ translationKey = 'nonExistentPlatformVersion';
28
21
  }
29
22
  (0, ui_1.uiLine)();
30
23
  logger_1.logger.error((0, lang_1.i18n)(`lib.errorHandlers.suppressErrors.platformVersionErrors.header`));
@@ -51,19 +44,19 @@ function shouldSuppressError(err, context) {
51
44
  if ((0, index_1.isSpecifiedError)(err, {
52
45
  subCategory: constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED,
53
46
  })) {
54
- createPlatformVersionError(err.data, constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED);
47
+ createPlatformVersionError(err, constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED);
55
48
  return true;
56
49
  }
57
50
  if ((0, index_1.isSpecifiedError)(err, {
58
51
  subCategory: constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED,
59
52
  })) {
60
- createPlatformVersionError(err.data, constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED);
53
+ createPlatformVersionError(err, constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED);
61
54
  return true;
62
55
  }
63
56
  if ((0, index_1.isSpecifiedError)(err, {
64
57
  subCategory: constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST,
65
58
  })) {
66
- createPlatformVersionError(err.data, constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST);
59
+ createPlatformVersionError(err, constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST);
67
60
  return true;
68
61
  }
69
62
  return false;
@@ -1,2 +1,2 @@
1
- export declare function resolveLocalPath(filepath: string): string;
1
+ export declare function resolveLocalPath(filepath?: string): string;
2
2
  export declare function isPathFolder(path: string): boolean;
@@ -1,8 +1,7 @@
1
1
  export declare const helpers: {
2
2
  [key: string]: (stringValue: string) => string;
3
3
  };
4
- type InterpolationData = {
5
- [identifier: string]: string | number;
4
+ export type InterpolationData = {
5
+ [identifier: string]: string | undefined | null | number | boolean;
6
6
  };
7
7
  export declare function interpolate(stringValue: string, interpolationData: InterpolationData): string;
8
- export {};
package/lib/lang.d.ts CHANGED
@@ -1,9 +1,8 @@
1
+ import { InterpolationData } from './interpolation';
1
2
  export declare const MISSING_LANGUAGE_DATA_PREFIX = "[Missing language data]";
2
3
  type LanguageObject = {
3
4
  [key: string]: string | LanguageObject;
4
5
  };
5
- export declare function i18n(lookupDotNotation: string, options?: {
6
- [identifier: string]: string | number;
7
- }): string;
6
+ export declare function i18n(lookupDotNotation: string, options?: InterpolationData): string;
8
7
  export declare function setLangData(newLocale: string, newLangObj: LanguageObject): void;
9
8
  export {};
@@ -55,6 +55,7 @@ async function loadConfigMiddleware(argv) {
55
55
  if (!(0, config_1.configFileExists)(true) &&
56
56
  (0, utils_1.isTargetedCommand)(argv._, {
57
57
  account: { target: false, subCommands: { auth: { target: true } } },
58
+ config: { target: false, subCommands: { migrate: { target: true } } },
58
59
  })) {
59
60
  return;
60
61
  }
@@ -94,6 +95,12 @@ const sandboxesSubCommands = {
94
95
  delete: { target: true },
95
96
  },
96
97
  };
98
+ const configSubCommands = {
99
+ target: false,
100
+ subCommands: {
101
+ migrate: { target: true },
102
+ },
103
+ };
97
104
  const SKIP_ACCOUNT_VALIDATION = {
98
105
  init: { target: true },
99
106
  auth: { target: true },
@@ -101,6 +108,7 @@ const SKIP_ACCOUNT_VALIDATION = {
101
108
  accounts: accountsSubCommands,
102
109
  sandbox: sandboxesSubCommands,
103
110
  sandboxes: sandboxesSubCommands,
111
+ config: configSubCommands,
104
112
  };
105
113
  async function validateAccountOptions(argv) {
106
114
  // Skip this when no command is provided
@@ -0,0 +1,6 @@
1
+ import { HsProfileFile } from '@hubspot/project-parsing-lib/src/lib/types';
2
+ import { ProjectConfig } from '../types/Projects';
3
+ export declare function logProfileHeader(profileName: string): void;
4
+ export declare function logProfileFooter(profile: HsProfileFile, includeVariables?: boolean): void;
5
+ export declare function loadProfile(projectConfig: ProjectConfig | null, projectDir: string | null, profileName: string): HsProfileFile | undefined;
6
+ export declare function exitIfUsingProfiles(projectConfig: ProjectConfig | null, projectDir: string | null): Promise<void>;
@@ -0,0 +1,65 @@
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.logProfileHeader = logProfileHeader;
7
+ exports.logProfileFooter = logProfileFooter;
8
+ exports.loadProfile = loadProfile;
9
+ exports.exitIfUsingProfiles = exitIfUsingProfiles;
10
+ const path_1 = __importDefault(require("path"));
11
+ const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
12
+ const en_1 = require("../lang/en");
13
+ const ui_1 = require("./ui");
14
+ const logger_1 = require("./ui/logger");
15
+ const exitCodes_1 = require("./enums/exitCodes");
16
+ function logProfileHeader(profileName) {
17
+ (0, ui_1.uiLine)();
18
+ (0, ui_1.uiBetaTag)(en_1.lib.projectProfiles.logs.usingProfile((0, project_parsing_lib_1.getHsProfileFilename)(profileName)));
19
+ logger_1.uiLogger.log('');
20
+ }
21
+ function logProfileFooter(profile, includeVariables = false) {
22
+ logger_1.uiLogger.log(en_1.lib.projectProfiles.logs.profileTargetAccount(profile.accountId));
23
+ if (includeVariables) {
24
+ logger_1.uiLogger.log('');
25
+ logger_1.uiLogger.log(en_1.lib.projectProfiles.logs.profileVariables);
26
+ Object.entries(profile.variables ?? {}).forEach(([key, value]) => {
27
+ logger_1.uiLogger.log(` ${key}: ${value}`);
28
+ });
29
+ }
30
+ (0, ui_1.uiLine)();
31
+ logger_1.uiLogger.log('');
32
+ }
33
+ function loadProfile(projectConfig, projectDir, profileName) {
34
+ if (!projectConfig || !projectDir) {
35
+ logger_1.uiLogger.error(en_1.lib.projectProfiles.loadProfile.errors.noProjectConfig);
36
+ return;
37
+ }
38
+ const projectSourceDir = path_1.default.join(projectDir, projectConfig.srcDir);
39
+ const profileFilename = (0, project_parsing_lib_1.getHsProfileFilename)(profileName);
40
+ try {
41
+ const profile = (0, project_parsing_lib_1.loadHsProfileFile)(projectSourceDir, profileName);
42
+ if (!profile) {
43
+ logger_1.uiLogger.error(en_1.lib.projectProfiles.loadProfile.errors.profileNotFound(profileFilename));
44
+ return;
45
+ }
46
+ if (!profile.accountId) {
47
+ logger_1.uiLogger.error(en_1.lib.projectProfiles.loadProfile.errors.missingAccountId(profileFilename));
48
+ return;
49
+ }
50
+ return profile;
51
+ }
52
+ catch (e) {
53
+ logger_1.uiLogger.error(en_1.lib.projectProfiles.loadProfile.errors.failedToLoadProfile(profileFilename));
54
+ return;
55
+ }
56
+ }
57
+ async function exitIfUsingProfiles(projectConfig, projectDir) {
58
+ if (projectConfig && projectDir) {
59
+ const existingProfiles = await (0, project_parsing_lib_1.getAllHsProfiles)(path_1.default.join(projectDir, projectConfig.srcDir));
60
+ if (existingProfiles.length > 0) {
61
+ logger_1.uiLogger.error(en_1.lib.projectProfiles.exitIfUsingProfiles.errors.noProfileSpecified);
62
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
63
+ }
64
+ }
65
+ }
@@ -17,6 +17,8 @@ const urls_1 = require("./urls");
17
17
  const exitCodes_1 = require("../enums/exitCodes");
18
18
  const en_1 = require("../../lang/en");
19
19
  const logger_1 = require("../ui/logger");
20
+ const constants_2 = require("@hubspot/project-parsing-lib/src/lib/constants");
21
+ const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
20
22
  const SPINNER_STATUS = {
21
23
  SPINNING: 'spinning',
22
24
  };
@@ -71,14 +73,27 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
71
73
  structureFn(accountId, taskName, taskId),
72
74
  ]);
73
75
  const subtasks = getSubtasks(initialTaskStatus);
74
- const tasksById = subtasks.reduce((acc, subtask) => {
76
+ const hiddenComponentBuildIds = [];
77
+ const tasksById = subtasks
78
+ .filter(subtask => {
79
+ // TODO: Remove this filtering logic when visible=false for SERVERLESS_PACKAGE
80
+ const shouldBeVisible = getSubtaskType(subtask) !== (0, project_parsing_lib_1.mapToInternalType)(constants_2.AppFunctionsPackageKey);
81
+ if (!shouldBeVisible) {
82
+ hiddenComponentBuildIds.push(subtask.id);
83
+ }
84
+ return shouldBeVisible;
85
+ })
86
+ .reduce((acc, subtask) => {
75
87
  const { id, visible } = subtask;
76
88
  if (visible) {
77
89
  acc[id] = subtask;
78
90
  }
79
91
  return acc;
80
92
  }, {});
81
- const structuredTasks = Object.keys(taskStructure).map(key => {
93
+ const structuredTasks = Object.keys(taskStructure)
94
+ // TODO: Remove this filtering logic when visible=false for SERVERLESS_PACKAGE
95
+ .filter(buildId => !hiddenComponentBuildIds.includes(buildId))
96
+ .map(key => {
82
97
  return {
83
98
  ...tasksById[key],
84
99
  subtasks: taskStructure[key]
@@ -0,0 +1,25 @@
1
+ import { PublicApp } from '@hubspot/local-dev-lib/types/Apps';
2
+ import { AppIRNode } from '../../../types/ProjectComponents';
3
+ import LocalDevState from './LocalDevState';
4
+ import LocalDevLogger from './LocalDevLogger';
5
+ type AppDevModeInterfaceConstructorOptions = {
6
+ localDevState: LocalDevState;
7
+ localDevLogger: LocalDevLogger;
8
+ };
9
+ declare class AppDevModeInterface {
10
+ localDevState: LocalDevState;
11
+ localDevLogger: LocalDevLogger;
12
+ _appNode?: AppIRNode | null;
13
+ appData?: PublicApp;
14
+ marketplaceAppInstalls?: number;
15
+ constructor(options: AppDevModeInterfaceConstructorOptions);
16
+ private get appNode();
17
+ private fetchAppData;
18
+ private checkMarketplaceAppInstalls;
19
+ private checkTestAccountAppInstallation;
20
+ setup(args: any): Promise<void>;
21
+ start(): Promise<void>;
22
+ fileChange(filePath: string, event: string): Promise<void>;
23
+ cleanup(): Promise<void>;
24
+ }
25
+ export default AppDevModeInterface;