@hubspot/cli 7.8.12-experimental.1 → 7.9.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 (272) hide show
  1. package/commands/__tests__/cms.test.js +44 -1
  2. package/commands/__tests__/customObject.test.js +22 -1
  3. package/commands/__tests__/project.test.js +2 -0
  4. package/commands/account/auth.js +1 -0
  5. package/commands/auth.js +1 -0
  6. package/commands/{__tests__/remove.test.js → cms/__tests__/delete.test.js} +8 -8
  7. package/commands/{__tests__ → cms/__tests__}/fetch.test.js +3 -3
  8. package/commands/{__tests__ → cms/__tests__}/function.test.js +7 -3
  9. package/commands/{__tests__ → cms/__tests__}/lint.test.js +3 -3
  10. package/commands/{__tests__ → cms/__tests__}/list.test.js +3 -3
  11. package/commands/{__tests__ → cms/__tests__}/mv.test.js +3 -3
  12. package/commands/{__tests__ → cms/__tests__}/theme.test.js +9 -2
  13. package/commands/cms/app/create.d.ts +9 -0
  14. package/commands/cms/app/create.js +82 -0
  15. package/commands/cms/app.d.ts +3 -0
  16. package/commands/cms/app.js +17 -0
  17. package/commands/cms/delete.d.ts +6 -0
  18. package/commands/cms/delete.js +43 -0
  19. package/commands/cms/fetch.d.ts +12 -0
  20. package/commands/cms/fetch.js +79 -0
  21. package/commands/{__tests__ → cms/function/__tests__}/logs.test.js +4 -5
  22. package/commands/cms/function/create.d.ts +12 -0
  23. package/commands/cms/function/create.js +84 -0
  24. package/commands/cms/function/deploy.d.ts +6 -0
  25. package/commands/cms/function/deploy.js +89 -0
  26. package/commands/cms/function/list.d.ts +6 -0
  27. package/commands/cms/function/list.js +60 -0
  28. package/commands/cms/function/logs.d.ts +10 -0
  29. package/commands/cms/function/logs.js +135 -0
  30. package/commands/cms/function/server.d.ts +10 -0
  31. package/commands/cms/function/server.js +69 -0
  32. package/commands/cms/function.d.ts +3 -0
  33. package/commands/cms/function.js +27 -0
  34. package/commands/cms/lint.d.ts +6 -0
  35. package/commands/cms/lint.js +83 -0
  36. package/commands/cms/list.d.ts +6 -0
  37. package/commands/cms/list.js +96 -0
  38. package/commands/cms/module/create.d.ts +11 -0
  39. package/commands/cms/module/create.js +84 -0
  40. package/commands/cms/module/marketplace-validate.d.ts +6 -0
  41. package/commands/cms/module/marketplace-validate.js +45 -0
  42. package/commands/cms/module.d.ts +3 -0
  43. package/commands/cms/module.js +17 -0
  44. package/commands/cms/mv.d.ts +7 -0
  45. package/commands/cms/mv.js +60 -0
  46. package/commands/cms/template/create.d.ts +9 -0
  47. package/commands/cms/template/create.js +72 -0
  48. package/commands/cms/template.d.ts +3 -0
  49. package/commands/cms/template.js +17 -0
  50. package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.js +2 -2
  51. package/commands/{theme → cms/theme}/__tests__/preview.test.js +2 -2
  52. package/commands/cms/theme/create.d.ts +6 -0
  53. package/commands/cms/theme/create.js +58 -0
  54. package/commands/cms/theme/generate-selectors.d.ts +6 -0
  55. package/commands/cms/theme/generate-selectors.js +171 -0
  56. package/commands/cms/theme/marketplace-validate.d.ts +6 -0
  57. package/commands/cms/theme/marketplace-validate.js +46 -0
  58. package/commands/cms/theme/preview.d.ts +12 -0
  59. package/commands/cms/theme/preview.js +224 -0
  60. package/commands/cms/theme.d.ts +3 -0
  61. package/commands/cms/theme.js +25 -0
  62. package/commands/cms/upload.d.ts +12 -0
  63. package/commands/cms/upload.js +212 -0
  64. package/commands/cms/watch.d.ts +14 -0
  65. package/commands/cms/watch.js +138 -0
  66. package/commands/cms/webpack/create.d.ts +6 -0
  67. package/commands/cms/webpack/create.js +58 -0
  68. package/commands/cms/webpack.d.ts +3 -0
  69. package/commands/cms/webpack.js +17 -0
  70. package/commands/cms.js +26 -0
  71. package/commands/create.js +4 -2
  72. package/commands/customObject/{schema/__tests__/create.test.js → __tests__/createSchema.test.js} +5 -5
  73. package/commands/customObject/{schema/__tests__/delete.test.js → __tests__/deleteSchema.test.js} +5 -5
  74. package/commands/customObject/{schema/__tests__/fetch-all.test.js → __tests__/fetch-all-schemas.test.js} +5 -5
  75. package/commands/customObject/{schema/__tests__/fetch.test.js → __tests__/fetchSchema.test.js} +5 -5
  76. package/commands/customObject/{schema/__tests__/list.test.js → __tests__/listSchemas.test.js} +5 -5
  77. package/commands/customObject/{schema/__tests__/update.test.js → __tests__/updateSchema.test.js} +5 -5
  78. package/commands/customObject/createSchema.d.ts +6 -0
  79. package/commands/customObject/createSchema.js +56 -0
  80. package/commands/customObject/deleteSchema.d.ts +7 -0
  81. package/commands/customObject/deleteSchema.js +69 -0
  82. package/commands/customObject/fetchAllSchemas.d.ts +6 -0
  83. package/commands/customObject/fetchAllSchemas.js +57 -0
  84. package/commands/customObject/fetchSchema.d.ts +7 -0
  85. package/commands/customObject/fetchSchema.js +67 -0
  86. package/commands/customObject/listSchemas.d.ts +4 -0
  87. package/commands/customObject/listSchemas.js +35 -0
  88. package/commands/customObject/schema/create.d.ts +4 -6
  89. package/commands/customObject/schema/create.js +13 -36
  90. package/commands/customObject/schema/delete.d.ts +4 -7
  91. package/commands/customObject/schema/delete.js +15 -50
  92. package/commands/customObject/schema/fetch-all.d.ts +4 -6
  93. package/commands/customObject/schema/fetch-all.js +14 -41
  94. package/commands/customObject/schema/fetch.d.ts +4 -7
  95. package/commands/customObject/schema/fetch.js +14 -49
  96. package/commands/customObject/schema/list.d.ts +4 -4
  97. package/commands/customObject/schema/list.js +10 -19
  98. package/commands/customObject/schema/update.d.ts +4 -7
  99. package/commands/customObject/schema/update.js +15 -50
  100. package/commands/customObject/schema.js +4 -2
  101. package/commands/customObject/updateSchema.d.ts +7 -0
  102. package/commands/customObject/updateSchema.js +71 -0
  103. package/commands/customObject.js +16 -1
  104. package/commands/feedback.js +1 -1
  105. package/commands/fetch.d.ts +4 -12
  106. package/commands/fetch.js +19 -46
  107. package/commands/function/deploy.d.ts +4 -6
  108. package/commands/function/deploy.js +14 -71
  109. package/commands/function/list.d.ts +4 -6
  110. package/commands/function/list.js +14 -40
  111. package/commands/function/server.d.ts +4 -10
  112. package/commands/function/server.js +22 -29
  113. package/commands/function.d.ts +2 -4
  114. package/commands/function.js +25 -14
  115. package/commands/lint.d.ts +4 -6
  116. package/commands/lint.js +13 -65
  117. package/commands/list.d.ts +4 -6
  118. package/commands/list.js +13 -74
  119. package/commands/logs.d.ts +4 -10
  120. package/commands/logs.js +24 -87
  121. package/commands/module/marketplace-validate.d.ts +4 -6
  122. package/commands/module/marketplace-validate.js +15 -27
  123. package/commands/module.d.ts +2 -2
  124. package/commands/module.js +17 -15
  125. package/commands/mv.d.ts +4 -7
  126. package/commands/mv.js +13 -39
  127. package/commands/project/__tests__/add.test.js +12 -12
  128. package/commands/project/__tests__/devUnifiedFlow.test.js +32 -0
  129. package/commands/project/__tests__/list.test.js +31 -0
  130. package/commands/project/__tests__/migrate.test.js +1 -0
  131. package/commands/project/add.d.ts +2 -2
  132. package/commands/project/add.js +3 -2
  133. package/commands/project/create.js +1 -1
  134. package/commands/project/dev/deprecatedFlow.js +2 -2
  135. package/commands/project/dev/index.js +5 -5
  136. package/commands/project/dev/unifiedFlow.js +8 -3
  137. package/commands/project/download.js +5 -2
  138. package/commands/project/installDeps.d.ts +2 -2
  139. package/commands/project/installDeps.js +1 -0
  140. package/commands/project/list.d.ts +4 -0
  141. package/commands/project/list.js +62 -0
  142. package/commands/project/migrate.js +5 -2
  143. package/commands/project.js +2 -0
  144. package/commands/remove.d.ts +4 -6
  145. package/commands/remove.js +12 -24
  146. package/commands/testAccount/create.js +2 -2
  147. package/commands/testAccount/delete.js +1 -1
  148. package/commands/theme/generate-selectors.d.ts +4 -6
  149. package/commands/theme/generate-selectors.js +14 -152
  150. package/commands/theme/marketplace-validate.d.ts +4 -6
  151. package/commands/theme/marketplace-validate.js +14 -25
  152. package/commands/theme/preview.d.ts +4 -12
  153. package/commands/theme/preview.js +18 -180
  154. package/commands/theme.d.ts +2 -2
  155. package/commands/theme.js +19 -13
  156. package/commands/upload.d.ts +4 -12
  157. package/commands/upload.js +19 -169
  158. package/commands/watch.d.ts +4 -14
  159. package/commands/watch.js +23 -88
  160. package/lang/en.d.ts +560 -425
  161. package/lang/en.js +562 -427
  162. package/lang/en.lyaml +2 -2
  163. package/lib/__tests__/buildAccount.test.js +2 -2
  164. package/lib/buildAccount.d.ts +2 -2
  165. package/lib/buildAccount.js +7 -7
  166. package/lib/configMigrate.js +88 -9
  167. package/lib/constants.d.ts +9 -0
  168. package/lib/constants.js +9 -0
  169. package/lib/generateSelectors.js +1 -1
  170. package/lib/middleware/autoUpdateMiddleware.d.ts +2 -1
  171. package/lib/middleware/autoUpdateMiddleware.js +12 -2
  172. package/lib/middleware/commandTargetingUtils.d.ts +1 -1
  173. package/lib/middleware/commandTargetingUtils.js +16 -20
  174. package/lib/projects/__tests__/AppDevModeInterface.test.js +95 -109
  175. package/lib/projects/__tests__/DevServerManager.test.js +183 -0
  176. package/lib/projects/__tests__/LocalDevProcess.test.js +6 -5
  177. package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +6 -6
  178. package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +1 -0
  179. package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +161 -0
  180. package/lib/projects/__tests__/deploy.test.js +9 -9
  181. package/lib/projects/__tests__/upload.test.js +2 -2
  182. package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +1 -0
  183. package/lib/projects/add/__tests__/{v3AddComponent.test.js → v2AddComponent.test.js} +35 -35
  184. package/lib/projects/add/{v3AddComponent.d.ts → v2AddComponent.d.ts} +1 -1
  185. package/lib/projects/add/{v3AddComponent.js → v2AddComponent.js} +5 -5
  186. package/lib/projects/create/__tests__/v2.test.d.ts +1 -0
  187. package/lib/projects/create/__tests__/{v3.test.js → v2.test.js} +2 -2
  188. package/lib/projects/create/index.js +2 -2
  189. package/lib/projects/create/{v3.d.ts → v2.d.ts} +3 -3
  190. package/lib/projects/create/{v3.js → v2.js} +3 -3
  191. package/lib/projects/deploy.d.ts +1 -1
  192. package/lib/projects/deploy.js +2 -2
  193. package/lib/projects/localDev/AppDevModeInterface.d.ts +9 -3
  194. package/lib/projects/localDev/AppDevModeInterface.js +116 -105
  195. package/lib/projects/localDev/DevServerManager.d.ts +10 -29
  196. package/lib/projects/localDev/DevServerManager.js +20 -76
  197. package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +40 -0
  198. package/lib/projects/localDev/DevServerManager_DEPRECATED.js +120 -0
  199. package/lib/projects/localDev/{LocalDevManager.js → LocalDevManager_DEPRECATED.js} +6 -6
  200. package/lib/projects/localDev/LocalDevProcess.js +3 -2
  201. package/lib/projects/localDev/LocalDevState.d.ts +3 -0
  202. package/lib/projects/localDev/LocalDevState.js +9 -0
  203. package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +4 -0
  204. package/lib/projects/localDev/LocalDevWebsocketServer.js +39 -6
  205. package/lib/projects/localDev/UIExtensionsDevModeInterface.d.ts +13 -0
  206. package/lib/projects/localDev/UIExtensionsDevModeInterface.js +37 -0
  207. package/lib/projects/localDev/helpers/account.d.ts +1 -1
  208. package/lib/projects/localDev/helpers/account.js +2 -2
  209. package/lib/projects/localDev/helpers/process.d.ts +1 -0
  210. package/lib/projects/localDev/helpers/process.js +15 -0
  211. package/lib/projects/localDev/helpers/project.js +2 -3
  212. package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +3 -0
  213. package/lib/projects/localDev/localDevWebsocketServerUtils.js +9 -0
  214. package/lib/projects/urls.d.ts +0 -1
  215. package/lib/projects/urls.js +0 -3
  216. package/lib/prompts/__tests__/projectAddPrompt.test.js +10 -10
  217. package/lib/prompts/installAppPrompt.d.ts +1 -6
  218. package/lib/prompts/installAppPrompt.js +1 -6
  219. package/lib/prompts/projectAddPrompt.d.ts +2 -2
  220. package/lib/prompts/projectAddPrompt.js +1 -1
  221. package/lib/theme/__tests__/migrate.test.js +4 -4
  222. package/lib/ui/index.d.ts +2 -0
  223. package/lib/ui/index.js +8 -0
  224. package/lib/ui/uiMessages.d.ts +5 -0
  225. package/lib/ui/uiMessages.js +5 -0
  226. package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
  227. package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +1 -1
  228. package/package.json +6 -5
  229. package/types/Cms.d.ts +6 -6
  230. package/lib/projects/localDev/DevServerManagerV2.d.ts +0 -22
  231. package/lib/projects/localDev/DevServerManagerV2.js +0 -81
  232. /package/commands/{customObject/schema → cms}/__tests__/delete.test.d.ts +0 -0
  233. /package/commands/{__tests__ → cms/__tests__}/fetch.test.d.ts +0 -0
  234. /package/commands/{__tests__ → cms/__tests__}/function.test.d.ts +0 -0
  235. /package/commands/{__tests__ → cms/__tests__}/lint.test.d.ts +0 -0
  236. /package/commands/{__tests__ → cms/__tests__}/list.test.d.ts +0 -0
  237. /package/commands/{__tests__ → cms/__tests__}/mv.test.d.ts +0 -0
  238. /package/commands/{__tests__ → cms/__tests__}/theme.test.d.ts +0 -0
  239. /package/commands/{__tests__ → cms/function/__tests__}/logs.test.d.ts +0 -0
  240. /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.d.ts +0 -0
  241. /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.js +0 -0
  242. /package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.d.ts +0 -0
  243. /package/commands/{theme → cms/theme}/__tests__/preview.test.d.ts +0 -0
  244. /package/commands/{__tests__/remove.test.d.ts → customObject/__tests__/createSchema.test.d.ts} +0 -0
  245. /package/commands/customObject/{schema/__tests__/create.test.d.ts → __tests__/deleteSchema.test.d.ts} +0 -0
  246. /package/commands/customObject/{schema/__tests__/fetch-all.test.d.ts → __tests__/fetch-all-schemas.test.d.ts} +0 -0
  247. /package/commands/customObject/{schema/__tests__/fetch.test.d.ts → __tests__/fetchSchema.test.d.ts} +0 -0
  248. /package/commands/customObject/{schema/__tests__/list.test.d.ts → __tests__/listSchemas.test.d.ts} +0 -0
  249. /package/commands/customObject/{schema/__tests__/update.test.d.ts → __tests__/updateSchema.test.d.ts} +0 -0
  250. /package/{lib/projects/add/__tests__/v3AddComponent.test.d.ts → commands/project/__tests__/list.test.d.ts} +0 -0
  251. /package/{commands/create → lib/cmsAssets}/api-sample.d.ts +0 -0
  252. /package/{commands/create → lib/cmsAssets}/api-sample.js +0 -0
  253. /package/{commands/create → lib/cmsAssets}/app.d.ts +0 -0
  254. /package/{commands/create → lib/cmsAssets}/app.js +0 -0
  255. /package/{commands/create → lib/cmsAssets}/function.d.ts +0 -0
  256. /package/{commands/create → lib/cmsAssets}/function.js +0 -0
  257. /package/{commands/create → lib/cmsAssets}/index.d.ts +0 -0
  258. /package/{commands/create → lib/cmsAssets}/index.js +0 -0
  259. /package/{commands/create → lib/cmsAssets}/module.d.ts +0 -0
  260. /package/{commands/create → lib/cmsAssets}/module.js +0 -0
  261. /package/{commands/create → lib/cmsAssets}/react-app.d.ts +0 -0
  262. /package/{commands/create → lib/cmsAssets}/react-app.js +0 -0
  263. /package/{commands/create → lib/cmsAssets}/template.d.ts +0 -0
  264. /package/{commands/create → lib/cmsAssets}/template.js +0 -0
  265. /package/{commands/create → lib/cmsAssets}/vue-app.d.ts +0 -0
  266. /package/{commands/create → lib/cmsAssets}/vue-app.js +0 -0
  267. /package/{commands/create → lib/cmsAssets}/webpack-serverless.d.ts +0 -0
  268. /package/{commands/create → lib/cmsAssets}/webpack-serverless.js +0 -0
  269. /package/{commands/create → lib/cmsAssets}/website-theme.d.ts +0 -0
  270. /package/{commands/create → lib/cmsAssets}/website-theme.js +0 -0
  271. /package/lib/projects/{create/__tests__/v3.test.d.ts → __tests__/DevServerManager.test.d.ts} +0 -0
  272. /package/lib/projects/localDev/{LocalDevManager.d.ts → LocalDevManager_DEPRECATED.d.ts} +0 -0
