@hubspot/cli 7.7.35-experimental.0 → 7.8.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. package/bin/cli.js +31 -25
  2. package/commands/__tests__/auth.test.js +5 -0
  3. package/commands/__tests__/doctor.test.js +16 -16
  4. package/commands/__tests__/getStarted.test.js +2 -2
  5. package/commands/__tests__/mcp.test.js +1 -1
  6. package/commands/__tests__/project.test.js +0 -3
  7. package/commands/account/clean.js +18 -27
  8. package/commands/account/createOverride.js +13 -31
  9. package/commands/account/info.js +20 -31
  10. package/commands/account/list.js +16 -22
  11. package/commands/account/remove.js +12 -20
  12. package/commands/account/removeOverride.js +11 -21
  13. package/commands/account/rename.js +6 -9
  14. package/commands/account/use.js +12 -26
  15. package/commands/account.js +2 -2
  16. package/commands/app/__tests__/migrate.test.js +5 -6
  17. package/commands/app/migrate.js +13 -19
  18. package/commands/app/secret/add.js +2 -1
  19. package/commands/app/secret/delete.js +2 -1
  20. package/commands/app/secret/list.js +2 -1
  21. package/commands/app/secret/update.js +2 -1
  22. package/commands/app/secret.js +2 -1
  23. package/commands/app.js +2 -2
  24. package/commands/auth.d.ts +1 -0
  25. package/commands/auth.js +16 -7
  26. package/commands/cms/convertFields.js +7 -9
  27. package/commands/cms/getReactModule.js +9 -14
  28. package/commands/cms/lighthouseScore.js +33 -36
  29. package/commands/cms.js +2 -2
  30. package/commands/completion.js +3 -3
  31. package/commands/config/set.d.ts +1 -1
  32. package/commands/config/set.js +64 -37
  33. package/commands/config.js +2 -2
  34. package/commands/create.js +2 -2
  35. package/commands/customObject/create.js +10 -12
  36. package/commands/customObject/schema/create.js +9 -11
  37. package/commands/customObject/schema/delete.js +16 -16
  38. package/commands/customObject/schema/fetch-all.js +12 -11
  39. package/commands/customObject/schema/fetch.js +15 -15
  40. package/commands/customObject/schema/list.js +4 -4
  41. package/commands/customObject/schema/update.js +13 -13
  42. package/commands/customObject/schema.js +2 -2
  43. package/commands/customObject.js +6 -7
  44. package/commands/doctor.js +8 -11
  45. package/commands/feedback.js +7 -12
  46. package/commands/fetch.js +8 -8
  47. package/commands/filemanager/fetch.js +7 -7
  48. package/commands/filemanager/upload.js +15 -34
  49. package/commands/filemanager.js +2 -2
  50. package/commands/function/deploy.js +11 -29
  51. package/commands/function/list.js +8 -8
  52. package/commands/function/server.js +9 -11
  53. package/commands/function.d.ts +1 -1
  54. package/commands/function.js +2 -2
  55. package/commands/getStarted.d.ts +0 -2
  56. package/commands/getStarted.js +4 -4
  57. package/commands/hubdb/clear.js +7 -15
  58. package/commands/hubdb/create.js +9 -15
  59. package/commands/hubdb/delete.js +8 -15
  60. package/commands/hubdb/fetch.js +6 -9
  61. package/commands/hubdb.d.ts +1 -1
  62. package/commands/hubdb.js +2 -2
  63. package/commands/init.js +2 -3
  64. package/commands/lint.js +16 -16
  65. package/commands/list.js +8 -14
  66. package/commands/logs.js +14 -20
  67. package/commands/mcp/__tests__/setup.test.js +2 -2
  68. package/commands/mcp/setup.js +11 -2
  69. package/commands/mcp.js +3 -3
  70. package/commands/mv.js +6 -17
  71. package/commands/open.js +5 -5
  72. package/commands/project/__tests__/add.test.js +4 -2
  73. package/commands/project/__tests__/create.test.js +6 -6
  74. package/commands/project/__tests__/deploy.test.js +3 -7
  75. package/commands/project/__tests__/devUnifiedFlow.test.js +2 -4
  76. package/commands/project/__tests__/installDeps.test.js +8 -8
  77. package/commands/project/__tests__/logs.test.js +1 -4
  78. package/commands/project/__tests__/migrate.test.js +6 -7
  79. package/commands/project/__tests__/migrateApp.test.js +3 -7
  80. package/commands/project/__tests__/profile.test.js +1 -1
  81. package/commands/project/__tests__/validate.test.js +98 -0
  82. package/commands/project/add.js +4 -8
  83. package/commands/project/cloneApp.js +14 -19
  84. package/commands/project/create.js +2 -9
  85. package/commands/project/deploy.js +5 -5
  86. package/commands/project/dev/deprecatedFlow.js +7 -16
  87. package/commands/project/dev/index.js +16 -13
  88. package/commands/project/dev/unifiedFlow.js +8 -4
  89. package/commands/project/download.js +10 -14
  90. package/commands/project/installDeps.js +8 -9
  91. package/commands/project/listBuilds.js +12 -21
  92. package/commands/project/logs.js +21 -24
  93. package/commands/project/migrate.js +41 -13
  94. package/commands/project/migrateApp.js +10 -17
  95. package/commands/project/open.js +6 -14
  96. package/commands/project/profile/add.js +3 -3
  97. package/commands/project/profile/delete.js +1 -2
  98. package/commands/project/profile.js +2 -3
  99. package/commands/project/upload.js +16 -25
  100. package/commands/project/validate.js +7 -7
  101. package/commands/project/watch.js +13 -22
  102. package/commands/project.js +2 -3
  103. package/commands/sandbox/__tests__/create.test.js +5 -5
  104. package/commands/sandbox/create.js +22 -32
  105. package/commands/sandbox/delete.js +35 -63
  106. package/commands/sandbox.js +2 -2
  107. package/commands/secret/addSecret.js +7 -17
  108. package/commands/secret/deleteSecret.js +10 -20
  109. package/commands/secret/listSecret.js +8 -10
  110. package/commands/secret/updateSecret.js +9 -17
  111. package/commands/secret.js +2 -2
  112. package/commands/testAccount/__tests__/delete.test.js +2 -4
  113. package/commands/testAccount/delete.d.ts +4 -3
  114. package/commands/testAccount/delete.js +155 -14
  115. package/commands/testAccount/importData.d.ts +1 -1
  116. package/commands/testAccount/importData.js +1 -1
  117. package/commands/testAccount.js +1 -1
  118. package/lang/en.d.ts +317 -98
  119. package/lang/en.js +312 -96
  120. package/lang/en.lyaml +2 -2
  121. package/lib/__tests__/buildAccount.test.js +2 -1
  122. package/lib/__tests__/commonOpts.test.js +1 -1
  123. package/lib/__tests__/dependencyManagement.test.js +1 -1
  124. package/lib/__tests__/developerTestAccounts.test.js +3 -3
  125. package/lib/__tests__/npm.test.js +1 -1
  126. package/lib/__tests__/oauth.test.js +4 -4
  127. package/lib/__tests__/process.test.js +10 -5
  128. package/lib/__tests__/sandboxSync.test.js +8 -8
  129. package/lib/__tests__/sandboxes.test.js +8 -8
  130. package/lib/__tests__/serverlessLogs.test.js +1 -1
  131. package/lib/__tests__/usageTracking.test.js +5 -5
  132. package/lib/__tests__/validation.test.js +2 -1
  133. package/lib/__tests__/yargsUtils.test.js +83 -9
  134. package/lib/app/__tests__/migrate.test.js +19 -56
  135. package/lib/app/__tests__/migrate_legacy.test.js +1 -1
  136. package/lib/app/migrate.d.ts +2 -8
  137. package/lib/app/migrate.js +5 -80
  138. package/lib/app/migrate_legacy.js +20 -24
  139. package/lib/buildAccount.js +25 -57
  140. package/lib/commonOpts.d.ts +1 -1
  141. package/lib/commonOpts.js +25 -22
  142. package/lib/configOptions.js +7 -0
  143. package/lib/constants.d.ts +13 -0
  144. package/lib/constants.js +17 -0
  145. package/lib/dependencyManagement.js +9 -27
  146. package/lib/developerTestAccounts.js +9 -23
  147. package/lib/doctor/Diagnosis.js +11 -23
  148. package/lib/doctor/DiagnosticInfoBuilder.js +12 -11
  149. package/lib/doctor/Doctor.js +42 -90
  150. package/lib/doctor/__tests__/Doctor.test.js +4 -4
  151. package/lib/errorHandlers/index.js +12 -20
  152. package/lib/errorHandlers/suppressError.js +10 -17
  153. package/lib/lang.js +6 -5
  154. package/lib/links.d.ts +1 -0
  155. package/lib/links.js +14 -7
  156. package/lib/mcp/setup.js +1 -1
  157. package/lib/middleware/__test__/commandTargetingUtils.test.d.ts +1 -0
  158. package/lib/middleware/__test__/commandTargetingUtils.test.js +99 -0
  159. package/lib/middleware/__test__/configMiddleware.test.js +11 -11
  160. package/lib/middleware/__test__/yargsChecksMiddleware.test.js +6 -8
  161. package/lib/middleware/commandTargetingUtils.d.ts +8 -0
  162. package/lib/middleware/commandTargetingUtils.js +78 -0
  163. package/lib/middleware/configMiddleware.d.ts +1 -1
  164. package/lib/middleware/configMiddleware.js +21 -81
  165. package/lib/middleware/fireAlarmMiddleware.js +15 -5
  166. package/lib/middleware/gitMiddleware.js +5 -1
  167. package/lib/middleware/notificationsMiddleware.js +5 -11
  168. package/lib/middleware/yargsChecksMiddleware.js +6 -9
  169. package/lib/npm.js +2 -2
  170. package/lib/oauth.js +5 -5
  171. package/lib/process.js +5 -4
  172. package/lib/projects/__tests__/AppDevModeInterface.test.js +2 -0
  173. package/lib/projects/__tests__/LocalDevProcess.test.js +227 -16
  174. package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +86 -60
  175. package/lib/projects/__tests__/deploy.test.js +71 -6
  176. package/lib/projects/__tests__/localDevProjectHelpers.test.js +6 -2
  177. package/lib/projects/__tests__/platformVersion.test.js +8 -8
  178. package/lib/projects/__tests__/projects.test.js +12 -12
  179. package/lib/projects/__tests__/structure.test.js +3 -3
  180. package/lib/projects/__tests__/upload.test.d.ts +1 -0
  181. package/lib/projects/__tests__/upload.test.js +82 -0
  182. package/lib/projects/add/__tests__/legacyAddComponent.test.js +6 -6
  183. package/lib/projects/add/__tests__/v3AddComponent.test.js +4 -4
  184. package/lib/projects/create/__tests__/legacy.test.js +5 -5
  185. package/lib/projects/create/__tests__/v3.test.js +80 -5
  186. package/lib/projects/create/index.js +2 -2
  187. package/lib/projects/create/legacy.js +2 -2
  188. package/lib/projects/create/v3.js +10 -8
  189. package/lib/projects/localDev/AppDevModeInterface.d.ts +2 -0
  190. package/lib/projects/localDev/AppDevModeInterface.js +21 -12
  191. package/lib/projects/localDev/LocalDevLogger.d.ts +4 -0
  192. package/lib/projects/localDev/LocalDevLogger.js +27 -6
  193. package/lib/projects/localDev/LocalDevManager.js +4 -5
  194. package/lib/projects/localDev/LocalDevProcess.d.ts +7 -5
  195. package/lib/projects/localDev/LocalDevProcess.js +90 -19
  196. package/lib/projects/localDev/LocalDevState.d.ts +9 -8
  197. package/lib/projects/localDev/LocalDevState.js +18 -17
  198. package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +2 -1
  199. package/lib/projects/localDev/LocalDevWebsocketServer.js +62 -33
  200. package/lib/projects/localDev/helpers/project.d.ts +1 -0
  201. package/lib/projects/localDev/helpers/project.js +42 -1
  202. package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +4 -0
  203. package/lib/projects/localDev/localDevWebsocketServerUtils.js +10 -0
  204. package/lib/projects/platformVersion.d.ts +1 -1
  205. package/lib/projects/platformVersion.js +1 -1
  206. package/lib/projects/pollProjectBuildAndDeploy.js +4 -4
  207. package/lib/projects/structure.js +6 -6
  208. package/lib/projects/upload.d.ts +1 -1
  209. package/lib/projects/upload.js +17 -8
  210. package/lib/prompts/accountNamePrompt.js +14 -19
  211. package/lib/prompts/accountsPrompt.js +2 -2
  212. package/lib/prompts/cmsFieldPrompt.js +2 -2
  213. package/lib/prompts/createApiSamplePrompt.js +5 -5
  214. package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +10 -1
  215. package/lib/prompts/createFunctionPrompt.js +14 -14
  216. package/lib/prompts/createModulePrompt.js +9 -9
  217. package/lib/prompts/createTemplatePrompt.js +2 -2
  218. package/lib/prompts/downloadProjectPrompt.js +5 -8
  219. package/lib/prompts/personalAccessKeyPrompt.js +3 -3
  220. package/lib/prompts/previewPrompt.js +6 -6
  221. package/lib/prompts/projectAddPrompt.js +8 -1
  222. package/lib/prompts/projectDevTargetAccountPrompt.js +20 -32
  223. package/lib/prompts/projectNamePrompt.js +4 -8
  224. package/lib/prompts/projectsLogsPrompt.js +2 -4
  225. package/lib/prompts/promptUtils.js +30 -9
  226. package/lib/prompts/sandboxesPrompt.js +7 -7
  227. package/lib/prompts/secretPrompt.js +3 -3
  228. package/lib/prompts/selectAppPrompt.js +3 -3
  229. package/lib/prompts/selectHubDBTablePrompt.js +9 -13
  230. package/lib/prompts/selectProjectTemplatePrompt.js +2 -0
  231. package/lib/prompts/selectPublicAppForMigrationPrompt.js +15 -19
  232. package/lib/prompts/setAsDefaultAccountPrompt.js +4 -8
  233. package/lib/prompts/uploadPrompt.js +5 -5
  234. package/lib/sandboxSync.js +24 -41
  235. package/lib/sandboxes.js +19 -47
  236. package/lib/schema.js +3 -3
  237. package/lib/serverlessLogs.js +11 -13
  238. package/lib/theme/__tests__/migrate.test.d.ts +1 -0
  239. package/lib/theme/__tests__/migrate.test.js +233 -0
  240. package/lib/theme/migrate.d.ts +13 -0
  241. package/lib/theme/migrate.js +90 -0
  242. package/lib/ui/SpinniesManager.d.ts +2 -0
  243. package/lib/ui/SpinniesManager.js +7 -0
  244. package/lib/ui/boxen.js +1 -2
  245. package/lib/ui/git.js +13 -10
  246. package/lib/ui/index.js +38 -37
  247. package/lib/ui/serverlessFunctionLogs.js +9 -7
  248. package/lib/ui/uiMessages.d.ts +68 -0
  249. package/lib/ui/uiMessages.js +71 -0
  250. package/lib/usageTracking.js +8 -8
  251. package/lib/validation.js +20 -23
  252. package/lib/yargsUtils.d.ts +1 -1
  253. package/lib/yargsUtils.js +12 -5
  254. package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
  255. package/mcp-server/tools/index.js +4 -0
  256. package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +2 -2
  257. package/mcp-server/tools/project/CreateProjectTool.d.ts +2 -2
  258. package/mcp-server/tools/project/DocsSearchTool.d.ts +4 -1
  259. package/mcp-server/tools/project/DocsSearchTool.js +5 -5
  260. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +23 -0
  261. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +68 -0
  262. package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +11 -0
  263. package/mcp-server/tools/project/GetApplicationInfoTool.js +49 -0
  264. package/mcp-server/tools/project/GetConfigValuesTool.d.ts +4 -1
  265. package/mcp-server/tools/project/GetConfigValuesTool.js +12 -6
  266. package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
  267. package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +12 -10
  268. package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +1 -0
  269. package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +169 -0
  270. package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +1 -0
  271. package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +115 -0
  272. package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +8 -7
  273. package/mcp-server/utils/__tests__/cliConfig.test.d.ts +1 -0
  274. package/mcp-server/utils/__tests__/cliConfig.test.js +110 -0
  275. package/mcp-server/utils/cliConfig.d.ts +1 -0
  276. package/mcp-server/utils/cliConfig.js +12 -0
  277. package/mcp-server/utils/toolUsageTracking.js +2 -2
  278. package/package.json +4 -4
  279. package/types/LocalDev.d.ts +19 -3
  280. package/ui/index.js +1 -1
  281. package/lib/middleware/__test__/utils.test.js +0 -51
  282. package/lib/middleware/utils.d.ts +0 -8
  283. package/lib/middleware/utils.js +0 -14
  284. /package/{lib/middleware/__test__/utils.test.d.ts → commands/project/__tests__/validate.test.d.ts} +0 -0
