@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
@@ -1,10 +1,9 @@
1
- import { logger } from '@hubspot/local-dev-lib/logger';
2
1
  import { loadConfig, getAccountId, configFileExists, getConfigPath, validateConfig, } from '@hubspot/local-dev-lib/config';
3
2
  import { validateAccount } from '../validation.js';
4
3
  import { EXIT_CODES } from '../enums/exitCodes.js';
5
- import { i18n } from '../lang.js';
4
+ import { commands } from '../../lang/en.js';
6
5
  import { uiDeprecatedTag } from '../ui/index.js';
7
- import { isTargetedCommand } from './utils.js';
6
+ import { isTargetedCommand, shouldLoadConfigForCommand, shouldRunAccountValidationForCommand, shouldRunConfigValidationForCommand, } from './commandTargetingUtils.js';
8
7
  import { parseStringToNumber } from '../parsing.js';
9
8
  import { uiLogger } from '../ui/logger.js';
10
9
  import { lib } from '../../lang/en.js';
@@ -14,9 +13,7 @@ export function handleDeprecatedEnvVariables(argv) {
14
13
  if (argv.useEnv &&
15
14
  process.env.HUBSPOT_PORTAL_ID &&
16
15
  !process.env.HUBSPOT_ACCOUNT_ID) {
17
- uiDeprecatedTag(i18n(`commands.generalErrors.handleDeprecatedEnvVariables.portalEnvVarDeprecated`, {
18
- configPath: getConfigPath(),
19
- }));
16
+ uiDeprecatedTag(commands.generalErrors.handleDeprecatedEnvVariables.portalEnvVarDeprecated);
20
17
  process.env.HUBSPOT_ACCOUNT_ID = process.env.HUBSPOT_PORTAL_ID;
21
18
  }
22
19
  }
@@ -39,99 +36,42 @@ export async function injectAccountIdMiddleware(argv) {
39
36
  argv.derivedAccountId = getAccountId(account);
40
37
  }
41
38
  }
