@hubspot/cli 7.5.11-experimental.0 → 7.7.0-experimental.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 (289) hide show
  1. package/bin/cli.js +5 -6
  2. package/bin/hsmcp.d.ts +2 -0
  3. package/bin/hsmcp.js +13 -0
  4. package/commands/account/auth.d.ts +3 -7
  5. package/commands/account/auth.js +19 -9
  6. package/commands/account/clean.d.ts +3 -7
  7. package/commands/account/clean.js +16 -9
  8. package/commands/account/createOverride.d.ts +3 -7
  9. package/commands/account/createOverride.js +23 -6
  10. package/commands/account/info.d.ts +3 -7
  11. package/commands/account/info.js +13 -5
  12. package/commands/account/list.d.ts +3 -7
  13. package/commands/account/list.js +15 -8
  14. package/commands/account/remove.d.ts +3 -7
  15. package/commands/account/remove.js +21 -9
  16. package/commands/account/removeOverride.d.ts +3 -7
  17. package/commands/account/removeOverride.js +23 -6
  18. package/commands/account/rename.d.ts +3 -7
  19. package/commands/account/rename.js +16 -9
  20. package/commands/account/use.d.ts +5 -9
  21. package/commands/account/use.js +14 -6
  22. package/commands/account.d.ts +3 -4
  23. package/commands/account.js +35 -58
  24. package/commands/app/migrate.d.ts +1 -2
  25. package/commands/app/migrate.js +7 -8
  26. package/commands/app/secret/add.d.ts +7 -0
  27. package/commands/app/secret/add.js +64 -0
  28. package/commands/app/secret/delete.d.ts +8 -0
  29. package/commands/app/secret/delete.js +87 -0
  30. package/commands/app/secret/list.d.ts +6 -0
  31. package/commands/app/secret/list.js +64 -0
  32. package/commands/app/secret/update.d.ts +7 -0
  33. package/commands/app/secret/update.js +77 -0
  34. package/commands/app/secret.d.ts +3 -0
  35. package/commands/app/secret.js +30 -0
  36. package/commands/app.d.ts +2 -5
  37. package/commands/app.js +12 -8
  38. package/commands/auth.d.ts +3 -7
  39. package/commands/auth.js +12 -5
  40. package/commands/cms/convertFields.d.ts +7 -1
  41. package/commands/cms/convertFields.js +57 -41
  42. package/commands/cms/getReactModule.d.ts +7 -1
  43. package/commands/cms/getReactModule.js +52 -34
  44. package/commands/cms/lighthouseScore.d.ts +8 -1
  45. package/commands/cms/lighthouseScore.js +129 -100
  46. package/commands/cms.d.ts +3 -1
  47. package/commands/cms.js +24 -15
  48. package/commands/completion.d.ts +3 -1
  49. package/commands/completion.js +25 -12
  50. package/commands/config/migrate.d.ts +3 -7
  51. package/commands/config/migrate.js +25 -15
  52. package/commands/config/set.d.ts +5 -6
  53. package/commands/config/set.js +38 -14
  54. package/commands/config.d.ts +3 -4
  55. package/commands/config.js +20 -44
  56. package/commands/create/api-sample.d.ts +3 -1
  57. package/commands/create/api-sample.js +34 -38
  58. package/commands/create/app.d.ts +3 -1
  59. package/commands/create/app.js +9 -7
  60. package/commands/create/function.d.ts +3 -1
  61. package/commands/create/function.js +11 -10
  62. package/commands/create/index.d.ts +5 -1
  63. package/commands/create/index.js +23 -11
  64. package/commands/create/module.d.ts +3 -1
  65. package/commands/create/module.js +14 -13
  66. package/commands/create/react-app.d.ts +3 -1
  67. package/commands/create/react-app.js +10 -7
  68. package/commands/create/template.d.ts +3 -1
  69. package/commands/create/template.js +14 -14
  70. package/commands/create/vue-app.d.ts +3 -1
  71. package/commands/create/vue-app.js +10 -7
  72. package/commands/create/webpack-serverless.d.ts +3 -1
  73. package/commands/create/webpack-serverless.js +10 -7
  74. package/commands/create/website-theme.d.ts +3 -1
  75. package/commands/create/website-theme.js +10 -9
  76. package/commands/create.d.ts +4 -24
  77. package/commands/create.js +64 -74
  78. package/commands/customObject/create.d.ts +4 -9
  79. package/commands/customObject/create.js +17 -10
  80. package/commands/customObject/schema/create.d.ts +4 -9
  81. package/commands/customObject/schema/create.js +18 -11
  82. package/commands/customObject/schema/delete.d.ts +4 -9
  83. package/commands/customObject/schema/delete.js +17 -10
  84. package/commands/customObject/schema/fetch-all.d.ts +4 -9
  85. package/commands/customObject/schema/fetch-all.js +17 -10
  86. package/commands/customObject/schema/fetch.d.ts +4 -9
  87. package/commands/customObject/schema/fetch.js +17 -10
  88. package/commands/customObject/schema/list.d.ts +4 -8
  89. package/commands/customObject/schema/list.js +17 -10
  90. package/commands/customObject/schema/update.d.ts +4 -9
  91. package/commands/customObject/schema/update.js +18 -11
  92. package/commands/customObject/schema.d.ts +3 -5
  93. package/commands/customObject/schema.js +27 -54
  94. package/commands/customObject.d.ts +3 -4
  95. package/commands/customObject.js +20 -45
  96. package/commands/doctor.d.ts +6 -8
  97. package/commands/doctor.js +32 -21
  98. package/commands/feedback.d.ts +4 -1
  99. package/commands/feedback.js +40 -47
  100. package/commands/fetch.d.ts +12 -1
  101. package/commands/fetch.js +49 -33
  102. package/commands/filemanager/fetch.d.ts +4 -9
  103. package/commands/filemanager/fetch.js +18 -11
  104. package/commands/filemanager/upload.d.ts +4 -9
  105. package/commands/filemanager/upload.js +17 -11
  106. package/commands/filemanager.d.ts +3 -4
  107. package/commands/filemanager.js +20 -41
  108. package/commands/function/deploy.d.ts +6 -1
  109. package/commands/function/deploy.js +70 -50
  110. package/commands/function/list.d.ts +6 -1
  111. package/commands/function/list.js +44 -32
  112. package/commands/function/server.d.ts +10 -1
  113. package/commands/function/server.js +49 -38
  114. package/commands/function.d.ts +5 -1
  115. package/commands/function.js +24 -10
  116. package/commands/hubdb/clear.d.ts +4 -9
  117. package/commands/hubdb/clear.js +17 -10
  118. package/commands/hubdb/create.d.ts +4 -9
  119. package/commands/hubdb/create.js +17 -10
  120. package/commands/hubdb/delete.d.ts +4 -9
  121. package/commands/hubdb/delete.js +17 -10
  122. package/commands/hubdb/fetch.d.ts +4 -9
  123. package/commands/hubdb/fetch.js +17 -10
  124. package/commands/hubdb.d.ts +3 -2
  125. package/commands/hubdb.js +23 -45
  126. package/commands/init.d.ts +3 -7
  127. package/commands/init.js +12 -5
  128. package/commands/lint.d.ts +6 -4
  129. package/commands/lint.js +44 -43
  130. package/commands/list.d.ts +3 -7
  131. package/commands/list.js +19 -11
  132. package/commands/logs.d.ts +10 -1
  133. package/commands/logs.js +53 -44
  134. package/commands/module/marketplace-validate.d.ts +6 -1
  135. package/commands/module/marketplace-validate.js +39 -27
  136. package/commands/module.d.ts +3 -1
  137. package/commands/module.js +22 -10
  138. package/commands/mv.d.ts +3 -7
  139. package/commands/mv.js +19 -11
  140. package/commands/open.d.ts +3 -7
  141. package/commands/open.js +19 -11
  142. package/commands/project/cloneApp.d.ts +1 -1
  143. package/commands/project/cloneApp.js +2 -2
  144. package/commands/project/create.js +3 -3
  145. package/commands/project/deploy.d.ts +1 -0
  146. package/commands/project/deploy.js +40 -12
  147. package/commands/project/dev/index.d.ts +1 -4
  148. package/commands/project/dev/index.js +48 -16
  149. package/commands/project/dev/unifiedFlow.d.ts +2 -1
  150. package/commands/project/dev/unifiedFlow.js +85 -30
  151. package/commands/project/migrate.d.ts +1 -0
  152. package/commands/project/profile/add.d.ts +7 -0
  153. package/commands/project/profile/add.js +209 -0
  154. package/commands/project/profile/delete.d.ts +6 -0
  155. package/commands/project/profile/delete.js +123 -0
  156. package/commands/project/profile.d.ts +3 -0
  157. package/commands/project/profile.js +25 -0
  158. package/commands/project/upload.d.ts +1 -0
  159. package/commands/project/upload.js +38 -8
  160. package/commands/project/validate.d.ts +4 -0
  161. package/commands/project/validate.js +53 -0
  162. package/commands/project.js +4 -0
  163. package/commands/remove.d.ts +3 -7
  164. package/commands/remove.js +19 -11
  165. package/commands/sandbox/create.d.ts +4 -9
  166. package/commands/sandbox/create.js +18 -11
  167. package/commands/sandbox/delete.d.ts +4 -9
  168. package/commands/sandbox/delete.js +18 -11
  169. package/commands/sandbox.d.ts +3 -4
  170. package/commands/sandbox.js +20 -43
  171. package/commands/secret/addSecret.d.ts +4 -9
  172. package/commands/secret/addSecret.js +17 -10
  173. package/commands/secret/deleteSecret.d.ts +4 -9
  174. package/commands/secret/deleteSecret.js +17 -10
  175. package/commands/secret/listSecret.d.ts +4 -9
  176. package/commands/secret/listSecret.js +17 -10
  177. package/commands/secret/updateSecret.d.ts +4 -9
  178. package/commands/secret/updateSecret.js +17 -10
  179. package/commands/secret.d.ts +3 -4
  180. package/commands/secret.js +25 -48
  181. package/commands/setupMcp.d.ts +8 -0
  182. package/commands/setupMcp.js +229 -0
  183. package/commands/theme/generate-selectors.d.ts +3 -7
  184. package/commands/theme/generate-selectors.js +14 -6
  185. package/commands/theme/marketplace-validate.d.ts +4 -9
  186. package/commands/theme/marketplace-validate.js +17 -10
  187. package/commands/theme/preview.d.ts +4 -9
  188. package/commands/theme/preview.js +16 -9
  189. package/commands/theme.d.ts +3 -4
  190. package/commands/theme.js +23 -46
  191. package/commands/upload.d.ts +12 -1
  192. package/commands/upload.js +118 -97
  193. package/commands/watch.d.ts +14 -1
  194. package/commands/watch.js +76 -65
  195. package/lang/en.d.ts +838 -574
  196. package/lang/en.js +630 -373
  197. package/lang/en.lyaml +30 -23
  198. package/lib/accountTypes.js +2 -1
  199. package/lib/app/migrate.d.ts +23 -0
  200. package/lib/app/migrate.js +14 -3
  201. package/lib/app/migrate_legacy.js +7 -7
  202. package/lib/app/urls.d.ts +16 -0
  203. package/lib/app/urls.js +16 -0
  204. package/lib/configMigrate.js +24 -10
  205. package/lib/configOptions.d.ts +4 -0
  206. package/lib/configOptions.js +41 -46
  207. package/lib/constants.d.ts +6 -0
  208. package/lib/constants.js +7 -1
  209. package/lib/dependencyManagement.d.ts +0 -5
  210. package/lib/dependencyManagement.js +13 -39
  211. package/lib/doctor/Doctor.js +2 -1
  212. package/lib/filesystem.d.ts +1 -1
  213. package/lib/interpolation.d.ts +2 -3
  214. package/lib/lang.d.ts +2 -3
  215. package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
  216. package/lib/middleware/autoUpdateMiddleware.js +89 -0
  217. package/lib/middleware/configMiddleware.js +8 -0
  218. package/lib/npm.d.ts +9 -0
  219. package/lib/npm.js +36 -0
  220. package/lib/projectProfiles.d.ts +6 -0
  221. package/lib/projectProfiles.js +65 -0
  222. package/lib/projects/buildAndDeploy.js +17 -2
  223. package/lib/projects/localDev/AppDevModeInterface.d.ts +26 -0
  224. package/lib/projects/localDev/AppDevModeInterface.js +156 -0
  225. package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
  226. package/lib/projects/localDev/DevServerManagerV2.js +19 -15
  227. package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
  228. package/lib/projects/localDev/LocalDevLogger.js +158 -0
  229. package/lib/projects/localDev/LocalDevManager.js +12 -5
  230. package/lib/projects/localDev/LocalDevProcess.d.ts +27 -0
  231. package/lib/projects/localDev/LocalDevProcess.js +171 -0
  232. package/lib/projects/localDev/LocalDevState.d.ts +37 -0
  233. package/lib/projects/localDev/LocalDevState.js +78 -0
  234. package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
  235. package/lib/projects/localDev/LocalDevWatcher.js +56 -0
  236. package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +17 -0
  237. package/lib/projects/localDev/LocalDevWebsocketServer.js +92 -0
  238. package/lib/projects/localDev/helpers.d.ts +3 -2
  239. package/lib/projects/localDev/helpers.js +32 -2
  240. package/lib/projects/upload.d.ts +2 -1
  241. package/lib/projects/upload.js +2 -2
  242. package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
  243. package/lib/prompts/createTemplatePrompt.d.ts +22 -4
  244. package/lib/prompts/installAppPrompt.d.ts +1 -0
  245. package/lib/prompts/installAppPrompt.js +35 -0
  246. package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
  247. package/lib/prompts/projectDevTargetAccountPrompt.js +6 -6
  248. package/lib/prompts/promptUtils.d.ts +2 -1
  249. package/lib/prompts/promptUtils.js +2 -1
  250. package/lib/prompts/selectAppPrompt.d.ts +2 -0
  251. package/lib/prompts/selectAppPrompt.js +40 -0
  252. package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
  253. package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -8
  254. package/lib/testUtils.d.ts +3 -3
  255. package/lib/testUtils.js +8 -9
  256. package/lib/ui/index.js +4 -1
  257. package/lib/upload.d.ts +1 -1
  258. package/lib/validation.js +4 -5
  259. package/lib/yargsUtils.d.ts +4 -0
  260. package/lib/yargsUtils.js +6 -0
  261. package/mcp-server/index.d.ts +1 -0
  262. package/mcp-server/index.js +17 -0
  263. package/mcp-server/mcpLoader.d.ts +5 -0
  264. package/mcp-server/mcpLoader.js +24 -0
  265. package/mcp-server/tools/ExplainProjectStructureTool.d.ts +33 -0
  266. package/mcp-server/tools/ExplainProjectStructureTool.js +266 -0
  267. package/mcp-server/tools/GenerateAppComponentTool.d.ts +99 -0
  268. package/mcp-server/tools/GenerateAppComponentTool.js +193 -0
  269. package/mcp-server/tools/GenerateCardComponentTool.d.ts +74 -0
  270. package/mcp-server/tools/GenerateCardComponentTool.js +146 -0
  271. package/mcp-server/tools/GenerateProjectConfigTool.d.ts +32 -0
  272. package/mcp-server/tools/GenerateProjectConfigTool.js +40 -0
  273. package/mcp-server/tools/HubSpotCLIHelper.d.ts +16 -0
  274. package/mcp-server/tools/HubSpotCLIHelper.js +74 -0
  275. package/mcp-server/tools/UploadProjectTool.d.ts +44 -0
  276. package/mcp-server/tools/UploadProjectTool.js +149 -0
  277. package/mcp-server/tools/ValidateProjectTool.d.ts +62 -0
  278. package/mcp-server/tools/ValidateProjectTool.js +315 -0
  279. package/package.json +13 -6
  280. package/types/Cms.d.ts +30 -0
  281. package/types/Cms.js +2 -0
  282. package/types/LocalDev.d.ts +24 -0
  283. package/types/LocalDev.js +2 -0
  284. package/types/Prompts.d.ts +0 -7
  285. package/types/Yargs.d.ts +8 -1
  286. package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
  287. package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
  288. package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
  289. package/lib/prompts/installPublicAppPrompt.js +0 -41