@@ -12,18 +12,14 @@ export type MigrateAppArgs = CommonArgs & AccountArgs & EnvironmentArgs & Config
12
12
  export declare function getUnmigratableReason(reasonCode: string, projectName: string | undefined, accountId: number): string;
13
13
  export declare function generateFilterAppsByProjectNameFunction(projectConfig?: LoadedProjectConfig): (app: MigrationApp) => boolean;
14
14
  export declare function buildErrorMessageFromMigrationStatus(error: MigrationFailed): string;
15
- export declare function getHasMigratableThemes(projectConfig?: LoadedProjectConfig): Promise<{
16
- hasMigratableThemes: boolean;
17
- migratableThemesCount: number;
18
- }>;
19
15
  export declare function fetchMigrationApps(derivedAccountId: number, platformVersion: string, projectConfig?: LoadedProjectConfig): Promise<{
20
16
  migratableApps: MigratableApp[];
21
17
  unmigratableApps: UnmigratableApp[];
22
18
  }>;
23
- export declare function validateMigrationAppsAndThemes(appId: MigrateAppArgs['appId'], derivedAccountId: number, { migratableApps, unmigratableApps, }: {
19
+ export declare function validateMigrationApps(appId: MigrateAppArgs['appId'], derivedAccountId: number, { migratableApps, unmigratableApps, }: {
24
20
  migratableApps: MigratableApp[];
25
21
  unmigratableApps: UnmigratableApp[];
26
- }, hasMigratableThemes: boolean, projectConfig?: LoadedProjectConfig): Promise<void>;
22
+ }, projectConfig?: LoadedProjectConfig): Promise<void>;
27
23
  export declare function promptForAppToMigrate(allApps: MigrationApp[], derivedAccountId: number): Promise<number>;