package/lang/en.lyaml CHANGED
@@ -2,7 +2,7 @@ en:
2
2
  commands:
3
3
  generalErrors:
4
4
  updateNotify:
5
- notifyTitle: "Update available"
5
+ notifyTitle: "CLI update available"
6
6
  cmsUpdateNotification: "{{#bold}}The CMS CLI is now the HubSpot CLI{{/bold}}\n\nTo upgrade, uninstall {{#bold}}{{ packageName }}{{/bold}}\nand then run {{ updateCommand }}"
7
7
  cliUpdateNotification: "HubSpot CLI version {{#cyan}}{{#bold}}{currentVersion}{{/bold}}{{/cyan}} is outdated.\nRun {{ updateCommand }} to upgrade to version {{#cyan}}{{#bold}}{latestVersion}{{/bold}}{{/cyan}}"
8
8
  srcIsProject: "\"{{ src }}\" is in a project folder. Did you mean \"hs project {{command}}\"?"
@@ -801,7 +801,7 @@ en:
801
801
  uploadFailed: "Failed to upload file \"{{ filePath }}\" to \"{{ remotePath }}\""
802
802
  deleteFileFailed: "Failed to delete file \"{{ remotePath }}\""
803
803
  deleteFolderFailed: "Failed to delete folder \"{{ remotePath }}\""