@@ -3,23 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isGloballyInstalled = isGloballyInstalled;
7
- exports.getLatestCliVersion = getLatestCliVersion;
8
6
  exports.installPackages = installPackages;
9
7
  exports.getProjectPackageJsonLocations = getProjectPackageJsonLocations;
10
8
  exports.hasMissingPackages = hasMissingPackages;
11
- const logger_1 = require("@hubspot/local-dev-lib/logger");
12
- const config_1 = require("./projects/config");
13
- const child_process_1 = require("child_process");
14
- const fs_1 = require("@hubspot/local-dev-lib/fs");
9
+ const fs_1 = __importDefault(require("fs"));
10
+ const util_1 = __importDefault(require("util"));
15
11
  const path_1 = __importDefault(require("path"));
12
+ const child_process_1 = require("child_process");
13
+ const fs_2 = require("@hubspot/local-dev-lib/fs");
14
+ const config_1 = require("./projects/config");
16
15
  const ui_1 = require("./ui");
17
- const util_1 = __importDefault(require("util"));
18
16
  const lang_1 = require("./lang");
19
17
  const SpinniesManager_1 = __importDefault(require("./ui/SpinniesManager"));
20
- const fs_2 = __importDefault(require("fs"));
21
- const package_json_1 = __importDefault(require("../package.json"));
22
- const DEFAULT_PACKAGE_MANAGER = 'npm';
18
+ const npm_1 = require("./npm");
23
19
  class NoPackageJsonFilesError extends Error {
24
20
  constructor(projectName) {
25
21
  super((0, lang_1.i18n)(`commands.project.subcommands.installDeps.noPackageJsonInProject`, {
@@ -28,22 +24,6 @@ class NoPackageJsonFilesError extends Error {
28
24
  }));
29
25
  }
30
26
  }
31
- async function isGloballyInstalled(command) {
32
- const exec = util_1.default.promisify(child_process_1.exec);
33
- try {
34
- await exec(`${command} --version`);
35
- return true;
36
- }
37
- catch (e) {
38
- return false;
39
- }
40
- }
41
- async function getLatestCliVersion() {
42
- const exec = util_1.default.promisify(child_process_1.exec);
43
- const { stdout } = await exec(`npm info ${package_json_1.default.name} dist-tags --json`);
44
- const { latest, next } = JSON.parse(stdout);
45
- return { latest, next };
46
- }
47
27
  async function installPackages({ packages, installLocations, }) {
48
28
  const installDirs = installLocations || (await getProjectPackageJsonLocations());
49
29
  await Promise.all(installDirs.map(async (dir) => {
@@ -64,14 +44,8 @@ async function installPackagesInDirectory(directory, packages) {
64
44
  directory: relativeDir,
65
45
  }),
66
46
  });
67
- let installCommand = `${DEFAULT_PACKAGE_MANAGER} install`;
68
- if (packages) {
69
- installCommand = `${installCommand} ${packages.join(' ')}`;
70
- }
71
- logger_1.logger.debug(`Running ${installCommand}`);
72
47
  try {
73
- const exec = util_1.default.promisify(child_process_1.exec);
74
- await exec(installCommand, { cwd: directory });
48
+ await (0, npm_1.executeInstall)(packages, null, { cwd: directory });
75
49
  SpinniesManager_1.default.succeed(spinner, {
76
50
  text: (0, lang_1.i18n)(`commands.project.subcommands.installDeps.installationSuccessful`, {
77
51
  directory: relativeDir,
@@ -99,17 +73,17 @@ async function getProjectPackageJsonLocations() {
99
73
  throw new Error((0, lang_1.i18n)(`commands.project.subcommands.installDeps.noProjectConfig`));
100
74
  }
101
75
  const { projectDir, projectConfig: { srcDir, name }, } = projectConfig;
102
- if (!(await isGloballyInstalled(DEFAULT_PACKAGE_MANAGER))) {
76
+ if (!(await (0, npm_1.isGloballyInstalled)(npm_1.DEFAULT_PACKAGE_MANAGER))) {
103
77
  throw new Error((0, lang_1.i18n)(`commands.project.subcommands.installDeps.packageManagerNotInstalled`, {
104
- packageManager: DEFAULT_PACKAGE_MANAGER,
105
- link: (0, ui_1.uiLink)(DEFAULT_PACKAGE_MANAGER, 'https://docs.npmjs.com/downloading-and-installing-node-js-and-npm'),
78
+ packageManager: npm_1.DEFAULT_PACKAGE_MANAGER,
79
+ link: (0, ui_1.uiLink)(npm_1.DEFAULT_PACKAGE_MANAGER, 'https://docs.npmjs.com/downloading-and-installing-node-js-and-npm'),
106
80
  }));
107
81
  }
108
- if (!fs_2.default.existsSync(projectConfig.projectDir) ||
109
- !fs_2.default.existsSync(path_1.default.join(projectDir, srcDir))) {
82
+ if (!fs_1.default.existsSync(projectConfig.projectDir) ||
83
+ !fs_1.default.existsSync(path_1.default.join(projectDir, srcDir))) {
110
84
  throw new NoPackageJsonFilesError(name);
111
85
  }
112
- const packageJsonFiles = (await (0, fs_1.walk)(path_1.default.join(projectDir, srcDir))).filter(file => file.includes('package.json') &&
86
+ const packageJsonFiles = (await (0, fs_2.walk)(path_1.default.join(projectDir, srcDir))).filter(file => file.includes('package.json') &&
113
87
  !file.includes('node_modules') &&
114
88
  !file.includes('.vite'));
115
89
  if (packageJsonFiles.length === 0) {
@@ -8,6 +8,7 @@ const logger_1 = require("@hubspot/local-dev-lib/logger");
8
8
  const config_1 = require("@hubspot/local-dev-lib/config");
9
9
  const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
10
10
  const dependencyManagement_1 = require("../dependencyManagement");
11
+ const npm_1 = require("../npm");
11
12
  const util_1 = __importDefault(require("util"));
12
13
  const fs_1 = __importDefault(require("fs"));
13
14
  const path_1 = __importDefault(require("path"));
@@ -230,7 +231,7 @@ class Doctor {
230
231
  let latestCLIVersion;
231
232
  let nextCliVersion;
232
233
  try {
233
- const { latest, next } = await (0, dependencyManagement_1.getLatestCliVersion)();
234
+ const { latest, next } = await (0, npm_1.getLatestCliVersion)();
234
235
  latestCLIVersion = latest;
235
236
  nextCliVersion = next;
236
237
  }
@@ -1,2 +1,2 @@
1
- export declare function resolveLocalPath(filepath: string): string;
1
+ export declare function resolveLocalPath(filepath?: string): string;
2
2
  export declare function isPathFolder(path: string): boolean;
@@ -1,8 +1,7 @@
1
1
  export declare const helpers: {
2
2
  [key: string]: (stringValue: string) => string;
3
3
  };
4
- type InterpolationData = {
5
- [identifier: string]: string | number;
4
+ export type InterpolationData = {
5
+ [identifier: string]: string | undefined | null | number | boolean;
6
6
  };
7
7
  export declare function interpolate(stringValue: string, interpolationData: InterpolationData): string;
8
- export {};
package/lib/lang.d.ts CHANGED
@@ -1,9 +1,8 @@
1
+ import { InterpolationData } from './interpolation';
1
2
  export declare const MISSING_LANGUAGE_DATA_PREFIX = "[Missing language data]";
2
3
  type LanguageObject = {
3
4
  [key: string]: string | LanguageObject;
4
5
  };
5
- export declare function i18n(lookupDotNotation: string, options?: {
6
- [identifier: string]: string | number;
7
- }): string;
6
+ export declare function i18n(lookupDotNotation: string, options?: InterpolationData): string;
8
7
  export declare function setLangData(newLocale: string, newLangObj: LanguageObject): void;
9
8
  export {};
@@ -0,0 +1 @@
1
+ export declare function autoUpdateCLI(): Promise<void>;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.autoUpdateCLI = autoUpdateCLI;
7
+ // Update-notifier is CommonJS, so we need to use require
8
+ const updateNotifier = require('update-notifier');
9
+ const config_1 = require("@hubspot/local-dev-lib/config");
10
+ const package_json_1 = __importDefault(require("../../package.json"));
11
+ const ui_1 = require("../ui");
12
+ const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
13
+ const en_1 = require("../../lang/en");
14
+ const npm_1 = require("../npm");
15
+ const errorHandlers_1 = require("../errorHandlers");
16
+ const logger_1 = require("../ui/logger");
17
+ // Default behavior is to check for notifications at most once per day
18
+ // update-notifier stores the last checked date in the user's home directory
19
+ const notifier = updateNotifier({
20
+ pkg: { ...package_json_1.default, name: '@hubspot/cli' },
21
+ distTag: 'latest',
22
+ shouldNotifyInNpmScript: true,
23
+ });
24
+ const CMS_CLI_PACKAGE_NAME = '@hubspot/cms-cli';
25
+ function updateNotification() {
26
+ notifier.notify({
27
+ message: package_json_1.default.name === CMS_CLI_PACKAGE_NAME
28
+ ? en_1.lib.middleware.updateNotification.cmsUpdateNotification(CMS_CLI_PACKAGE_NAME)
29
+ : en_1.lib.middleware.updateNotification.cliUpdateNotification,
30
+ defer: false,
31
+ boxenOptions: {
32
+ borderColor: ui_1.UI_COLORS.MARIGOLD_DARK,
33
+ margin: 1,
34
+ padding: 1,
35
+ textAlignment: 'center',
36
+ borderStyle: 'round',
37
+ title: package_json_1.default.name === CMS_CLI_PACKAGE_NAME
38
+ ? null
39
+ : en_1.lib.middleware.updateNotification.notifyTitle,
40
+ },
41
+ });
42
+ }
43
+ async function autoUpdateCLI() {
44
+ // This lets us back to default update-notifier behavior
45
+ let showManualInstallHelp = true;
46
+ if (notifier &&
47
+ notifier.update &&
48
+ !process.env.SKIP_HUBSPOT_CLI_AUTO_UPDATES &&
49
+ (0, config_1.isConfigFlagEnabled)('allowAutoUpdates')) {
50
+ // Ignore all update notifications if the current version is a pre-release
51
+ if (!notifier.update.current.includes('-')) {
52
+ // Attempt auto-update if the current version is not the latest version
53
+ // Never auto-update for major version updates b/c they are breaking
54
+ if (!['major', 'latest'].includes(notifier.update.type)) {
55
+ SpinniesManager_1.default.init({
56
+ succeedColor: 'white',
57
+ });
58
+ SpinniesManager_1.default.add('cliAutoUpdate', {
59
+ text: en_1.lib.middleware.autoUpdateCLI.updateAvailable(notifier.update.latest),
60
+ });
61
+ try {
62
+ if ((await (0, npm_1.isGloballyInstalled)(npm_1.DEFAULT_PACKAGE_MANAGER)) &&
63
+ (await (0, npm_1.isGloballyInstalled)('hs'))) {
64
+ await (0, npm_1.executeInstall)(['@hubspot/cli@latest'], '-g');
65
+ showManualInstallHelp = false;
66
+ SpinniesManager_1.default.succeed('cliAutoUpdate', {
67
+ text: en_1.lib.middleware.autoUpdateCLI.updateSucceeded(notifier.update.latest),
68
+ });
69
+ logger_1.uiLogger.log('');
70
+ }
71
+ else {
72
+ SpinniesManager_1.default.fail('cliAutoUpdate', {
73
+ text: en_1.lib.middleware.autoUpdateCLI.notInstalledGlobally,
74
+ });
75
+ }
76
+ }
77
+ catch (e) {
78
+ (0, errorHandlers_1.debugError)(e);
79
+ SpinniesManager_1.default.fail('cliAutoUpdate', {
80
+ text: en_1.lib.middleware.autoUpdateCLI.updateFailed(notifier.update.latest),
81
+ });
82
+ }
83
+ }
84
+ }
85
+ }
86
+ if (showManualInstallHelp) {
87
+ updateNotification();
88
+ }
89
+ }
@@ -55,6 +55,7 @@ async function loadConfigMiddleware(argv) {
55
55
  if (!(0, config_1.configFileExists)(true) &&
56
56
  (0, utils_1.isTargetedCommand)(argv._, {
57
57
  account: { target: false, subCommands: { auth: { target: true } } },
58
+ config: { target: false, subCommands: { migrate: { target: true } } },
58
59
  })) {
59
60
  return;
60
61
  }
@@ -94,6 +95,12 @@ const sandboxesSubCommands = {
94
95
  delete: { target: true },
95
96
  },
96
97
  };
98
+ const configSubCommands = {
99
+ target: false,
100
+ subCommands: {
101
+ migrate: { target: true },
102
+ },
103
+ };
97
104
  const SKIP_ACCOUNT_VALIDATION = {
98
105
  init: { target: true },
99
106
  auth: { target: true },
@@ -101,6 +108,7 @@ const SKIP_ACCOUNT_VALIDATION = {
101
108
  accounts: accountsSubCommands,
102
109
  sandbox: sandboxesSubCommands,
103
110
  sandboxes: sandboxesSubCommands,
111
+ config: configSubCommands,
104
112
  };
105
113
  async function validateAccountOptions(argv) {
106
114
  // Skip this when no command is provided
package/lib/npm.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export declare const DEFAULT_PACKAGE_MANAGER = "npm";
2
+ export declare function isGloballyInstalled(packageName: string): Promise<boolean>;
3
+ export declare function getLatestCliVersion(): Promise<{
4
+ latest: string;
5
+ next: string;
6
+ }>;
7
+ export declare function executeInstall(packages?: string[], flags?: string | null, options?: {
8
+ cwd?: string;
9
+ }): Promise<void>;
package/lib/npm.js ADDED
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DEFAULT_PACKAGE_MANAGER = void 0;
7
+ exports.isGloballyInstalled = isGloballyInstalled;
8
+ exports.getLatestCliVersion = getLatestCliVersion;
9
+ exports.executeInstall = executeInstall;
10
+ const child_process_1 = require("child_process");
11
+ const util_1 = __importDefault(require("util"));
12
+ const logger_1 = require("@hubspot/local-dev-lib/logger");
13
+ const package_json_1 = __importDefault(require("../package.json"));
14
+ exports.DEFAULT_PACKAGE_MANAGER = 'npm';
15
+ async function isGloballyInstalled(packageName) {
16
+ const exec = util_1.default.promisify(child_process_1.exec);
17
+ try {
18
+ await exec(`${packageName} --version`);
19
+ return true;
20
+ }
21
+ catch (e) {
22
+ return false;
23
+ }
24
+ }
25
+ async function getLatestCliVersion() {
26
+ const exec = util_1.default.promisify(child_process_1.exec);
27
+ const { stdout } = await exec(`npm info ${package_json_1.default.name} dist-tags --json`);
28
+ const { latest, next } = JSON.parse(stdout);
29
+ return { latest, next };
30
+ }
31
+ async function executeInstall(packages = [], flags, options) {
32
+ const installCommand = `${exports.DEFAULT_PACKAGE_MANAGER} install${flags ? ` ${flags}` : ''} ${packages.join(' ')}`;
33
+ logger_1.logger.debug('Running ', installCommand);
34
+ const exec = util_1.default.promisify(child_process_1.exec);
35
+ await exec(installCommand, options);
36
+ }
@@ -0,0 +1,6 @@
1
+ import { HsProfileFile } from '@hubspot/project-parsing-lib/src/lib/types';
2
+ import { ProjectConfig } from '../types/Projects';
3
+ export declare function logProfileHeader(profileName: string): void;
4
+ export declare function logProfileFooter(profile: HsProfileFile, includeVariables?: boolean): void;
5
+ export declare function loadProfile(projectConfig: ProjectConfig | null, projectDir: string | null, profileName: string): HsProfileFile | undefined;
6
+ export declare function exitIfUsingProfiles(projectConfig: ProjectConfig | null, projectDir: string | null): Promise<void>;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.logProfileHeader = logProfileHeader;
7
+ exports.logProfileFooter = logProfileFooter;
8
+ exports.loadProfile = loadProfile;
9
+ exports.exitIfUsingProfiles = exitIfUsingProfiles;
10
+ const path_1 = __importDefault(require("path"));
11
+ const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
12
+ const en_1 = require("../lang/en");
13
+ const ui_1 = require("./ui");
14
+ const logger_1 = require("./ui/logger");
15
+ const exitCodes_1 = require("./enums/exitCodes");
16
+ function logProfileHeader(profileName) {
17
+ (0, ui_1.uiLine)();
18
+ (0, ui_1.uiBetaTag)(en_1.lib.projectProfiles.logs.usingProfile((0, project_parsing_lib_1.getHsProfileFilename)(profileName)));
19
+ logger_1.uiLogger.log('');
20
+ }
21
+ function logProfileFooter(profile, includeVariables = false) {
22
+ logger_1.uiLogger.log(en_1.lib.projectProfiles.logs.profileTargetAccount(profile.accountId));
23
+ if (includeVariables) {
24
+ logger_1.uiLogger.log('');
25
+ logger_1.uiLogger.log(en_1.lib.projectProfiles.logs.profileVariables);
26
+ Object.entries(profile.variables ?? {}).forEach(([key, value]) => {
27
+ logger_1.uiLogger.log(` ${key}: ${value}`);
28
+ });
29
+ }
30
+ (0, ui_1.uiLine)();
31
+ logger_1.uiLogger.log('');
32
+ }
33
+ function loadProfile(projectConfig, projectDir, profileName) {
34
+ if (!projectConfig || !projectDir) {
35
+ logger_1.uiLogger.error(en_1.lib.projectProfiles.loadProfile.errors.noProjectConfig);
36
+ return;
37
+ }
38
+ const projectSourceDir = path_1.default.join(projectDir, projectConfig.srcDir);
39
+ const profileFilename = (0, project_parsing_lib_1.getHsProfileFilename)(profileName);
40
+ try {
41
+ const profile = (0, project_parsing_lib_1.loadHsProfileFile)(projectSourceDir, profileName);
42
+ if (!profile) {
43
+ logger_1.uiLogger.error(en_1.lib.projectProfiles.loadProfile.errors.profileNotFound(profileFilename));
44
+ return;
45
+ }
46
+ if (!profile.accountId) {
47
+ logger_1.uiLogger.error(en_1.lib.projectProfiles.loadProfile.errors.missingAccountId(profileFilename));
48
+ return;
49
+ }
50
+ return profile;
51
+ }
52
+ catch (e) {
53
+ logger_1.uiLogger.error(en_1.lib.projectProfiles.loadProfile.errors.failedToLoadProfile(profileFilename));
54
+ return;
55
+ }
56
+ }
57
+ async function exitIfUsingProfiles(projectConfig, projectDir) {
58
+ if (projectConfig && projectDir) {
59
+ const existingProfiles = await (0, project_parsing_lib_1.getAllHsProfiles)(path_1.default.join(projectDir, projectConfig.srcDir));
60
+ if (existingProfiles.length > 0) {
61
+ logger_1.uiLogger.error(en_1.lib.projectProfiles.exitIfUsingProfiles.errors.noProfileSpecified);
62
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
63
+ }
64
+ }
65
+ }
@@ -17,6 +17,8 @@ const urls_1 = require("./urls");
17
17
  const exitCodes_1 = require("../enums/exitCodes");
18
18
  const en_1 = require("../../lang/en");
19
19
  const logger_1 = require("../ui/logger");
20
+ const constants_2 = require("@hubspot/project-parsing-lib/src/lib/constants");
21
+ const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
20
22
  const SPINNER_STATUS = {
21
23
  SPINNING: 'spinning',
22
24
  };
@@ -71,14 +73,27 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
71
73
  structureFn(accountId, taskName, taskId),
72
74
  ]);
73
75
  const subtasks = getSubtasks(initialTaskStatus);
74
- const tasksById = subtasks.reduce((acc, subtask) => {
76
+ const hiddenComponentBuildIds = [];
77
+ const tasksById = subtasks
78
+ .filter(subtask => {
79
+ // TODO: Remove this filtering logic when visible=false for SERVERLESS_PACKAGE
80
+ const shouldBeVisible = getSubtaskType(subtask) !== (0, project_parsing_lib_1.mapToInternalType)(constants_2.AppFunctionsPackageKey);
81
+ if (!shouldBeVisible) {
82
+ hiddenComponentBuildIds.push(subtask.id);
83
+ }
84
+ return shouldBeVisible;
85
+ })
86
+ .reduce((acc, subtask) => {
75
87
  const { id, visible } = subtask;
76
88
  if (visible) {
77
89
  acc[id] = subtask;
78
90
  }
79
91
  return acc;
80
92
  }, {});
81
- const structuredTasks = Object.keys(taskStructure).map(key => {
93
+ const structuredTasks = Object.keys(taskStructure)
94
+ // TODO: Remove this filtering logic when visible=false for SERVERLESS_PACKAGE
95
+ .filter(buildId => !hiddenComponentBuildIds.includes(buildId))
96
+ .map(key => {
82
97
  return {
83
98
  ...tasksById[key],
84
99
  subtasks: taskStructure[key]
@@ -0,0 +1,26 @@
1
+ import { PublicApp } from '@hubspot/local-dev-lib/types/Apps';
2
+ import { AppIRNode } from '../../../types/ProjectComponents';
3
+ import LocalDevState from './LocalDevState';
4
+ import LocalDevLogger from './LocalDevLogger';
5
+ type AppDevModeInterfaceConstructorOptions = {
6
+ localDevState: LocalDevState;
7
+ localDevLogger: LocalDevLogger;
8
+ };
9
+ declare class AppDevModeInterface {
10
+ localDevState: LocalDevState;
11
+ localDevLogger: LocalDevLogger;
12
+ _appNode?: AppIRNode | null;
13
+ appData?: PublicApp;
14
+ marketplaceAppInstalls?: number;
15
+ constructor(options: AppDevModeInterfaceConstructorOptions);
16
+ private get appNode();
17
+ private getAppInstallUrl;
18
+ private fetchAppData;
19
+ private checkMarketplaceAppInstalls;
20
+ private checkTestAccountAppInstallation;
21
+ setup(args: any): Promise<void>;
22
+ start(): Promise<void>;
23
+ fileChange(filePath: string, event: string): Promise<void>;
24
+ cleanup(): Promise<void>;
25
+ }
26
+ export default AppDevModeInterface;
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const localDevAuth_1 = require("@hubspot/local-dev-lib/api/localDevAuth");
4
+ const appsDev_1 = require("@hubspot/local-dev-lib/api/appsDev");
5
+ const ui_extensions_dev_server_1 = require("@hubspot/ui-extensions-dev-server");
6
+ const portManager_1 = require("@hubspot/local-dev-lib/portManager");
7
+ const constants_1 = require("../../constants");
8
+ const exitCodes_1 = require("../../enums/exitCodes");
9
+ const structure_1 = require("../../projects/structure");
10
+ const ui_1 = require("../../ui");
11
+ const index_1 = require("../../errorHandlers/index");
12
+ const installAppPrompt_1 = require("../../prompts/installAppPrompt");
13
+ const promptUtils_1 = require("../../prompts/promptUtils");
14
+ const en_1 = require("../../../lang/en");
15
+ const logger_1 = require("../../ui/logger");
16
+ const urls_1 = require("../../app/urls");
17
+ class AppDevModeInterface {
18
+ localDevState;
19
+ localDevLogger;
20
+ _appNode;
21
+ appData;
22
+ marketplaceAppInstalls;
23
+ constructor(options) {
24
+ this.localDevState = options.localDevState;
25
+ this.localDevLogger = options.localDevLogger;
26
+ // Static auth apps are currently only installable in the portal that the project resides in
27
+ // This limitation will eventually be removed, but in the meantime we need this check or the install
28
+ // will always fail with a confusing message
29
+ if (this.appNode?.config.auth.type === constants_1.APP_AUTH_TYPES.STATIC &&
30
+ this.localDevState.targetTestingAccountId !==
31
+ this.localDevState.targetProjectAccountId) {
32
+ logger_1.uiLogger.error(en_1.lib.LocalDevManager.staticAuthAccountsMustMatch);
33
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
34
+ }
35
+ if (!this.localDevState.targetProjectAccountId ||
36
+ !this.localDevState.projectConfig ||
37
+ !this.localDevState.projectDir) {
38
+ logger_1.uiLogger.error(en_1.lib.LocalDevManager.failedToInitialize);
39
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
40
+ }
41
+ }
42
+ // Assumes only one app per project
43
+ get appNode() {
44
+ if (this._appNode === undefined) {
45
+ this._appNode =
46
+ Object.values(this.localDevState.projectNodes).find(structure_1.isAppIRNode) ||
47
+ null;
48
+ }
49
+ return this._appNode;
50
+ }
51
+ async getAppInstallUrl() {
52
+ if (this.appNode?.config.auth.type === constants_1.APP_AUTH_TYPES.OAUTH) {
53
+ return (0, urls_1.getOauthAppInstallUrl)({
54
+ targetAccountId: this.localDevState.targetTestingAccountId,
55
+ env: this.localDevState.env,
56
+ clientId: this.appData.clientId, // This is only called after checking that appData exists
57
+ scopes: this.appNode.config.auth.requiredScopes,
58
+ redirectUrls: this.appNode.config.auth.redirectUrls,
59
+ });
60
+ }
61
+ const { data: { results }, } = await (0, appsDev_1.fetchPublicAppsForPortal)(this.localDevState.targetProjectAccountId);
62
+ const app = results.find(app => app.sourceId === this.appNode?.uid);
63
+ if (!app) {
64
+ logger_1.uiLogger.error(en_1.lib.LocalDevManager.staticAuthAccountsMustMatch);
65
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
66
+ }
67
+ return (0, urls_1.getStaticAuthAppInstallUrl)({
68
+ targetAccountId: this.localDevState.targetTestingAccountId,
69
+ env: this.localDevState.env,
70
+ appId: `${app.id}`,
71
+ });
72
+ }
73
+ async fetchAppData() {
74
+ const { data: { results: portalApps }, } = await (0, appsDev_1.fetchPublicAppsForPortal)(this.localDevState.targetProjectAccountId);
75
+ const appData = portalApps.find(({ sourceId }) => sourceId === this.appNode?.uid);
76
+ if (!appData) {
77
+ return;
78
+ }
79
+ const { data: { uniquePortalInstallCount }, } = await (0, appsDev_1.fetchPublicAppProductionInstallCounts)(appData.id, this.localDevState.targetProjectAccountId);
80
+ this.appData = appData;
81
+ this.marketplaceAppInstalls = uniquePortalInstallCount;
82
+ }
83
+ async checkMarketplaceAppInstalls() {
84
+ if (!this.appData || !this.marketplaceAppInstalls) {
85
+ return;
86
+ }
87
+ (0, ui_1.uiLine)();
88
+ logger_1.uiLogger.warn(en_1.lib.LocalDevManager.activeInstallWarning.installCount(this.appData.name, this.marketplaceAppInstalls));
89
+ logger_1.uiLogger.log(en_1.lib.LocalDevManager.activeInstallWarning.explanation);
90
+ (0, ui_1.uiLine)();
91
+ const proceed = await (0, promptUtils_1.confirmPrompt)(en_1.lib.LocalDevManager.activeInstallWarning.confirmationPrompt, { defaultAnswer: false });
92
+ if (!proceed) {
93
+ process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
94
+ }
95
+ this.localDevLogger.addUploadWarning(en_1.lib.AppDevModeInterface.defaultMarketplaceAppWarning(this.marketplaceAppInstalls));
96
+ }
97
+ async checkTestAccountAppInstallation() {
98
+ if (!this.appNode || !this.appData) {
99
+ return;
100
+ }
101
+ // If the app is static auth, always prompt the user to install the app.
102
+ // We are currently going this because we have no method to determine if the static auth app
103
+ // is already installed in the portal
104
+ if (this.appNode.config.auth.type === constants_1.APP_AUTH_TYPES.STATIC) {
105
+ return (0, installAppPrompt_1.installAppPrompt)(await this.getAppInstallUrl(), false);
106
+ }
107
+ const { data: { isInstalledWithScopeGroups, previouslyAuthorizedScopeGroups }, } = await (0, localDevAuth_1.fetchAppInstallationData)(this.localDevState.targetTestingAccountId, this.localDevState.projectId, this.appNode.uid, this.appNode.config.auth.requiredScopes, this.appNode.config.auth.optionalScopes);
108
+ const isReinstall = previouslyAuthorizedScopeGroups.length > 0;
109
+ if (!isInstalledWithScopeGroups) {
110
+ const installUrl = await this.getAppInstallUrl();
111
+ await (0, installAppPrompt_1.installAppPrompt)(installUrl, isReinstall);
112
+ }
113
+ }
114
+ // @ts-expect-error TODO: reconcile types between CLI and UIE Dev Server
115
+ // In the future, update UIE Dev Server to use LocalDevState
116
+ async setup(args) {
117
+ if (!this.appNode) {
118
+ return;
119
+ }
120
+ try {
121
+ await this.fetchAppData();
122
+ if (this.appNode.config.distribution === constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE) {
123
+ await this.checkMarketplaceAppInstalls();
124
+ }
125
+ await this.checkTestAccountAppInstallation();
126
+ }
127
+ catch (e) {
128
+ (0, index_1.logError)(e);
129
+ }
130
+ return ui_extensions_dev_server_1.DevModeUnifiedInterface.setup(args);
131
+ }
132
+ async start() {
133
+ if (!this.appNode) {
134
+ return;
135
+ }
136
+ return ui_extensions_dev_server_1.DevModeUnifiedInterface.start({
137
+ accountId: this.localDevState.targetTestingAccountId,
138
+ // @ts-expect-error TODO: reconcile types between CLI and UIE Dev Server
139
+ projectConfig: this.localDevState.projectConfig,
140
+ requestPorts: portManager_1.requestPorts,
141
+ });
142
+ }
143
+ async fileChange(filePath, event) {
144
+ if (!this.appNode) {
145
+ return;
146
+ }
147
+ return ui_extensions_dev_server_1.DevModeUnifiedInterface.fileChange(filePath, event);
148
+ }
149
+ async cleanup() {
150
+ if (!this.appNode) {
151
+ return;
152
+ }
153
+ return ui_extensions_dev_server_1.DevModeUnifiedInterface.cleanup();
154
+ }
155
+ }
156
+ exports.default = AppDevModeInterface;
@@ -1,33 +1,22 @@
1
- import { ProjectConfig } from '../../../types/Projects';
2
- import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types';
3
- type DevServerInterface = {
4
- setup?: Function;
5
- start?: (options: object) => Promise<void>;
6
- fileChange?: (filePath: string, event: string) => Promise<void>;
7
- cleanup?: () => Promise<void>;
1
+ import LocalDevState from './LocalDevState';
2
+ import LocalDevLogger from './LocalDevLogger';
3
+ type DevServerManagerV2ConstructorOptions = {
4
+ localDevState: LocalDevState;
5
+ logger: LocalDevLogger;
8
6
  };
9
7
  declare class DevServerManagerV2 {
10
8
  private initialized;
11
9
  private started;
12
10
  private devServers;
13
- constructor();
14
- iterateDevServers(callback: (serverInterface: DevServerInterface) => Promise<void>): Promise<void>;
15
- setup({ projectNodes, accountId, setActiveApp, }: {
16
- projectNodes: {
17
- [key: string]: IntermediateRepresentationNodeLocalDev;
18
- };
19
- accountId: number;
20
- setActiveApp: (appUid: string | undefined) => Promise<void>;
21
- }): Promise<void>;
22
- start({ accountId, projectConfig, }: {
23
- accountId: number;
24
- projectConfig: ProjectConfig;
25
- }): Promise<void>;
11
+ private localDevState;
12
+ constructor(options: DevServerManagerV2ConstructorOptions);
13
+ private iterateDevServers;
14
+ setup(): Promise<void>;
15
+ start(): Promise<void>;
26
16
  fileChange({ filePath, event, }: {
27
17
  filePath: string;
28
18
  event: string;
29
19
  }): Promise<void>;
30
20
  cleanup(): Promise<void>;
31
21
  }
32
- declare const Manager: DevServerManagerV2;
33
- export default Manager;
22
+ export default DevServerManagerV2;