28
24
  export declare function selectAppToMigrate(allApps: MigrationApp[], derivedAccountId: number, appId?: number): Promise<{
29
25
  proceed: boolean;
@@ -33,9 +29,7 @@ export declare function handleMigrationSetup(derivedAccountId: number, options:
33
29
  appIdToMigrate?: number | undefined;
34
30
  projectName?: string;
35
31
  projectDest?: string;
36
- isThemesMigration?: boolean;
37
32
  }>;
38
- export declare function handleThemesMigration(projectConfig: LoadedProjectConfig, platformVersion: string): Promise<void>;
39
33
  export declare function beginAppMigration(derivedAccountId: number, appId: number, platformVersion: string): Promise<{
40
34
  migrationId: number;
41
35
  uidMap: Record<string, string>;
@@ -2,7 +2,7 @@ import path from 'path';
2
2
  import { getCwd, sanitizeFileName } from '@hubspot/local-dev-lib/path';
3
3
  import { extractZipArchive } from '@hubspot/local-dev-lib/archive';
4
4
  import chalk from 'chalk';
5
- import { validateUid, migrateThemes, getProjectThemeDetails, } from '@hubspot/project-parsing-lib';
5
+ import { validateUid } from '@hubspot/project-parsing-lib';
6
6
  import { UNMIGRATABLE_REASONS } from '@hubspot/local-dev-lib/constants/projects';
7
7
  import { mapToUserFacingType } from '@hubspot/project-parsing-lib/src/lib/transform.js';
8
8
  import { MIGRATION_STATUS } from '@hubspot/local-dev-lib/types/Migration';
@@ -10,19 +10,15 @@ import { downloadProject } from '@hubspot/local-dev-lib/api/projects';
10
10
  import { Separator } from '@inquirer/prompts';
11
11
  import { confirmPrompt, inputPrompt, listPrompt, } from '../prompts/promptUtils.js';
12
12
  import { uiAccountDescription, uiCommandReference, uiLine, uiLink, } from '../ui/index.js';
13
- import { writeProjectConfig } from '../projects/config.js';
14
13
  import { ensureProjectExists } from '../projects/ensureProjectExists.js';
15
14
  import SpinniesManager from '../ui/SpinniesManager.js';
16
15
  import { DEFAULT_POLLING_STATUS_LOOKUP, poll } from '../polling.js';
17
16
  import { checkMigrationStatusV2, CLI_UNMIGRATABLE_REASONS, continueAppMigration, initializeAppMigration, isMigrationStatus, listAppsForMigration, } from '../../api/migrate.js';
18
17
  import fs from 'fs';
19
18
  import { lib } from '../../lang/en.js';
20
- import { PROJECT_CONFIG_FILE } from '../constants.js';
21
19
  import { hasUnfiedAppsAccess } from '../hasFeature.js';
22
20
  import { getProjectBuildDetailUrl, getProjectDetailUrl, } from '../projects/urls.js';
23
21
  import { uiLogger } from '../ui/logger.js';
24
- import { debugError } from '../errorHandlers/index.js';
25
- import { useV3Api } from '../projects/platformVersion.js';
26
22
  export function getUnmigratableReason(reasonCode, projectName, accountId) {
27
23
  switch (reasonCode) {
28
24
  case UNMIGRATABLE_REASONS.UP_TO_DATE:
@@ -59,17 +55,6 @@ export function buildErrorMessageFromMigrationStatus(error) {
59
55
  })
60
56
  .join('\n\t- ')}`;
61
57
  }
62
- export async function getHasMigratableThemes(projectConfig) {
63
- if (!projectConfig?.projectConfig?.name || !projectConfig?.projectDir) {
64
- return { hasMigratableThemes: false, migratableThemesCount: 0 };
65
- }
66
- const projectSrcDir = path.resolve(projectConfig.projectDir, projectConfig.projectConfig.srcDir);
67
- const { legacyThemeDetails, legacyReactThemeDetails } = await getProjectThemeDetails(projectSrcDir);
68
- return {
69
- hasMigratableThemes: legacyThemeDetails.length > 0 || legacyReactThemeDetails.length > 0,
70
- migratableThemesCount: legacyThemeDetails.length + legacyReactThemeDetails.length,
71
- };
72
- }
73
58
  export async function fetchMigrationApps(derivedAccountId, platformVersion, projectConfig) {
74
59
  const { data: { migratableApps, unmigratableApps }, } = await listAppsForMigration(derivedAccountId, platformVersion);
75
60
  const filteredMigratableApps = migratableApps.filter(generateFilterAppsByProjectNameFunction(projectConfig));
@@ -79,23 +64,11 @@ export async function fetchMigrationApps(derivedAccountId, platformVersion, proj
79
64
  unmigratableApps: filteredUnmigratableApps,
80
65
  };
81
66
  }
82
- export async function validateMigrationAppsAndThemes(appId, derivedAccountId, { migratableApps, unmigratableApps, }, hasMigratableThemes, projectConfig) {
67
+ export async function validateMigrationApps(appId, derivedAccountId, { migratableApps, unmigratableApps, }, projectConfig) {
83
68
  const allApps = [...migratableApps, ...unmigratableApps];
84
69
  if (allApps.length > 1 && projectConfig) {
85
70
  throw new Error(lib.migrate.errors.project.multipleApps);
86
71
  }
87
- if (hasMigratableThemes) {
88
- if (useV3Api(projectConfig?.projectConfig?.platformVersion)) {
89
- throw new Error(lib.migrate.errors.project.themesAlreadyMigrated);
90
- }
91
- if (allApps.length > 0 && projectConfig) {
92
- throw new Error(lib.migrate.errors.project.themesAndAppsNotAllowed);
93
- }
94
- if (!projectConfig) {
95
- throw new Error(lib.migrate.errors.project.noProjectForThemesMigration);
96
- }
97
- return;
98
- }
99
72
  if (!projectConfig?.projectConfig) {
100
73
  allApps.forEach(app => {
101
74
  if (app.projectName) {
@@ -178,35 +151,20 @@ export async function handleMigrationSetup(derivedAccountId, options, projectCon
178
151
  text: lib.migrate.spinners.checkingForMigratableComponents,
179
152
  });
180
153
  const { name, dest, appId } = options;
181
- const { hasMigratableThemes, migratableThemesCount } = await getHasMigratableThemes(projectConfig);
182
154
  const { migratableApps, unmigratableApps } = await fetchMigrationApps(derivedAccountId, options.platformVersion, projectConfig);
183
155
  SpinniesManager.remove('checkingForMigratableComponents');
184
- await validateMigrationAppsAndThemes(appId, derivedAccountId, { migratableApps, unmigratableApps }, hasMigratableThemes, projectConfig);
156
+ await validateMigrationApps(appId, derivedAccountId, { migratableApps, unmigratableApps }, projectConfig);
185
157
  const allApps = [...migratableApps, ...unmigratableApps];
186
- let proceed = false;
187
- let appIdToMigrate;
188
- if (hasMigratableThemes) {
189
- uiLogger.log(lib.migrate.prompt.themesMigration(migratableThemesCount));
190
- proceed = await confirmPrompt(lib.migrate.prompt.proceed, {
191
- defaultAnswer: false,
192
- });
193
- }
194
- else {
195
- const appSelectionPrompt = await selectAppToMigrate(allApps, derivedAccountId, appId);
196
- appIdToMigrate = appSelectionPrompt.appIdToMigrate;
197
- proceed = appSelectionPrompt.proceed;
198
- }
158
+ const { proceed, appIdToMigrate } = await selectAppToMigrate(allApps, derivedAccountId, appId);
199
159
  if (!proceed) {
200
160
  return {};
201
161
  }
202
162
  // If it's a project we don't want to prompt for dest and name, so just return early
203
- // Theme migrations can only be initiated from the project directory
204
163
  if (projectConfig &&
205
164
  projectConfig?.projectConfig &&
206
165
  projectConfig?.projectDir) {
207
166
  return {
208
167
  appIdToMigrate,
209
- isThemesMigration: hasMigratableThemes,
210
168
  projectName: projectConfig.projectConfig.name,
211
169
  projectDest: projectConfig.projectDir,
212
170
  };
@@ -231,35 +189,6 @@ export async function handleMigrationSetup(derivedAccountId, options, projectCon
231
189
  }));
232
190
  return { appIdToMigrate, projectName, projectDest };
233
191
  }
234
- export async function handleThemesMigration(projectConfig, platformVersion) {
235
- if (!projectConfig?.projectDir || !projectConfig?.projectConfig?.srcDir) {
236
- throw new Error(lib.migrate.errors.project.invalidConfig);
237
- }
238
- const projectSrcDir = path.resolve(projectConfig.projectDir, projectConfig.projectConfig.srcDir);
239
- let migrated = false;
240
- let failureReason;
241
- try {
242
- const migrationResult = await migrateThemes(projectConfig.projectDir, projectSrcDir);
243
- migrated = migrationResult.migrated;
244
- failureReason = migrationResult.failureReason;
245
- }
246
- catch (error) {
247
- debugError(error);
248
- throw new Error(lib.migrate.errors.project.failedToMigrateThemes);
249
- }
250
- if (!migrated) {
251
- throw new Error(failureReason || lib.migrate.errors.project.failedToMigrateThemes);
252
- }
253
- const newProjectConfig = { ...projectConfig.projectConfig };
254
- newProjectConfig.platformVersion = platformVersion;
255
- const projectConfigPath = path.join(projectConfig.projectDir, PROJECT_CONFIG_FILE);
256
- const success = writeProjectConfig(projectConfigPath, newProjectConfig);
257
- if (!success) {
258
- throw new Error(lib.migrate.errors.project.failedToUpdateProjectConfig);
259
- }
260
- uiLogger.log('');
261
- uiLogger.log(lib.migrate.success.themesMigrationSuccess(platformVersion));
262
- }
263
192
  export async function beginAppMigration(derivedAccountId, appId, platformVersion) {
264
193
  SpinniesManager.add('beginningMigration', {
265
194
  text: lib.migrate.spinners.beginningMigration,
@@ -412,11 +341,7 @@ export async function migrateApp2025_2(derivedAccountId, options, projectConfig)
412
341
  throw new Error(lib.migrate.errors.project.doesNotExist(derivedAccountId));
413
342
  }
414
343
  }
415
- const { appIdToMigrate, projectName, projectDest, isThemesMigration } = await handleMigrationSetup(derivedAccountId, options, projectConfig);
416
- if (isThemesMigration) {
417
- await handleThemesMigration(projectConfig, options.platformVersion);
418
- return;
419
- }
344
+ const { appIdToMigrate, projectName, projectDest } = await handleMigrationSetup(derivedAccountId, options, projectConfig);
420
345
  if (!appIdToMigrate || !projectName || !projectDest) {
421
346
  return;
422
347
  }
@@ -1,5 +1,5 @@
1
1
  import { fetchPublicAppMetadata } from '@hubspot/local-dev-lib/api/appsDev';
2
- import { logger } from '@hubspot/local-dev-lib/logger';
2
+ import { uiLogger } from '../ui/logger.js';
3
3
  import { checkMigrationStatus, downloadProject, migrateApp as migrateNonProjectApp_v2023_2, } from '@hubspot/local-dev-lib/api/projects';
4
4
  import path from 'path';
5
5
  import { getCwd, sanitizeFileName } from '@hubspot/local-dev-lib/path';
@@ -9,7 +9,7 @@ import { promptUser } from '../prompts/promptUtils.js';
9
9
  import { ApiErrorContext, logError } from '../errorHandlers/index.js';
10
10
  import { EXIT_CODES } from '../enums/exitCodes.js';
11
11
  import { uiAccountDescription, uiLine, uiLink } from '../ui/index.js';
12
- import { i18n } from '../lang.js';
12
+ import { commands } from '../../lang/en.js';
13
13
  import { isAppDeveloperAccount, isUnifiedAccount } from '../accountTypes.js';
14
14
  import { selectPublicAppForMigrationPrompt } from '../prompts/selectPublicAppForMigrationPrompt.js';
15
15
  import { projectNameAndDestPrompt } from '../prompts/projectNameAndDestPrompt.js';
@@ -42,9 +42,7 @@ export async function migrateApp2023_2(derivedAccountId, options, accountConfig)
42
42
  const preventProjectMigrations = selectedApp.preventProjectMigrations;
43
43
  const listingInfo = selectedApp.listingInfo;
44
44
  if (preventProjectMigrations && listingInfo) {
45
- logger.error(i18n(`commands.project.subcommands.migrateApp.errors.invalidApp`, {
46
- appId,
47
- }));
45
+ uiLogger.error(commands.project.migrateApp.errors.invalidApp(appId));
48
46
  return process.exit(EXIT_CODES.ERROR);
49
47
  }
50
48
  }
@@ -58,24 +56,22 @@ export async function migrateApp2023_2(derivedAccountId, options, accountConfig)
58
56
  noLogs: true,
59
57
  });
60
58
  if (projectExists) {
61
- throw new Error(i18n(`commands.project.subcommands.migrateApp.errors.projectAlreadyExists`, {
62
- projectName,
63
- }));
59
+ throw new Error(commands.project.migrateApp.errors.projectAlreadyExists(projectName));
64
60
  }
65
61
  await trackCommandMetadataUsage('migrate-app', { step: 'STARTED' }, derivedAccountId);
66
- logger.log('');
62
+ uiLogger.log('');
67
63
  uiLine();
68
- logger.warn(`${i18n(`commands.project.subcommands.migrateApp.warning.title`)}\n`);
69
- logger.log(i18n(`commands.project.subcommands.migrateApp.warning.projectConversion`));
70
- logger.log(`${i18n(`commands.project.subcommands.migrateApp.warning.appConfig`)}\n`);
71
- logger.log(`${i18n(`commands.project.subcommands.migrateApp.warning.buildAndDeploy`)}\n`);
72
- logger.log(`${i18n(`commands.project.subcommands.migrateApp.warning.existingApps`)}\n`);
73
- logger.log(i18n(`commands.project.subcommands.migrateApp.warning.copyApp`));
64
+ uiLogger.warn(commands.project.migrateApp.warning.title);
65
+ uiLogger.log(commands.project.migrateApp.warning.projectConversion);
66
+ uiLogger.log(commands.project.migrateApp.warning.appConfig);
67
+ uiLogger.log(commands.project.migrateApp.warning.buildAndDeploy);
68
+ uiLogger.log(commands.project.migrateApp.warning.existingApps);
69
+ uiLogger.log(commands.project.migrateApp.warning.copyApp);
74
70
  uiLine();
75
71
  const { shouldCreateApp } = await promptUser({
76
72
  name: 'shouldCreateApp',
77
73
  type: 'confirm',
78
- message: i18n(`commands.project.subcommands.migrateApp.createAppPrompt`),
74
+ message: commands.project.migrateApp.createAppPrompt,
79
75
  });
80
76
  process.stdin.resume();
81
77
  if (!shouldCreateApp) {
@@ -84,12 +80,12 @@ export async function migrateApp2023_2(derivedAccountId, options, accountConfig)
84
80
  try {
85
81
  SpinniesManager.init();
86
82
  SpinniesManager.add('migrateApp', {
87
- text: i18n(`commands.project.subcommands.migrateApp.migrationStatus.inProgress`),
83
+ text: commands.project.migrateApp.migrationStatus.inProgress(),
88
84
  });
89
85
  handleKeypress(async (key) => {
90
86
  if ((key.ctrl && key.name === 'c') || key.name === 'q') {
91
87
  SpinniesManager.remove('migrateApp');
92
- logger.log(i18n(`commands.project.subcommands.migrateApp.migrationInterrupted`));
88
+ uiLogger.log(commands.project.migrateApp.migrationInterrupted);
93
89
  return process.exit(EXIT_CODES.SUCCESS);
94
90
  }
95
91
  });
@@ -104,20 +100,20 @@ export async function migrateApp2023_2(derivedAccountId, options, accountConfig)
104
100
  const { data: zippedProject } = await downloadProject(derivedAccountId, projectName, 1);
105
101
  await extractZipArchive(zippedProject, sanitizeFileName(projectName), path.resolve(absoluteDestPath), { includesRootDir: true, hideLogs: true });
106
102
  SpinniesManager.succeed('migrateApp', {
107
- text: i18n(`commands.project.subcommands.migrateApp.migrationStatus.done`),
103
+ text: commands.project.migrateApp.migrationStatus.done(),
108
104
  succeedColor: 'white',
109
105
  });
110
- logger.log('');
106
+ uiLogger.log('');
111
107
  uiLine();
112
- logger.success(i18n(`commands.project.subcommands.migrateApp.migrationStatus.success`));
113
- logger.log('');
114
- logger.log(uiLink(i18n(`commands.project.subcommands.migrateApp.projectDetailsLink`), `${baseUrl}/developer-projects/${derivedAccountId}/project/${encodeURIComponent(project.name)}`));
108
+ uiLogger.success(commands.project.migrateApp.migrationStatus.success());
109
+ uiLogger.log('');
110
+ uiLogger.log(uiLink(commands.project.migrateApp.projectDetailsLink, `${baseUrl}/developer-projects/${derivedAccountId}/project/${encodeURIComponent(project.name)}`));
115
111
  process.exit(EXIT_CODES.SUCCESS);
116
112
  }
117
113
  }
118
114
  catch (error) {
119
115
  SpinniesManager.fail('migrateApp', {
120
- text: i18n(`commands.project.subcommands.migrateApp.migrationStatus.failure`),
116
+ text: commands.project.migrateApp.migrationStatus.failure(),
121
117
  failColor: 'white',
122
118
  });
123
119
  throw error;
@@ -1,13 +1,12 @@
1
1
  import { getAccessToken, updateConfigWithAccessToken, } from '@hubspot/local-dev-lib/personalAccessKey';
2
2
  import { accountNameExistsInConfig, updateAccountConfig, writeConfig, getAccountId, } from '@hubspot/local-dev-lib/config';
3
3
  import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
4
- import { logger } from '@hubspot/local-dev-lib/logger';
4
+ import { uiLogger } from './ui/logger.js';
5
5
  import { createDeveloperTestAccount, fetchDeveloperTestAccountGateSyncStatus, generateDeveloperTestAccountPersonalAccessKey, } from '@hubspot/local-dev-lib/api/developerTestAccounts';
6
6
  import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
7
7
  import { createSandbox, createV2Sandbox, getSandboxPersonalAccessKey, } from '@hubspot/local-dev-lib/api/sandboxHubs';
8
8
  import { personalAccessKeyPrompt } from './prompts/personalAccessKeyPrompt.js';
9
9
  import { createDeveloperTestAccountConfigPrompt } from './prompts/createDeveloperTestAccountConfigPrompt.js';
10
- import { i18n } from './lang.js';
11
10
  import { cliAccountNamePrompt } from './prompts/accountNamePrompt.js';
12
11
  import SpinniesManager from './ui/SpinniesManager.js';
13
12
  import { debugError, logError } from './errorHandlers/index.js';
@@ -32,10 +31,8 @@ export async function saveAccountToConfig(accountId, accountName, env, personalA
32
31
  const invalidAccountName = accountNameExistsInConfig(nameForConfig);
33
32
  if (invalidAccountName) {
34
33
  if (!force) {
35
- logger.log('');
36
- logger.warn(i18n(`lib.prompts.accountNamePrompt.errors.accountNameExists`, {
37
- name: nameForConfig,
38
- }));
34
+ uiLogger.log('');
35
+ uiLogger.warn(lib.prompts.accountNamePrompt.errors.accountNameExists(nameForConfig));
39
36
  const { name: promptName } = await cliAccountNamePrompt(nameForConfig + `_${accountId}`);
40
37
  validName = promptName;
41
38
  }
@@ -52,7 +49,7 @@ export async function saveAccountToConfig(accountId, accountName, env, personalA
52
49
  name: validName,
53
50
  });
54
51
  writeConfig();
55
- logger.log('');
52
+ uiLogger.log('');
56
53
  return validName;
57
54
  }
58
55
  export async function createDeveloperTestAccountV3(parentAccountId, testAccountConfig) {
@@ -92,7 +89,7 @@ export async function buildDeveloperTestAccount(testAccountName, parentAccountCo
92
89
  accountName: testAccountName,
93
90
  };
94
91
  if (!parentAccountId) {
95
- throw new Error(i18n(`lib.developerTestAccount.create.loading.fail`));
92
+ throw new Error(lib.developerTestAccount.create.loading.fail(''));
96
93
  }
97
94
  if (useV3) {
98
95
  testAccountConfig = await createDeveloperTestAccountConfigPrompt({
@@ -103,11 +100,9 @@ export async function buildDeveloperTestAccount(testAccountName, parentAccountCo
103
100
  SpinniesManager.init({
104
101
  succeedColor: 'white',
105
102
  });
106
- logger.log('');
103
+ uiLogger.log('');
107
104
  SpinniesManager.add('buildDeveloperTestAccount', {
108
- text: i18n(`lib.developerTestAccount.create.loading.add`, {
109
- accountName: testAccountName,
110
- }),
105
+ text: lib.developerTestAccount.create.loading.add(testAccountName),
111
106
  });
112
107
  let developerTestAccountId;
113
108
  let developerTestAccountPersonalAccessKey;
@@ -123,18 +118,13 @@ export async function buildDeveloperTestAccount(testAccountName, parentAccountCo
123
118
  developerTestAccountPersonalAccessKey = data.personalAccessKey;
124
119
  }
125
120
  SpinniesManager.succeed('buildDeveloperTestAccount', {
126
- text: i18n(`lib.developerTestAccount.create.loading.succeed`, {
127
- accountName: testAccountName,
128
- accountId: developerTestAccountId,
129
- }),
121
+ text: lib.developerTestAccount.create.loading.succeed(testAccountName, developerTestAccountId.toString()),
130
122
  });
131
123
  }
132
124
  catch (e) {
133
125
  debugError(e);
134
126
  SpinniesManager.fail('buildDeveloperTestAccount', {
135
- text: i18n(`lib.developerTestAccount.create.loading.fail`, {
136
- accountName: testAccountName,
137
- }),
127
+ text: lib.developerTestAccount.create.loading.fail(testAccountName),
138
128
  });
139
129
  handleDeveloperTestAccountCreateError(e, parentAccountId, env, portalLimit);
140
130
  }
@@ -148,26 +138,20 @@ export async function buildDeveloperTestAccount(testAccountName, parentAccountCo
148
138
  return developerTestAccountId;
149
139
  }
150
140
  export async function buildSandbox(sandboxName, parentAccountConfig, sandboxType, env, force = false) {
151
- let i18nKey;
152
- if (sandboxType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX) {
153
- i18nKey = 'lib.sandbox.create.loading.standard';
154
- }
155
- else {
156
- i18nKey = 'lib.sandbox.create.loading.developer';
157
- }
141
+ const sandboxTypeKey = sandboxType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX
142
+ ? 'standard'
143
+ : 'developer';
158
144
  const id = getAccountIdentifier(parentAccountConfig);
159
145
  const parentAccountId = getAccountId(id);
160
146
  if (!parentAccountId) {
161
- throw new Error(i18n(`${i18nKey}.fail`));
147
+ throw new Error(lib.sandbox.create[sandboxTypeKey].loading.fail(''));
162
148
  }
163
149
  SpinniesManager.init({
164
150
  succeedColor: 'white',
165
151
  });
166
- logger.log('');
152
+ uiLogger.log('');
167
153
  SpinniesManager.add('buildSandbox', {
168
- text: i18n(`${i18nKey}.add`, {
169
- accountName: sandboxName,
170
- }),
154
+ text: lib.sandbox.create[sandboxTypeKey].loading.add(sandboxName),
171
155
  });
172
156
  let sandbox;
173
157
  try {
@@ -175,18 +159,13 @@ export async function buildSandbox(sandboxName, parentAccountConfig, sandboxType
175
159
  const { data } = await createSandbox(parentAccountId, sandboxName, sandboxApiType);
176
160
  sandbox = { name: sandboxName, ...data };
177
161
  SpinniesManager.succeed('buildSandbox', {
178
- text: i18n(`${i18nKey}.succeed`, {
179
- accountName: sandboxName,
180
- accountId: sandbox.sandbox.sandboxHubId,
181
- }),
162
+ text: lib.sandbox.create[sandboxTypeKey].loading.succeed(sandboxName, sandbox.sandbox.sandboxHubId.toString()),
182
163
  });
183
164
  }
184
165
  catch (e) {
185
166
  debugError(e);
186
167
  SpinniesManager.fail('buildSandbox', {
187
- text: i18n(`${i18nKey}.fail`, {
188
- accountName: sandboxName,
189
- }),
168
+ text: lib.sandbox.create[sandboxTypeKey].loading.fail(sandboxName),
190
169
  });
191
170
  handleSandboxCreateError(e, env, sandboxName, parentAccountId);
192
171
  }
@@ -200,26 +179,20 @@ export async function buildSandbox(sandboxName, parentAccountConfig, sandboxType
200
179
  return sandbox;
201
180
  }
202
181
  export async function buildV2Sandbox(sandboxName, parentAccountConfig, sandboxType, syncObjectRecords, env, force = false) {
203
- let i18nKey;
204
- if (sandboxType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX) {
205
- i18nKey = 'lib.sandbox.create.loading.standard';
206
- }
207
- else {
208
- i18nKey = 'lib.sandbox.create.loading.developer';
209
- }
182
+ const sandboxTypeKey = sandboxType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX
183
+ ? 'standard'
184
+ : 'developer';
210
185
  const id = getAccountIdentifier(parentAccountConfig);
211
186
  const parentAccountId = getAccountId(id);
212
187
  if (!parentAccountId) {
213
- throw new Error(i18n(`${i18nKey}.fail`));
188
+ throw new Error(lib.sandbox.create[sandboxTypeKey].loading.fail(''));
214
189
  }
215
190
  SpinniesManager.init({
216
191
  succeedColor: 'white',
217
192
  });
218
- logger.log('');
193
+ uiLogger.log('');
219
194
  SpinniesManager.add('buildV2Sandbox', {
220
- text: i18n(`${i18nKey}.add`, {
221
- accountName: sandboxName,
222
- }),
195
+ text: lib.sandbox.create[sandboxTypeKey].loading.add(sandboxName),
223
196
  });
224
197
  let sandbox;
225
198
  let pak;
@@ -230,18 +203,13 @@ export async function buildV2Sandbox(sandboxName, parentAccountConfig, sandboxTy
230
203
  const { data: { personalAccessKey }, } = await getSandboxPersonalAccessKey(parentAccountId, sandbox.sandboxHubId);
231
204
  pak = personalAccessKey.encodedOAuthRefreshToken;
232
205
  SpinniesManager.succeed('buildV2Sandbox', {
233
- text: i18n(`${i18nKey}.succeed`, {
234
- accountName: sandboxName,
235
- accountId: sandbox.sandboxHubId,
236
- }),
206
+ text: lib.sandbox.create[sandboxTypeKey].loading.succeed(sandboxName, sandbox.sandboxHubId.toString()),
237
207
  });
238
208
  }
239
209
  catch (e) {
240
210
  debugError(e);
241
211
  SpinniesManager.fail('buildV2Sandbox', {
242
- text: i18n(`${i18nKey}.fail`, {
243
- accountName: sandboxName,
244
- }),
212
+ text: lib.sandbox.create[sandboxTypeKey].loading.fail(sandboxName),
245
213
  });
246
214
  handleSandboxCreateError(e, env, sandboxName, parentAccountId);
247
215
  }
@@ -13,7 +13,7 @@ export declare function addTestingOptions(yargs: Argv): Argv;
13
13
  export declare function addUseEnvironmentOptions(yargs: Argv): Argv;
14
14
  export declare function addJSONOutputOptions(yargs: Argv): Argv;
15
15
  export declare function addCustomHelpOutput(yargs: Argv, command: string | string[], describe?: string): Promise<void>;
16
- export declare function setLogLevel(options: Arguments<{
16
+ export declare function setCLILogLevel(options: Arguments<{
17
17
  debug?: boolean;
18
18
  networkDebug?: boolean;
19
19
  json?: boolean;
package/lib/commonOpts.js CHANGED
@@ -1,19 +1,21 @@
1
1
  import chalk from 'chalk';
2
2
  import yargsParser from 'yargs-parser';
3
- import { LOG_LEVEL, logger, setLogLevel as setLoggerLogLevel, } from '@hubspot/local-dev-lib/logger';
3
+ import { LOG_LEVEL, setLogLevel } from '@hubspot/local-dev-lib/logger';
4
+ import { uiLogger } from './ui/logger.js';
4
5
  import { DEFAULT_CMS_PUBLISH_MODE, CMS_PUBLISH_MODE, } from '@hubspot/local-dev-lib/constants/files';
5
6
  import { getAccountConfig, getAndLoadConfigIfNeeded, } from '@hubspot/local-dev-lib/config';
6
7
  import { debugError } from './errorHandlers/index.js';
7
8
  import { EXIT_CODES } from './enums/exitCodes.js';
8
9
  import { uiCommandReference } from './ui/index.js';
9
- import { i18n } from './lang.js';
10
+ import { lib } from '../lang/en.js';
10
11
  import { getTerminalUISupport, UI_COLORS } from './ui/index.js';
12
+ import SpinniesManager from './ui/SpinniesManager.js';
11
13
  export function addGlobalOptions(yargs) {
12
14
  yargs.version(false);
13
15
  yargs.option('debug', {
14
16
  alias: 'd',
15
17
  default: false,
16
- describe: i18n('lib.commonOpts.options.debug.describe'),
18
+ describe: lib.commonOpts.options.debug,
17
19
  type: 'boolean',
18
20
  });
19
21
  yargs.option('network-debug', {
@@ -26,21 +28,21 @@ export function addGlobalOptions(yargs) {
26
28
  export function addAccountOptions(yargs) {
27
29
  return yargs.option('account', {
28
30
  alias: 'a',
29
- describe: i18n('lib.commonOpts.options.account.describe'),
31
+ describe: lib.commonOpts.options.account,
30
32
  type: 'string',
31
33
  });
32
34
  }
33
35
  export function addConfigOptions(yargs) {
34
36
  return yargs.option('config', {
35
37
  alias: 'c',
36
- describe: i18n('lib.commonOpts.options.config.describe'),
38
+ describe: lib.commonOpts.options.config,
37
39
  type: 'string',
38
40
  });
39
41
  }
40
42
  export function addOverwriteOptions(yargs) {
41
43
  return yargs.option('overwrite', {
42
44
  alias: 'o',
43
- describe: i18n('lib.commonOpts.options.overwrite.describe'),
45
+ describe: lib.commonOpts.options.overwrite,
44
46
  type: 'boolean',
45
47
  default: false,
46
48
  });
@@ -49,13 +51,13 @@ export function addCmsPublishModeOptions(yargs, { read, write }) {
49
51
  const cmsPublishModes = `<${Object.values(CMS_PUBLISH_MODE).join(' | ')}>`;
50
52
  return yargs.option('cms-publish-mode', {
51
53
  alias: 'm',
52
- describe: i18n(`lib.commonOpts.options.modes.describe.${read ? 'read' : write ? 'write' : 'default'}`, { modes: cmsPublishModes }),
54
+ describe: lib.commonOpts.options.modes[read ? 'read' : write ? 'write' : 'default'](cmsPublishModes),
53
55
  type: 'string',
54
56
  });
55
57
  }
56
58
  export function addTestingOptions(yargs) {
57
59
  return yargs.option('qa', {
58
- describe: i18n('lib.commonOpts.options.qa.describe'),
60
+ describe: lib.commonOpts.options.qa,
59
61
  type: 'boolean',
60
62
  default: false,
61
63
  hidden: true,
@@ -63,7 +65,7 @@ export function addTestingOptions(yargs) {
63
65
  }
64
66
  export function addUseEnvironmentOptions(yargs) {
65
67
  yargs.option('use-env', {
66
- describe: i18n('lib.commonOpts.options.useEnv.describe'),
68
+ describe: lib.commonOpts.options.useEnv,
67
69
  type: 'boolean',
68
70
  });
69
71
  yargs.conflicts('use-env', 'account');
@@ -72,7 +74,7 @@ export function addUseEnvironmentOptions(yargs) {
72
74
  export function addJSONOutputOptions(yargs) {
73
75
  return yargs.option('json', {
74
76
  alias: 'format-output-as-json',
75
- describe: i18n('lib.commonOpts.options.jsonOutput.describe'),
77
+ describe: lib.commonOpts.options.jsonOutput,
76
78
  type: 'boolean',
77
79
  hidden: true,
78
80
  });
@@ -80,27 +82,27 @@ export function addJSONOutputOptions(yargs) {
80
82
  // Remove this once we've upgraded to yargs 18.0.0
81
83
  function uiBetaTagWithColor(message) {
82
84
  const terminalUISupport = getTerminalUISupport();
83
- const tag = i18n(`lib.ui.betaTagWithStyle`);
85
+ const tag = lib.ui.betaTagWithStyle;
84
86
  const result = `${terminalUISupport.color ? chalk.hex(UI_COLORS.SORBET)(tag) : tag} ${message}`;
85
87
  return result;
86
88
  }
87
89
  // Remove this once we've upgraded to yargs 18.0.0
88
90
  function uiDeprecatedTagWithColor(message) {
89
91
  const terminalUISupport = getTerminalUISupport();
90
- const tag = i18n(`lib.ui.deprecatedTagWithStyle`);
92
+ const tag = lib.ui.deprecatedTagWithStyle;
91
93
  const result = `${terminalUISupport.color ? chalk.yellow(tag) : tag} ${message}`;
92
94
  return result;
93
95
  }
94
96
  export async function addCustomHelpOutput(yargs, command, describe) {
95
97
  try {
96
98
  // Remove this once we've upgraded to yargs 18.0.0
97
- if (describe && describe.includes(i18n(`lib.ui.betaTag`))) {
98
- describe = describe.replace(i18n(`lib.ui.betaTag`) + ' ', '');
99
+ if (describe && describe.includes(lib.ui.betaTag)) {
100
+ describe = describe.replace(lib.ui.betaTag + ' ', '');
99
101
  describe = uiBetaTagWithColor(describe);
100
102
  }
101
103
  // Remove this once we've upgraded to yargs 18.0.0
102
- if (describe && describe.includes(i18n(`lib.ui.deprecatedTag`))) {
103
- describe = describe.replace(i18n(`lib.ui.deprecatedTag`) + ' ', '');
104
+ if (describe && describe.includes(lib.ui.deprecatedTag)) {
105
+ describe = describe.replace(lib.ui.deprecatedTag + ' ', '');
104
106
  describe = uiDeprecatedTagWithColor(describe);
105
107
  }
106
108
  const parsedArgv = yargsParser(process.argv.slice(2));
@@ -132,7 +134,7 @@ export async function addCustomHelpOutput(yargs, command, describe) {
132
134
  if (commandHelp.startsWith('\n')) {
133
135
  commandHelp = commandHelp.slice(1);
134
136
  }
135
- logger.log(`${uiCommandReference(fullCommand, false)}\n\n${describe ? `${describe}\n\n` : ''}${commandHelp}`);
137
+ uiLogger.log(`${uiCommandReference(fullCommand, false)}\n\n${describe ? `${describe}\n\n` : ''}${commandHelp}`);
136
138
  process.exit(EXIT_CODES.SUCCESS);
137
139
  }
138
140
  }
@@ -141,20 +143,21 @@ export async function addCustomHelpOutput(yargs, command, describe) {
141
143
  debugError(e);
142
144
  }
143
145
  }
144
- export function setLogLevel(options) {
146
+ export function setCLILogLevel(options) {
145
147
  const { debug, networkDebug, json } = options;
146
148
  if (json) {
147
- setLoggerLogLevel(LOG_LEVEL.ERROR);
149
+ setLogLevel(LOG_LEVEL.ERROR);
150
+ SpinniesManager.setDisableOutput(true);
148
151
  }
149
152
  else if (debug) {
150
- setLoggerLogLevel(LOG_LEVEL.DEBUG);
153
+ setLogLevel(LOG_LEVEL.DEBUG);
151
154
  }
152
155
  else {
153
- setLoggerLogLevel(LOG_LEVEL.LOG);
156
+ setLogLevel(LOG_LEVEL.LOG);
154
157
  }
155
158
  if (networkDebug) {
156
159
  process.env.HUBSPOT_NETWORK_LOGGING = 'true';
157
- setLoggerLogLevel(LOG_LEVEL.DEBUG);
160
+ setLogLevel(LOG_LEVEL.DEBUG);
158
161
  }
159
162
  }
160
163
  export function getCommandName(argv) {
@@ -79,6 +79,13 @@ async function enterTimeout() {
79
79
  message: lib.configOptions.setHttpTimeout.promptMessage,
80
80
  type: 'input',
81
81
  default: 30000,
82
+ validate: (timeout) => {
83
+ const timeoutNum = parseInt(timeout, 10);
84
+ if (isNaN(timeoutNum) || timeoutNum < 3000) {
85
+ return lib.configOptions.setHttpTimeout.error(timeout);
86
+ }
87
+ return true;
88
+ },
82
89
  },
83
90
  ]);
84
91
  return timeout;