804
- v3ApiError: "{{ command }} is not supported for platform version '{{ platformVersion}}', use {{ newCommand }} instead to develop locally. {{ linkToDocs }}"
804
+ v2ApiError: "{{ command }} is not supported for platform version '{{ platformVersion}}', use {{ newCommand }} instead to develop locally. {{ linkToDocs }}"
805
805
  download:
806
806
  describe: "Download your project files from HubSpot."
807
807
  examples:
@@ -102,7 +102,7 @@ describe('lib/buildAccount', () => {
102
102
  expect(result).toBe('test-account-with-new-name');
103
103
  });
104
104
  });
105
- describe('createDeveloperTestAccountV3()', () => {
105
+ describe('createDeveloperTestAccountV2()', () => {
106
106
  const parentAccountId = 123456;
107
107
  const mockDeveoperTestAccountConfig = {
108
108
  accountName: 'Developer Test Account',
@@ -120,7 +120,7 @@ describe('lib/buildAccount', () => {
120
120
  });
121
121
  });
122
122
  it('should create a developer test account successfully', async () => {
123
- const result = await buildAccount.createDeveloperTestAccountV3(parentAccountId, mockDeveoperTestAccountConfig);
123
+ const result = await buildAccount.createDeveloperTestAccountV2(parentAccountId, mockDeveoperTestAccountConfig);
124
124
  expect(result).toEqual({
125
125
  accountName: mockDeveoperTestAccountConfig.accountName,
126
126
  accountId: 123456,
@@ -4,12 +4,12 @@ import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
4
4
  import { SandboxResponse, V2Sandbox } from '@hubspot/local-dev-lib/types/Sandbox';
5
5
  import { SandboxAccountType } from '../types/Sandboxes.js';
6
6
  export declare function saveAccountToConfig(accountId: number | undefined, accountName: string, env: Environment, personalAccessKey?: string, force?: boolean): Promise<string>;
7
- export declare function createDeveloperTestAccountV3(parentAccountId: number, testAccountConfig: DeveloperTestAccountConfig): Promise<{
7
+ export declare function createDeveloperTestAccountV2(parentAccountId: number, testAccountConfig: DeveloperTestAccountConfig): Promise<{
8
8
  accountName: string;
9
9
  accountId?: number;
10
10
  personalAccessKey?: string;
11
11
  }>;
12
- export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number, useV3?: boolean): Promise<number>;
12
+ export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number, useV2?: boolean): Promise<number>;
13
13
  type SandboxAccount = SandboxResponse & {
14
14
  name: string;
15
15
  };
@@ -52,7 +52,7 @@ export async function saveAccountToConfig(accountId, accountName, env, personalA
52
52
  uiLogger.log('');
53
53
  return validName;
54
54
  }
55
- export async function createDeveloperTestAccountV3(parentAccountId, testAccountConfig) {
55
+ export async function createDeveloperTestAccountV2(parentAccountId, testAccountConfig) {
56
56
  const result = {
57
57
  accountName: testAccountConfig.accountName,
58
58
  };
@@ -66,7 +66,7 @@ export async function createDeveloperTestAccountV3(parentAccountId, testAccountC
66
66
  }
67
67
  catch (err) {
68
68
  debugError(err);
69
- throw new Error(lib.buildAccount.createDeveloperTestAccountV3.syncFailure);
69
+ throw new Error(lib.buildAccount.createDeveloperTestAccountV2.syncFailure);
70
70
  }
71
71
  // HACK: The status endpoint sometimes returns an early success status.
72
72
  // Sleep for an extra 5 seconds to make sure the sync is actually complete.
@@ -78,11 +78,11 @@ export async function createDeveloperTestAccountV3(parentAccountId, testAccountC
78
78
  }
79
79
  catch (err) {
80
80
  debugError(err);
81
- throw new Error(lib.buildAccount.createDeveloperTestAccountV3.pakFailure);
81
+ throw new Error(lib.buildAccount.createDeveloperTestAccountV2.pakFailure);
82
82
  }
83
83
  return result;
84
84
  }
85
- export async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, env, portalLimit, useV3 = false) {
85
+ export async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, env, portalLimit, useV2 = false) {
86
86
  const id = getAccountIdentifier(parentAccountConfig);
87
87
  const parentAccountId = getAccountId(id);
88
88
  let testAccountConfig = {
@@ -91,7 +91,7 @@ export async function buildDeveloperTestAccount(testAccountName, parentAccountCo
91
91
  if (!parentAccountId) {
92
92
  throw new Error(lib.developerTestAccount.create.loading.fail(''));
93
93
  }
94
- if (useV3) {
94
+ if (useV2) {
95
95
  testAccountConfig = await createDeveloperTestAccountConfigPrompt({
96
96
  name: testAccountConfig.accountName,
97
97
  description: 'Test Account created by the HubSpot CLI',
@@ -107,8 +107,8 @@ export async function buildDeveloperTestAccount(testAccountName, parentAccountCo
107
107
  let developerTestAccountId;
108
108
  let developerTestAccountPersonalAccessKey;
109
109
  try {
110
- if (useV3) {
111
- const result = await createDeveloperTestAccountV3(parentAccountId, testAccountConfig);
110
+ if (useV2) {
111
+ const result = await createDeveloperTestAccountV2(parentAccountId, testAccountConfig);
112
112
  developerTestAccountId = result.accountId;
113
113
  developerTestAccountPersonalAccessKey = result.personalAccessKey;
114
114
  }
@@ -3,6 +3,37 @@ import { ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME } from '@hubspot/local-dev-lib/c
3
3
  import { promptUser } from './prompts/promptUtils.js';
4
4
  import { lib } from '../lang/en.js';
5
5
  import { uiLogger } from './ui/logger.js';
6
+ async function promptRenameOrOmitAccount(accountName, accountId) {
7
+ const { shouldRename } = await promptUser({
8
+ name: 'shouldRename',
9
+ type: 'confirm',
10
+ message: lib.configMigrate.handleAccountNameConflicts.prompts.renameOrOmitAccountPrompt(accountName, accountId),
11
+ });
12
+ return shouldRename;
13
+ }
14
+ async function promptNewAccountName(account, globalConfig, renamedAccounts) {
15
+ const { newAccountName } = await promptUser({
16
+ name: 'newAccountName',
17
+ type: 'input',
18
+ default: `${account.name}_${account.portalId}`,
19
+ message: lib.configMigrate.handleAccountNameConflicts.prompts.newAccountNamePrompt(account.name, account.portalId),
20
+ validate: value => {
21
+ if (!value) {
22
+ return lib.configMigrate.handleAccountNameConflicts.errors.nameRequired;
23
+ }
24
+ if (value === account.name) {
25
+ return lib.configMigrate.handleAccountNameConflicts.errors.sameName;
26
+ }
27
+ const existingAccount = globalConfig.accounts.some(acc => acc.name === value);
28
+ const renamedAccount = renamedAccounts.some(acc => acc.name === value);
29
+ if (existingAccount || renamedAccount) {
30
+ return lib.configMigrate.handleAccountNameConflicts.errors.nameAlreadyInConfig(value);
31
+ }
32
+ return true;
33
+ },
34
+ });
35
+ return newAccountName;
36
+ }
6
37
  export async function handleMigration(deprecatedConfigPath, hideWarning) {
7
38
  if (!hideWarning) {
8
39
  uiLogger.warn(lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || getConfigPath(undefined, false)));
@@ -47,20 +78,67 @@ async function handleMergeConfigProperties(globalConfig, deprecatedConfig, force
47
78
  }
48
79
  return initialConfig;
49
80
  }
81
+ async function handleAccountNameConflicts(globalConfig, deprecatedConfig, force) {
82
+ if (!deprecatedConfig.portals?.length || !globalConfig.accounts?.length) {
83
+ return deprecatedConfig;
84
+ }
85
+ const accountsWithConflictsToRemove = new Set();
86
+ const renamedAccounts = [];
87
+ const accountsNotYetInGlobal = deprecatedConfig.portals.filter(portal => portal.portalId &&
88
+ !globalConfig.accounts.some(acc => acc.accountId === portal.portalId));
89
+ const accountsWithConflicts = accountsNotYetInGlobal.filter(localAccount => globalConfig.accounts.some(globalAccount => globalAccount.name === localAccount.name));
90
+ if (accountsWithConflicts.length > 0) {
91
+ uiLogger.log('');
92
+ uiLogger.warn(lib.configMigrate.handleAccountNameConflicts.warnings.accountNameConflictMessage(accountsWithConflicts.length));
93
+ if (force) {
94
+ const renameDetails = [];
95
+ for (const account of accountsWithConflicts) {
96
+ accountsWithConflictsToRemove.add(account);
97
+ const newAccountName = `${account.name}_${account.portalId}`;
98
+ renamedAccounts.push({
99
+ ...account,
100
+ name: newAccountName,
101
+ });
102
+ renameDetails.push(` "${account.name}" → "${newAccountName}" (ID: ${account.portalId})`);
103
+ }
104
+ uiLogger.warn(lib.configMigrate.handleAccountNameConflicts.warnings.forceFlagDetected(accountsWithConflicts.length, renameDetails.join('\n')));
105
+ uiLogger.log('');
106
+ }
107
+ else {
108
+ for (const account of accountsWithConflicts) {
109
+ uiLogger.log('');
110
+ const shouldRename = await promptRenameOrOmitAccount(account.name, account.portalId);
111
+ accountsWithConflictsToRemove.add(account);
112
+ if (shouldRename) {
113
+ const newAccountName = await promptNewAccountName(account, globalConfig, renamedAccounts);
114
+ renamedAccounts.push({
115
+ ...account,
116
+ name: newAccountName,
117
+ });
118
+ }
119
+ }
120
+ }
121
+ deprecatedConfig.portals.push(...renamedAccounts);
122
+ }
123
+ const cleanedPortals = deprecatedConfig.portals.filter(portal => !accountsWithConflictsToRemove.has(portal));
124
+ return { ...deprecatedConfig, portals: cleanedPortals };
125
+ }
50
126
  export async function handleMerge(deprecatedConfigPath, force, hideWarning) {
51
127
  if (!hideWarning) {
52
128
  uiLogger.warn(lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || getConfigPath(undefined, false)));
53
129
  uiLogger.log('');
54
130
  }
55
131
  uiLogger.log(lib.configMigrate.handleMerge.description(ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME));
56
- uiLogger.log('');
57
- const { shouldMergeConfigs } = await promptUser({
58
- name: 'shouldMergeConfigs',
59
- type: 'confirm',
60
- message: lib.configMigrate.handleMerge.confirmPrompt,
61
- });
62
- if (!shouldMergeConfigs) {
63
- return false;
132
+ if (!force) {
133
+ uiLogger.log('');
134
+ const { shouldMergeConfigs } = await promptUser({
135
+ name: 'shouldMergeConfigs',
136
+ type: 'confirm',
137
+ message: lib.configMigrate.handleMerge.confirmPrompt,
138
+ });
139
+ if (shouldMergeConfigs === false) {
140
+ return true; // exit with "true" so the user is shown a success message instead of an error
141
+ }
64
142
  }
65
143
  const deprecatedConfig = getDeprecatedConfig(deprecatedConfigPath);
66
144
  const globalConfig = getGlobalConfig();
@@ -68,7 +146,8 @@ export async function handleMerge(deprecatedConfigPath, force, hideWarning) {
68
146
  return true;
69
147
  }
70
148
  const mergedConfig = await handleMergeConfigProperties(globalConfig, deprecatedConfig, force);
71
- const { skippedAccountIds } = mergeExistingConfigs(mergedConfig, deprecatedConfig);
149
+ const cleanedDeprecatedConfig = await handleAccountNameConflicts(mergedConfig, deprecatedConfig, force);
150
+ const { skippedAccountIds } = mergeExistingConfigs(mergedConfig, cleanedDeprecatedConfig);
72
151
  if (skippedAccountIds.length > 0) {
73
152
  uiLogger.log('');
74
153
  uiLogger.log(lib.configMigrate.handleMerge.skippedExistingAccounts(skippedAccountIds));
@@ -95,16 +95,21 @@ export declare const LOCAL_DEV_UI_MESSAGE_SEND_TYPES: {
95
95
  UPDATE_PROJECT_DATA: string;
96
96
  UPDATE_UPLOAD_WARNINGS: string;
97
97
  CLI_METADATA: string;
98
+ DEV_SERVERS_STARTED: string;
98
99
  };
99
100
  export declare const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES: {
100
101
  UPLOAD: string;
101
102
  DEPLOY: string;
102
103
  VIEWED_WELCOME_SCREEN: string;
104
+ APP_INSTALL_SUCCESS: string;
105
+ APP_INSTALL_INITIATED: string;
106
+ APP_INSTALL_FAILURE: string;
103
107
  };
104
108
  export declare const APP_INSTALLATION_STATES: {
105
109
  readonly NOT_INSTALLED: "NOT_INSTALLED";
106
110
  readonly INSTALLED: "INSTALLED";
107
111
  readonly INSTALLED_WITH_OUTDATED_SCOPES: "INSTALLED_WITH_OUTDATED_SCOPES";
112
+ readonly UNKNOWN: "UNKNOWN";
108
113
  };
109
114
  export declare const staticAuth = "static";
110
115
  export declare const oAuth = "oauth";
@@ -118,7 +123,11 @@ export declare const GET_STARTED_OPTIONS: {
118
123
  export declare const LOCAL_DEV_SERVER_MESSAGE_TYPES: {
119
124
  readonly INITIAL: "INITIAL";
120
125
  readonly WEBSOCKET_SERVER_CONNECTED: "WEBSOCKET_SERVER_CONNECTED";
126
+ readonly STATIC_AUTH_APP_INSTALL_SUCCESS: "APP_INSTALL_SUCCESS";
127
+ readonly STATIC_AUTH_APP_INSTALL_FAILURE: "APP_INSTALL_FAILURE";
128
+ readonly OAUTH_APP_INSTALL_INITIATED: "APP_INSTALL_INITIATED";
121
129
  };
130
+ export declare const LOCAL_DEV_WEBSOCKET_SERVER_INSTANCE_ID = "local-dev-ui-websocket-server";
122
131
  export declare const CONFIG_LOCAL_STATE_FLAGS: {
123
132
  readonly LOCAL_DEV_UI_WELCOME: "LOCAL_DEV_UI_WELCOME";
124
133
  };
package/lib/constants.js CHANGED
@@ -87,16 +87,21 @@ export const LOCAL_DEV_UI_MESSAGE_SEND_TYPES = {
87
87
  UPDATE_PROJECT_DATA: 'server:updateProjectData',
88
88
  UPDATE_UPLOAD_WARNINGS: 'server:updateUploadWarnings',
89
89
  CLI_METADATA: 'server:cliMetadata',
90
+ DEV_SERVERS_STARTED: 'server:devServersStarted',
90
91
  };
91
92
  export const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES = {
92
93
  UPLOAD: 'client:upload',
93
94
  DEPLOY: 'client:deploy',
94
95
  VIEWED_WELCOME_SCREEN: 'client:viewedWelcomeScreen',
96
+ APP_INSTALL_SUCCESS: 'client:installSuccess',
97
+ APP_INSTALL_INITIATED: 'client:installInitiated',
98
+ APP_INSTALL_FAILURE: 'client:installFailure',
95
99
  };
96
100
  export const APP_INSTALLATION_STATES = {
97
101
  NOT_INSTALLED: 'NOT_INSTALLED',
98
102
  INSTALLED: 'INSTALLED',
99
103
  INSTALLED_WITH_OUTDATED_SCOPES: 'INSTALLED_WITH_OUTDATED_SCOPES',
104
+ UNKNOWN: 'UNKNOWN',
100
105
  };
101
106
  export const staticAuth = 'static';
102
107
  export const oAuth = 'oauth';
@@ -110,7 +115,11 @@ export const GET_STARTED_OPTIONS = {
110
115
  export const LOCAL_DEV_SERVER_MESSAGE_TYPES = {
111
116
  INITIAL: 'INITIAL',
112
117
  WEBSOCKET_SERVER_CONNECTED: 'WEBSOCKET_SERVER_CONNECTED',
118
+ STATIC_AUTH_APP_INSTALL_SUCCESS: 'APP_INSTALL_SUCCESS',
119
+ STATIC_AUTH_APP_INSTALL_FAILURE: 'APP_INSTALL_FAILURE',
120
+ OAUTH_APP_INSTALL_INITIATED: 'APP_INSTALL_INITIATED',
113
121
  };
122
+ export const LOCAL_DEV_WEBSOCKET_SERVER_INSTANCE_ID = 'local-dev-ui-websocket-server';
114
123
  export const CONFIG_LOCAL_STATE_FLAGS = {
115
124
  LOCAL_DEV_UI_WELCOME: 'LOCAL_DEV_UI_WELCOME',
116
125
  };
@@ -11,7 +11,7 @@ export function getMaxFieldsDepth() {
11
11
  export function findFieldsJsonPath(basePath) {
12
12
  const _path = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath;
13
13
  if (!fs.existsSync(_path)) {
14
- uiLogger.error(commands.theme.subcommands.generateSelectors.errors.invalidPath(basePath));
14
+ uiLogger.error(commands.cms.subcommands.theme.subcommands.generateSelectors.errors.invalidPath(basePath));
15
15
  process.exit(EXIT_CODES.ERROR);
16
16
  }
17
17
  const files = fs.readdirSync(_path);
@@ -1 +1,2 @@
1
- export declare function autoUpdateCLI(): Promise<void>;
1
+ import { Arguments } from 'yargs';
2
+ export declare function autoUpdateCLI(argv: Arguments): Promise<void>;
@@ -7,6 +7,7 @@ import { lib } from '../../lang/en.js';
7
7
  import { DEFAULT_PACKAGE_MANAGER, isGloballyInstalled, executeInstall, } from '../npm.js';
8
8
  import { debugError } from '../errorHandlers/index.js';
9
9
  import { uiLogger } from '../ui/logger.js';
10
+ import { isTargetedCommand } from './commandTargetingUtils.js';
10
11
  // Default behavior is to check for notifications at most once per day
11
12
  // update-notifier stores the last checked date in the user's home directory
12
13
  const notifier = updateNotifier({
@@ -33,13 +34,22 @@ function updateNotification() {
33
34
  },
34
35
  });
35
36
  }
36
- export async function autoUpdateCLI() {
37
+ const SKIP_AUTO_UPDATE_COMMANDS = {
38
+ config: {
39
+ set: true,
40
+ },
41
+ };
42
+ const preventAutoUpdateForCommand = (commandParts) => {
43
+ return isTargetedCommand(commandParts, SKIP_AUTO_UPDATE_COMMANDS);
44
+ };
45
+ export async function autoUpdateCLI(argv) {
37
46
  // This lets us back to default update-notifier behavior
38
47
  let showManualInstallHelp = true;
39
48
  if (notifier &&
40
49
  notifier.update &&
41
50
  !process.env.SKIP_HUBSPOT_CLI_AUTO_UPDATES &&
42
- isConfigFlagEnabled('allowAutoUpdates')) {
51
+ isConfigFlagEnabled('allowAutoUpdates') &&
52
+ !preventAutoUpdateForCommand(argv._)) {
43
53
  // Ignore all update notifications if the current version is a pre-release
44
54
  if (!notifier.update.current.includes('-')) {
45
55
  // Attempt auto-update if the current version is not the latest version
@@ -3,6 +3,6 @@ type TargetCommandMap = {
3
3
  };
4
4
  export declare function isTargetedCommand(commandParts: (string | number)[], targetCommandMap: TargetCommandMap): boolean;
5
5
  export declare function shouldLoadConfigForCommand(commandParts: (string | number)[]): boolean;
6
- export declare function shouldRunAccountValidationForCommand(commandParts: (string | number)[]): boolean;
7
6
  export declare function shouldRunConfigValidationForCommand(commandParts: (string | number)[]): boolean;
7
+ export declare function shouldRunAccountValidationForCommand(commandParts: (string | number)[]): boolean;
8
8
  export {};
@@ -33,6 +33,19 @@ export function shouldLoadConfigForCommand(commandParts) {
33
33
  return (!isGlobalConfigMigration &&
34
34
  !isTargetedCommand(commandParts, SKIP_CONFIG_LOADING_COMMANDS));
35
35
  }
36
+ const SKIP_CONFIG_VALIDATION_COMMANDS = {
37
+ auth: true,
38
+ mcp: {
39
+ setup: true,
40
+ start: true,
41
+ },
42
+ };
43
+ // Returns true if the command requires a valid config file to be present
44
+ // Should only run if config has been loaded
45
+ export function shouldRunConfigValidationForCommand(commandParts) {
46
+ return (shouldLoadConfigForCommand(commandParts) &&
47
+ !isTargetedCommand(commandParts, SKIP_CONFIG_VALIDATION_COMMANDS));
48
+ }
36
49
  const accountsSubCommands = {
37
50
  auth: true,
38
51
  clean: true,
@@ -45,12 +58,6 @@ const sandboxesSubCommands = {
45
58
  delete: true,
46
59
  };
47
60
  const SKIP_ACCOUNT_VALIDATION_COMMANDS = {
48
- init: true,
49
- auth: true,
50
- mcp: {
51
- setup: true,
52
- start: true,
53
- },
54
61
  account: accountsSubCommands,
55
62
  accounts: accountsSubCommands,
56
63
  sandbox: sandboxesSubCommands,
@@ -58,21 +65,10 @@ const SKIP_ACCOUNT_VALIDATION_COMMANDS = {
58
65
  config: {
59
66
  migrate: true,
60
67
  },
61
- feedback: true,
62
68
  };
63
69
  // Returns true if the command requires a valid account to be set in the config
70
+ // Should only run if config has been loaded and validated
64
71
  export function shouldRunAccountValidationForCommand(commandParts) {
65
- return !isTargetedCommand(commandParts, SKIP_ACCOUNT_VALIDATION_COMMANDS);
66
- }
67
- const SKIP_CONFIG_VALIDATION_COMMANDS = {
68
- init: true,
69
- auth: true,
70
- mcp: {
71
- setup: true,
72
- start: true,
73
- },
74
- };
75
- // Returns true if the command requires a valid config file to be present
76
- export function shouldRunConfigValidationForCommand(commandParts) {
77
- return !isTargetedCommand(commandParts, SKIP_CONFIG_VALIDATION_COMMANDS);
72
+ return (shouldRunConfigValidationForCommand(commandParts) &&
73
+ !isTargetedCommand(commandParts, SKIP_ACCOUNT_VALIDATION_COMMANDS));
78
74
  }