42
- const SKIP_CONFIG_VALIDATION = {
43
- init: { target: true },
44
- auth: { target: true },
45
- mcp: {
46
- target: false,
47
- subCommands: {
48
- setup: { target: true },
49
- start: { target: true },
50
- },
51
- },
52
- };
53
- export async function loadConfigMiddleware(argv) {
39
+ export async function loadAndValidateConfigMiddleware(argv) {
54
40
  // Skip this when no command is provided
55
41
  if (!argv._.length || argv.help) {
56
42
  return;
57
43
  }
58
- const maybeValidateConfig = () => {
59
- if (!isTargetedCommand(argv._, SKIP_CONFIG_VALIDATION) &&
60
- !validateConfig()) {
61
- process.exit(EXIT_CODES.ERROR);
62
- }
63
- };
64
- if (!configFileExists(true) &&
65
- isTargetedCommand(argv._, {
66
- account: { target: false, subCommands: { auth: { target: true } } },
67
- config: { target: false, subCommands: { migrate: { target: true } } },
68
- })) {
44
+ // Do not load or validate the config for the commands that do not require it
45
+ if (!shouldLoadConfigForCommand(argv._)) {
69
46
  return;
70
47
  }
48
+ // If the config file exists and the --config flag is used, exit with an error
71
49
  if (configFileExists(true) &&
72
50
  argv.config &&
73
- !isTargetedCommand(argv._, {
74
- config: { target: false, subCommands: { migrate: { target: true } } },
75
- })) {
76
- logger.error(i18n(`commands.generalErrors.loadConfigMiddleware.configFileExists`, {
77
- configPath: getConfigPath(),
78
- }));
51
+ !isTargetedCommand(argv._, { config: { migrate: true } })) {
52
+ uiLogger.error(commands.generalErrors.loadConfigMiddleware.configFileExists(getConfigPath()));
53
+ process.exit(EXIT_CODES.ERROR);
54
+ }
55
+ const config = loadConfig(argv.config, argv);
56
+ // We don't run validation for auth because users should be able to run it when
57
+ // no accounts are configured, but we still want to exit if the config file is not found
58
+ if (isTargetedCommand(argv._, { auth: true }) && !config) {
79
59
  process.exit(EXIT_CODES.ERROR);
80
60
  }
81
- else if (!isTargetedCommand(argv._, { init: { target: true } })) {
82
- const config = loadConfig(argv.config, argv);
83
- // We don't run validateConfig() for auth because users should be able to run it when
84
- // no accounts are configured, but we still want to exit if the config file is not found
85
- if (isTargetedCommand(argv._, { auth: { target: true } }) && !config) {
61
+ // Only validate the config if the command requires it
62
+ if (shouldRunConfigValidationForCommand(argv._)) {
63
+ const configIsValid = validateConfig();
64
+ if (!configIsValid) {
86
65
  process.exit(EXIT_CODES.ERROR);
87
66
  }
88
67
  }
89
- maybeValidateConfig();
90
68
  }
91
- const accountsSubCommands = {
92
- target: false,
93
- subCommands: {
94
- auth: { target: true },
95
- clean: { target: true },
96
- list: { target: true },
97
- ls: { target: true },
98
- remove: { target: true },
99
- use: { target: true },
100
- },
101
- };
102
- const sandboxesSubCommands = {
103
- target: false,
104
- subCommands: {
105
- delete: { target: true },
106
- },
107
- };
108
- const configSubCommands = {
109
- target: false,
110
- subCommands: {
111
- migrate: { target: true },
112
- },
113
- };
114
- const SKIP_ACCOUNT_VALIDATION = {
115
- init: { target: true },
116
- auth: { target: true },
117
- mcp: {
118
- target: false,
119
- subCommands: {
120
- setup: { target: true },
121
- start: { target: true },
122
- },
123
- },
124
- account: accountsSubCommands,
125
- accounts: accountsSubCommands,
126
- sandbox: sandboxesSubCommands,
127
- sandboxes: sandboxesSubCommands,
128
- config: configSubCommands,
129
- };
130
69
  export async function validateAccountOptions(argv) {
131
70
  // Skip this when no command is provided
132
71
  if (argv._.length && !argv.help) {
133
72
  let validAccount = true;
134
- if (!isTargetedCommand(argv._, SKIP_ACCOUNT_VALIDATION)) {
73
+ // Only validate the account if the command requires it
74
+ if (shouldRunAccountValidationForCommand(argv._)) {
135
75
  validAccount = await validateAccount(argv);
136
76
  }
137
77
  if (!validAccount) {
@@ -3,6 +3,8 @@ import { fetchFireAlarms } from '@hubspot/local-dev-lib/api/fireAlarm';
3
3
  import { debugError } from '../errorHandlers/index.js';
4
4
  import pkg from '../../package.json' with { type: 'json' };
5
5
  import { logInBox } from '../ui/boxen.js';
6
+ import { renderInline } from '../../ui/index.js';
7
+ import { getWarningBox } from '../../ui/components/StatusMessageBoxes.js';
6
8
  /*
7
9
  * Versions can be formatted like this:
8
10
  * =7.2.2 -> targets the exact version 7.2.2
@@ -98,12 +100,20 @@ async function logFireAlarms(accountId, command, version) {
98
100
  }
99
101
  return acc;
100
102
  }, '');
101
- await logInBox({
102
- contents: notifications,
103
- options: {
103
+ if (!process.env.HUBSPOT_ENABLE_INK) {
104
+ await logInBox({
105
+ contents: notifications,
106
+ options: {
107
+ title: 'Notifications',
108
+ },
109
+ });
110
+ }
111
+ else {
112
+ await renderInline(getWarningBox({
104
113
  title: 'Notifications',
105
- },
106
- });
114
+ message: notifications,
115
+ }));
116
+ }
107
117
  }
108
118
  }
109
119
  export async function checkFireAlarms(argv) {
@@ -1,8 +1,12 @@
1
- import { getConfigPath } from '@hubspot/local-dev-lib/config';
1
+ import { getConfigPath, configFileExists } from '@hubspot/local-dev-lib/config';
2
2
  import { checkAndWarnGitInclusion } from '../ui/git.js';
3
3
  export function checkAndWarnGitInclusionMiddleware(argv) {
4
4
  // Skip this when no command is provided
5
5
  if (argv._.length) {
6
+ // Skip if using global config
7
+ if (configFileExists(true)) {
8
+ return;
9
+ }
6
10
  const configPath = getConfigPath();
7
11
  if (configPath) {
8
12
  checkAndWarnGitInclusion(configPath);
@@ -1,8 +1,7 @@
1
1
  import updateNotifier from 'update-notifier';
2
- import chalk from 'chalk';
3
2
  import pkg from '../../package.json' with { type: 'json' };
4
- import { UI_COLORS, uiCommandReference } from '../ui/index.js';
5
- import { i18n } from '../lang.js';
3
+ import { UI_COLORS } from '../ui/index.js';
4
+ import { lib } from '../../lang/en.js';
6
5
  const notifier = updateNotifier({
7
6
  pkg: { ...pkg, name: '@hubspot/cli' },
8
7
  distTag: 'latest',
@@ -12,13 +11,8 @@ const CMS_CLI_PACKAGE_NAME = '@hubspot/cms-cli';
12
11
  export function notifyAboutUpdates() {
13
12
  notifier.notify({
14
13
  message: pkg.name === CMS_CLI_PACKAGE_NAME
15
- ? i18n(`commands.generalErrors.updateNotify.cmsUpdateNotification`, {
16
- packageName: CMS_CLI_PACKAGE_NAME,
17
- updateCommand: uiCommandReference('{updateCommand}'),
18
- })
19
- : i18n(`commands.generalErrors.updateNotify.cliUpdateNotification`, {
20
- updateCommand: uiCommandReference('{updateCommand}'),
21
- }),
14
+ ? lib.middleware.updateNotification.cmsUpdateNotification(CMS_CLI_PACKAGE_NAME)
15
+ : lib.middleware.updateNotification.cliUpdateNotification,
22
16
  defer: false,
23
17
  boxenOptions: {
24
18
  borderColor: UI_COLORS.MARIGOLD_DARK,
@@ -28,7 +22,7 @@ export function notifyAboutUpdates() {
28
22
  borderStyle: 'round',
29
23
  title: pkg.name === CMS_CLI_PACKAGE_NAME
30
24
  ? undefined
31
- : chalk.bold(i18n(`commands.generalErrors.updateNotify.notifyTitle`)),
25
+ : lib.middleware.updateNotification.notifyTitle,
32
26
  },
33
27
  });
34
28
  }
@@ -1,20 +1,17 @@
1
- import { logger } from '@hubspot/local-dev-lib/logger';
1
+ import { uiLogger } from '../ui/logger.js';
2
2
  import { EXIT_CODES } from '../enums/exitCodes.js';
3
- import { i18n } from '../lang.js';
3
+ import { commands } from '../../lang/en.js';
4
4
  import { getIsInProject } from '../projects/config.js';
5
- import { isTargetedCommand } from './utils.js';
5
+ import { isTargetedCommand } from './commandTargetingUtils.js';
6
6
  const UPLOAD_AND_WATCH_COMMANDS = {
7
- upload: { target: true },
8
- watch: { target: true },
7
+ upload: true,
8
+ watch: true,
9
9
  };
10
10
  export function performChecks(argv) {
11
11
  // Require "project" command when running upload/watch inside of a project
12
12
  if (isTargetedCommand(argv._, UPLOAD_AND_WATCH_COMMANDS) &&
13
13
  getIsInProject(argv.src)) {
14
- logger.error(i18n(`commands.generalErrors.srcIsProject`, {
15
- src: argv.src || './',
16
- command: argv._.join(' '),
17
- }));
14
+ uiLogger.error(commands.generalErrors.srcIsProject(argv.src || './', argv._.join(' ')));
18
15
  process.exit(EXIT_CODES.ERROR);
19
16
  }
20
17
  return true;
package/lib/npm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { exec as execAsync } from 'node:child_process';
2
2
  import util from 'util';
3
- import { logger } from '@hubspot/local-dev-lib/logger';
3
+ import { uiLogger } from './ui/logger.js';
4
4
  import pkg from '../package.json' with { type: 'json' };
5
5
  export const DEFAULT_PACKAGE_MANAGER = 'npm';
6
6
  export async function isGloballyInstalled(packageName) {
@@ -21,7 +21,7 @@ export async function getLatestCliVersion() {
21
21
  }
22
22
  export async function executeInstall(packages = [], flags, options) {
23
23
  const installCommand = `${DEFAULT_PACKAGE_MANAGER} install${flags ? ` ${flags}` : ''} ${packages.join(' ')}`;
24
- logger.debug('Running ', installCommand);
24
+ uiLogger.debug('Running', installCommand);
25
25
  const exec = util.promisify(execAsync);
26
26
  await exec(installCommand, options);
27
27
  }
package/lib/oauth.js CHANGED
@@ -5,11 +5,11 @@ import { getAccountConfig } from '@hubspot/local-dev-lib/config';
5
5
  import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
6
6
  import { addOauthToAccountConfig } from '@hubspot/local-dev-lib/oauth';
7
7
  import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
8
- import { logger } from '@hubspot/local-dev-lib/logger';
8
+ import { uiLogger } from './ui/logger.js';
9
9
  import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
10
10
  import { DEFAULT_OAUTH_SCOPES } from '@hubspot/local-dev-lib/constants/auth';
11
11
  import { handleExit } from './process.js';
12
- import { i18n } from './lang.js';
12
+ import { lib } from '../lang/en.js';
13
13
  import { EXIT_CODES } from './enums/exitCodes.js';
14
14
  const PORT = 3000;
15
15
  const redirectUri = `http://localhost:${PORT}/oauth-callback`;
@@ -18,7 +18,7 @@ function buildAuthUrl(oauthManager) {
18
18
  const env = accountEnv || ENVIRONMENTS.PROD;
19
19
  const scopes = accountScopes || DEFAULT_OAUTH_SCOPES;
20
20
  if (!clientId) {
21
- logger.error(i18n(`lib.oauth.missingClientId`));
21
+ uiLogger.error(lib.oauth.missingClientId);
22
22
  process.exit(EXIT_CODES.ERROR);
23
23
  }
24
24
  return (`${getHubSpotWebsiteOrigin(env)}/oauth/${oauthManager.account.accountId}/authorize` +
@@ -77,7 +77,7 @@ async function authorize(oauthManager) {
77
77
  reject();
78
78
  }
79
79
  });
80
- server = app.listen(PORT, () => logger.log(`Waiting for authorization...`));
80
+ server = app.listen(PORT, () => uiLogger.log(`Waiting for authorization...`));
81
81
  handleServerOnProcessEnd(server);
82
82
  });
83
83
  }
@@ -91,7 +91,7 @@ function setupOauth(accountConfig) {
91
91
  }
92
92
  export async function authenticateWithOauth(accountConfig) {
93
93
  const oauthManager = setupOauth(accountConfig);
94
- logger.log('Authorizing');
94
+ uiLogger.log('Authorizing');
95
95
  await authorize(oauthManager);
96
96
  addOauthToAccountConfig(oauthManager);
97
97
  }
package/lib/process.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import readline from 'readline';
2
- import { logger, setLogLevel, LOG_LEVEL } from '@hubspot/local-dev-lib/logger';
3
- import { i18n } from './lang.js';
2
+ import { setLogLevel, LOG_LEVEL } from '@hubspot/local-dev-lib/logger';
3
+ import { uiLogger } from './ui/logger.js';
4
+ import { lib } from '../lang/en.js';
4
5
  import { logError } from './errorHandlers/index.js';
5
6
  const SIGHUP = 'SIGHUP';
6
7
  const uncaughtException = 'uncaughtException';
@@ -26,13 +27,13 @@ export function handleExit(callback) {
26
27
  if (isSIGHUP) {
27
28
  setLogLevel(LOG_LEVEL.NONE);
28
29
  }
29
- logger.debug(i18n(`lib.process.exitDebug`, { signal }));
30
+ uiLogger.debug(lib.process.exitDebug(signal));
30
31
  if (signal === uncaughtException && args && args.length > 0) {
31
32
  try {
32
33
  logError(args[0]);
33
34
  }
34
35
  catch (e) {
35
- logger.error(args[0]);
36
+ uiLogger.error(String(args[0]));
36
37
  }
37
38
  }
38
39
  await callback({ isSIGHUP });
@@ -67,6 +67,8 @@ describe('AppDevModeInterface', () => {
67
67
  componentRoot: '/test/path',
68
68
  componentConfigPath: '/test/path/config.json',
69
69
  configUpdatedSinceLastUpload: false,
70
+ removed: false,
71
+ parsingErrors: [],
70
72
  },
71
73
  componentDeps: {},
72
74
  metaFilePath: '/test/path',