@hubspot/cli 8.0.10-experimental.5 → 8.0.10-experimental.7
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.
- package/commands/getStarted.js +1 -1
- package/lang/en.js +1 -1
- package/lib/app/migrate.js +10 -5
- package/lib/getStartedV2Actions.js +1 -1
- package/lib/projects/components.js +3 -2
- package/lib/projects/create/v2.js +1 -1
- package/lib/ui/SpinniesManager.js +2 -0
- package/package.json +6 -2
- package/api/__tests__/migrate.test.d.ts +0 -1
- package/api/__tests__/migrate.test.js +0 -199
- package/commands/__tests__/account.test.d.ts +0 -1
- package/commands/__tests__/account.test.js +0 -69
- package/commands/__tests__/auth.test.d.ts +0 -1
- package/commands/__tests__/auth.test.js +0 -43
- package/commands/__tests__/cms.test.d.ts +0 -1
- package/commands/__tests__/cms.test.js +0 -87
- package/commands/__tests__/config.test.d.ts +0 -1
- package/commands/__tests__/config.test.js +0 -44
- package/commands/__tests__/customObject.test.d.ts +0 -1
- package/commands/__tests__/customObject.test.js +0 -68
- package/commands/__tests__/doctor.test.d.ts +0 -1
- package/commands/__tests__/doctor.test.js +0 -132
- package/commands/__tests__/feedback.test.d.ts +0 -1
- package/commands/__tests__/feedback.test.js +0 -24
- package/commands/__tests__/filemanager.test.d.ts +0 -1
- package/commands/__tests__/filemanager.test.js +0 -45
- package/commands/__tests__/getStarted.test.d.ts +0 -1
- package/commands/__tests__/getStarted.test.js +0 -173
- package/commands/__tests__/hubdb.test.d.ts +0 -1
- package/commands/__tests__/hubdb.test.js +0 -50
- package/commands/__tests__/init.test.d.ts +0 -1
- package/commands/__tests__/init.test.js +0 -42
- package/commands/__tests__/mcp.test.d.ts +0 -1
- package/commands/__tests__/mcp.test.js +0 -46
- package/commands/__tests__/open.test.d.ts +0 -1
- package/commands/__tests__/open.test.js +0 -58
- package/commands/__tests__/project.test.d.ts +0 -1
- package/commands/__tests__/project.test.js +0 -125
- package/commands/__tests__/sandbox.test.d.ts +0 -1
- package/commands/__tests__/sandbox.test.js +0 -44
- package/commands/__tests__/secret.test.d.ts +0 -1
- package/commands/__tests__/secret.test.js +0 -49
- package/commands/__tests__/testAccount.test.d.ts +0 -1
- package/commands/__tests__/testAccount.test.js +0 -57
- package/commands/__tests__/upgrade.test.d.ts +0 -1
- package/commands/__tests__/upgrade.test.js +0 -309
- package/commands/account/__tests__/auth.test.d.ts +0 -1
- package/commands/account/__tests__/auth.test.js +0 -206
- package/commands/account/__tests__/clean.test.d.ts +0 -1
- package/commands/account/__tests__/clean.test.js +0 -28
- package/commands/account/__tests__/createOverride.test.d.ts +0 -1
- package/commands/account/__tests__/createOverride.test.js +0 -32
- package/commands/account/__tests__/info.test.d.ts +0 -1
- package/commands/account/__tests__/info.test.js +0 -28
- package/commands/account/__tests__/list.test.d.ts +0 -1
- package/commands/account/__tests__/list.test.js +0 -153
- package/commands/account/__tests__/remove.test.d.ts +0 -1
- package/commands/account/__tests__/remove.test.js +0 -36
- package/commands/account/__tests__/removeOverride.d.ts +0 -1
- package/commands/account/__tests__/removeOverride.js +0 -25
- package/commands/account/__tests__/rename.test.d.ts +0 -1
- package/commands/account/__tests__/rename.test.js +0 -82
- package/commands/account/__tests__/use.test.d.ts +0 -1
- package/commands/account/__tests__/use.test.js +0 -170
- package/commands/app/__tests__/migrate.test.d.ts +0 -1
- package/commands/app/__tests__/migrate.test.js +0 -111
- package/commands/app/secret/__tests__/add.test.d.ts +0 -1
- package/commands/app/secret/__tests__/add.test.js +0 -140
- package/commands/app/secret/__tests__/delete.test.d.ts +0 -1
- package/commands/app/secret/__tests__/delete.test.js +0 -28
- package/commands/app/secret/__tests__/list.test.d.ts +0 -1
- package/commands/app/secret/__tests__/list.test.js +0 -25
- package/commands/app/secret/__tests__/update.test.d.ts +0 -1
- package/commands/app/secret/__tests__/update.test.js +0 -28
- package/commands/cms/__tests__/delete.test.d.ts +0 -1
- package/commands/cms/__tests__/delete.test.js +0 -39
- package/commands/cms/__tests__/fetch.test.d.ts +0 -1
- package/commands/cms/__tests__/fetch.test.js +0 -156
- package/commands/cms/__tests__/function.test.d.ts +0 -1
- package/commands/cms/__tests__/function.test.js +0 -50
- package/commands/cms/__tests__/lint.test.d.ts +0 -1
- package/commands/cms/__tests__/lint.test.js +0 -33
- package/commands/cms/__tests__/list.test.d.ts +0 -1
- package/commands/cms/__tests__/list.test.js +0 -42
- package/commands/cms/__tests__/module.test.d.ts +0 -1
- package/commands/cms/__tests__/module.test.js +0 -45
- package/commands/cms/__tests__/mv.test.d.ts +0 -1
- package/commands/cms/__tests__/mv.test.js +0 -46
- package/commands/cms/__tests__/theme.test.d.ts +0 -1
- package/commands/cms/__tests__/theme.test.js +0 -54
- package/commands/cms/__tests__/upload.test.d.ts +0 -1
- package/commands/cms/__tests__/upload.test.js +0 -312
- package/commands/cms/__tests__/watch.test.d.ts +0 -1
- package/commands/cms/__tests__/watch.test.js +0 -204
- package/commands/cms/function/__tests__/logs.test.d.ts +0 -1
- package/commands/cms/function/__tests__/logs.test.js +0 -70
- package/commands/cms/theme/__tests__/generate-selectors.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/generate-selectors.test.js +0 -28
- package/commands/cms/theme/__tests__/marketplace-validate.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/marketplace-validate.test.js +0 -36
- package/commands/cms/theme/__tests__/preview.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/preview.test.js +0 -54
- package/commands/customObject/__tests__/create.test.d.ts +0 -1
- package/commands/customObject/__tests__/create.test.js +0 -40
- package/commands/customObject/__tests__/createSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/createSchema.test.js +0 -28
- package/commands/customObject/__tests__/deleteSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/deleteSchema.test.js +0 -42
- package/commands/customObject/__tests__/fetch-all-schemas.test.d.ts +0 -1
- package/commands/customObject/__tests__/fetch-all-schemas.test.js +0 -41
- package/commands/customObject/__tests__/fetchSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/fetchSchema.test.js +0 -45
- package/commands/customObject/__tests__/listSchemas.test.d.ts +0 -1
- package/commands/customObject/__tests__/listSchemas.test.js +0 -29
- package/commands/customObject/__tests__/updateSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/updateSchema.test.js +0 -40
- package/commands/filemanager/__tests__/fetch.test.d.ts +0 -1
- package/commands/filemanager/__tests__/fetch.test.js +0 -32
- package/commands/filemanager/__tests__/upload.test.d.ts +0 -1
- package/commands/filemanager/__tests__/upload.test.js +0 -191
- package/commands/hubdb/__tests__/clear.test.d.ts +0 -1
- package/commands/hubdb/__tests__/clear.test.js +0 -28
- package/commands/hubdb/__tests__/create.test.d.ts +0 -1
- package/commands/hubdb/__tests__/create.test.js +0 -28
- package/commands/hubdb/__tests__/delete.test.d.ts +0 -1
- package/commands/hubdb/__tests__/delete.test.js +0 -28
- package/commands/hubdb/__tests__/fetch.test.d.ts +0 -1
- package/commands/hubdb/__tests__/fetch.test.js +0 -28
- package/commands/hubdb/__tests__/list.test.d.ts +0 -1
- package/commands/hubdb/__tests__/list.test.js +0 -88
- package/commands/mcp/__tests__/setup.test.d.ts +0 -1
- package/commands/mcp/__tests__/setup.test.js +0 -26
- package/commands/mcp/__tests__/start.test.d.ts +0 -1
- package/commands/mcp/__tests__/start.test.js +0 -144
- package/commands/project/__tests__/add.test.d.ts +0 -1
- package/commands/project/__tests__/add.test.js +0 -107
- package/commands/project/__tests__/create.test.d.ts +0 -1
- package/commands/project/__tests__/create.test.js +0 -97
- package/commands/project/__tests__/deploy.test.d.ts +0 -1
- package/commands/project/__tests__/deploy.test.js +0 -307
- package/commands/project/__tests__/dev.test.d.ts +0 -1
- package/commands/project/__tests__/dev.test.js +0 -273
- package/commands/project/__tests__/devUnifiedFlow.test.d.ts +0 -1
- package/commands/project/__tests__/devUnifiedFlow.test.js +0 -434
- package/commands/project/__tests__/download.test.d.ts +0 -1
- package/commands/project/__tests__/download.test.js +0 -39
- package/commands/project/__tests__/installDeps.test.d.ts +0 -1
- package/commands/project/__tests__/installDeps.test.js +0 -140
- package/commands/project/__tests__/lint.test.d.ts +0 -1
- package/commands/project/__tests__/lint.test.js +0 -704
- package/commands/project/__tests__/list.test.d.ts +0 -1
- package/commands/project/__tests__/list.test.js +0 -31
- package/commands/project/__tests__/listBuilds.test.d.ts +0 -1
- package/commands/project/__tests__/listBuilds.test.js +0 -38
- package/commands/project/__tests__/logs.test.d.ts +0 -1
- package/commands/project/__tests__/logs.test.js +0 -202
- package/commands/project/__tests__/migrate.test.d.ts +0 -1
- package/commands/project/__tests__/migrate.test.js +0 -106
- package/commands/project/__tests__/open.test.d.ts +0 -1
- package/commands/project/__tests__/open.test.js +0 -39
- package/commands/project/__tests__/profile.test.d.ts +0 -1
- package/commands/project/__tests__/profile.test.js +0 -42
- package/commands/project/__tests__/updateDeps.test.d.ts +0 -1
- package/commands/project/__tests__/updateDeps.test.js +0 -140
- package/commands/project/__tests__/upload.test.d.ts +0 -1
- package/commands/project/__tests__/upload.test.js +0 -234
- package/commands/project/__tests__/validate.test.d.ts +0 -1
- package/commands/project/__tests__/validate.test.js +0 -381
- package/commands/project/__tests__/watch.test.d.ts +0 -1
- package/commands/project/__tests__/watch.test.js +0 -35
- package/commands/sandbox/__tests__/create.test.d.ts +0 -1
- package/commands/sandbox/__tests__/create.test.js +0 -198
- package/commands/sandbox/__tests__/delete.test.d.ts +0 -1
- package/commands/sandbox/__tests__/delete.test.js +0 -31
- package/commands/secret/__tests__/addSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/addSecret.test.js +0 -162
- package/commands/secret/__tests__/deleteSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/deleteSecret.test.js +0 -41
- package/commands/secret/__tests__/listSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/listSecret.test.js +0 -29
- package/commands/secret/__tests__/updateSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/updateSecret.test.js +0 -29
- package/commands/testAccount/__tests__/create.test.d.ts +0 -1
- package/commands/testAccount/__tests__/create.test.js +0 -106
- package/commands/testAccount/__tests__/createConfig.test.d.ts +0 -1
- package/commands/testAccount/__tests__/createConfig.test.js +0 -32
- package/commands/testAccount/__tests__/delete.test.d.ts +0 -1
- package/commands/testAccount/__tests__/delete.test.js +0 -29
- package/commands/testAccount/__tests__/importData.test.d.ts +0 -1
- package/commands/testAccount/__tests__/importData.test.js +0 -92
- package/lib/__tests__/CLIWebSocketServer.test.d.ts +0 -1
- package/lib/__tests__/CLIWebSocketServer.test.js +0 -252
- package/lib/__tests__/accountAuth.test.d.ts +0 -1
- package/lib/__tests__/accountAuth.test.js +0 -258
- package/lib/__tests__/accountTypes.test.d.ts +0 -1
- package/lib/__tests__/accountTypes.test.js +0 -98
- package/lib/__tests__/buildAccount.test.d.ts +0 -1
- package/lib/__tests__/buildAccount.test.js +0 -211
- package/lib/__tests__/cliUpgradeUtils.test.d.ts +0 -1
- package/lib/__tests__/cliUpgradeUtils.test.js +0 -131
- package/lib/__tests__/commandSuggestion.test.d.ts +0 -1
- package/lib/__tests__/commandSuggestion.test.js +0 -121
- package/lib/__tests__/commonOpts.test.d.ts +0 -1
- package/lib/__tests__/commonOpts.test.js +0 -80
- package/lib/__tests__/dependencyManagement.test.d.ts +0 -1
- package/lib/__tests__/dependencyManagement.test.js +0 -1067
- package/lib/__tests__/developerTestAccounts.test.d.ts +0 -1
- package/lib/__tests__/developerTestAccounts.test.js +0 -156
- package/lib/__tests__/hasFeature.test.d.ts +0 -1
- package/lib/__tests__/hasFeature.test.js +0 -167
- package/lib/__tests__/http.test.d.ts +0 -1
- package/lib/__tests__/http.test.js +0 -40
- package/lib/__tests__/importData.test.d.ts +0 -1
- package/lib/__tests__/importData.test.js +0 -98
- package/lib/__tests__/npmCli.test.d.ts +0 -1
- package/lib/__tests__/npmCli.test.js +0 -84
- package/lib/__tests__/oauth.test.d.ts +0 -1
- package/lib/__tests__/oauth.test.js +0 -109
- package/lib/__tests__/parsing.test.d.ts +0 -1
- package/lib/__tests__/parsing.test.js +0 -34
- package/lib/__tests__/polling.test.d.ts +0 -1
- package/lib/__tests__/polling.test.js +0 -76
- package/lib/__tests__/process.test.d.ts +0 -1
- package/lib/__tests__/process.test.js +0 -89
- package/lib/__tests__/sandboxes.test.d.ts +0 -1
- package/lib/__tests__/sandboxes.test.js +0 -128
- package/lib/__tests__/serverlessLogs.test.d.ts +0 -1
- package/lib/__tests__/serverlessLogs.test.js +0 -163
- package/lib/__tests__/usageTracking.test.d.ts +0 -1
- package/lib/__tests__/usageTracking.test.js +0 -197
- package/lib/__tests__/validation.test.d.ts +0 -1
- package/lib/__tests__/validation.test.js +0 -143
- package/lib/__tests__/yargsUtils.test.d.ts +0 -1
- package/lib/__tests__/yargsUtils.test.js +0 -124
- package/lib/app/__tests__/migrate.test.d.ts +0 -1
- package/lib/app/__tests__/migrate.test.js +0 -638
- package/lib/doctor/__tests__/Diagnosis.test.d.ts +0 -1
- package/lib/doctor/__tests__/Diagnosis.test.js +0 -84
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.d.ts +0 -1
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +0 -177
- package/lib/doctor/__tests__/Doctor.test.d.ts +0 -1
- package/lib/doctor/__tests__/Doctor.test.js +0 -560
- package/lib/errorHandlers/__tests__/index.test.d.ts +0 -1
- package/lib/errorHandlers/__tests__/index.test.js +0 -278
- package/lib/mcp/__tests__/setup.test.d.ts +0 -1
- package/lib/mcp/__tests__/setup.test.js +0 -523
- package/lib/middleware/__tests__/commandTargetingUtils.test.d.ts +0 -1
- package/lib/middleware/__tests__/commandTargetingUtils.test.js +0 -99
- package/lib/middleware/__tests__/configMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/configMiddleware.test.js +0 -118
- package/lib/middleware/__tests__/gitMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/gitMiddleware.test.js +0 -43
- package/lib/middleware/__tests__/requestMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/requestMiddleware.test.js +0 -15
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.js +0 -44
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.js +0 -39
- package/lib/projects/__tests__/AppDevModeInterface.test.d.ts +0 -1
- package/lib/projects/__tests__/AppDevModeInterface.test.js +0 -541
- package/lib/projects/__tests__/DevServerManager.test.d.ts +0 -1
- package/lib/projects/__tests__/DevServerManager.test.js +0 -185
- package/lib/projects/__tests__/DevSessionManager.test.d.ts +0 -1
- package/lib/projects/__tests__/DevSessionManager.test.js +0 -250
- package/lib/projects/__tests__/LocalDevProcess.test.d.ts +0 -1
- package/lib/projects/__tests__/LocalDevProcess.test.js +0 -481
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.d.ts +0 -1
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +0 -231
- package/lib/projects/__tests__/ProjectLogsManager.test.d.ts +0 -1
- package/lib/projects/__tests__/ProjectLogsManager.test.js +0 -302
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +0 -1
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +0 -160
- package/lib/projects/__tests__/components.test.d.ts +0 -1
- package/lib/projects/__tests__/components.test.js +0 -440
- package/lib/projects/__tests__/deploy.test.d.ts +0 -1
- package/lib/projects/__tests__/deploy.test.js +0 -231
- package/lib/projects/__tests__/localDevProjectHelpers.test.d.ts +0 -1
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +0 -120
- package/lib/projects/__tests__/platformVersion.test.d.ts +0 -1
- package/lib/projects/__tests__/platformVersion.test.js +0 -63
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.d.ts +0 -1
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.js +0 -328
- package/lib/projects/__tests__/projectProfiles.test.d.ts +0 -1
- package/lib/projects/__tests__/projectProfiles.test.js +0 -441
- package/lib/projects/__tests__/projects.test.d.ts +0 -1
- package/lib/projects/__tests__/projects.test.js +0 -58
- package/lib/projects/__tests__/structure.test.d.ts +0 -1
- package/lib/projects/__tests__/structure.test.js +0 -210
- package/lib/projects/__tests__/uieLinting.test.d.ts +0 -1
- package/lib/projects/__tests__/uieLinting.test.js +0 -631
- package/lib/projects/__tests__/upload.test.d.ts +0 -1
- package/lib/projects/__tests__/upload.test.js +0 -183
- package/lib/projects/add/__tests__/legacyAddComponent.test.d.ts +0 -1
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +0 -245
- package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +0 -1
- package/lib/projects/add/__tests__/v2AddComponent.test.js +0 -343
- package/lib/projects/create/__tests__/legacy.test.d.ts +0 -1
- package/lib/projects/create/__tests__/legacy.test.js +0 -72
- package/lib/projects/create/__tests__/v2.test.d.ts +0 -1
- package/lib/projects/create/__tests__/v2.test.js +0 -257
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.js +0 -157
- package/lib/prompts/__tests__/createFunctionPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createFunctionPrompt.test.js +0 -129
- package/lib/prompts/__tests__/createModulePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createModulePrompt.test.js +0 -187
- package/lib/prompts/__tests__/createTemplatePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createTemplatePrompt.test.js +0 -102
- package/lib/prompts/__tests__/downloadProjectPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +0 -31
- package/lib/prompts/__tests__/projectAddPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/projectAddPrompt.test.js +0 -143
- package/lib/prompts/__tests__/projectsLogsPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/projectsLogsPrompt.test.js +0 -37
- package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.js +0 -160
- package/lib/theme/__tests__/migrate.test.d.ts +0 -1
- package/lib/theme/__tests__/migrate.test.js +0 -247
- package/lib/ui/__tests__/SpinniesManager.test.d.ts +0 -1
- package/lib/ui/__tests__/SpinniesManager.test.js +0 -488
- package/lib/ui/__tests__/removeAnsiCodes.test.d.ts +0 -1
- package/lib/ui/__tests__/removeAnsiCodes.test.js +0 -84
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +0 -254
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +0 -227
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +0 -208
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +0 -186
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +0 -124
- package/mcp-server/tools/cms/__tests__/HsListTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +0 -124
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +0 -157
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +0 -131
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +0 -461
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +0 -125
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +0 -125
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +0 -210
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +0 -146
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +0 -124
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +0 -307
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +0 -242
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +0 -209
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +0 -158
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +0 -187
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +0 -118
- package/mcp-server/utils/__tests__/command.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/command.test.js +0 -275
- package/mcp-server/utils/__tests__/content.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/content.test.js +0 -164
- package/mcp-server/utils/__tests__/feedbackTracking.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +0 -69
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
import { HttpStatusCode } from 'axios';
|
|
2
|
-
import yargs from 'yargs';
|
|
3
|
-
import * as configUtils from '@hubspot/local-dev-lib/config';
|
|
4
|
-
import * as projectApiUtils from '@hubspot/local-dev-lib/api/projects';
|
|
5
|
-
import * as ui from '../../../lib/ui/index.js';
|
|
6
|
-
import { addAccountOptions, addConfigOptions, addJSONOutputOptions, addUseEnvironmentOptions, } from '../../../lib/commonOpts.js';
|
|
7
|
-
import * as projectUtils from '../../../lib/projects/config.js';
|
|
8
|
-
import * as projectUrlUtils from '../../../lib/projects/urls.js';
|
|
9
|
-
import { pollDeployStatus } from '../../../lib/projects/pollProjectBuildAndDeploy.js';
|
|
10
|
-
import * as projectNamePrompt from '../../../lib/prompts/projectNamePrompt.js';
|
|
11
|
-
import * as promptUtils from '../../../lib/prompts/promptUtils.js';
|
|
12
|
-
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
13
|
-
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
14
|
-
import { loadJson } from '../../../lib/jsonLoader.js';
|
|
15
|
-
import { mockHubSpotHttpResponse, mockHubSpotHttpError, } from '../../../lib/testUtils.js';
|
|
16
|
-
const exampleProject = loadJson(import.meta.url, './fixtures/exampleProject.json');
|
|
17
|
-
import projectDeployCommand from '../deploy.js';
|
|
18
|
-
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
19
|
-
import chalk from 'chalk';
|
|
20
|
-
vi.mock('@hubspot/local-dev-lib/api/projects');
|
|
21
|
-
vi.mock('@hubspot/local-dev-lib/config');
|
|
22
|
-
vi.mock('../../../lib/commonOpts');
|
|
23
|
-
vi.mock('../../../lib/validation');
|
|
24
|
-
vi.mock('../../../lib/projects/config');
|
|
25
|
-
vi.mock('../../../lib/projects/urls');
|
|
26
|
-
vi.mock('../../../lib/projects/pollProjectBuildAndDeploy');
|
|
27
|
-
vi.mock('../../../lib/projects/platformVersion');
|
|
28
|
-
vi.mock('../../../lib/prompts/projectNamePrompt');
|
|
29
|
-
vi.mock('../../../lib/prompts/promptUtils');
|
|
30
|
-
vi.spyOn(ui, 'uiLine');
|
|
31
|
-
const uiCommandReferenceSpy = vi.spyOn(ui, 'uiCommandReference');
|
|
32
|
-
const uiAccountDescriptionSpy = vi.spyOn(ui, 'uiAccountDescription');
|
|
33
|
-
const getProjectConfigSpy = vi.spyOn(projectUtils, 'getProjectConfig');
|
|
34
|
-
const projectNamePromptSpy = vi.spyOn(projectNamePrompt, 'projectNamePrompt');
|
|
35
|
-
const getProjectDetailUrlSpy = vi.spyOn(projectUrlUtils, 'getProjectDetailUrl');
|
|
36
|
-
const fetchProjectSpy = vi.spyOn(projectApiUtils, 'fetchProject');
|
|
37
|
-
const deployProjectV1Spy = vi.spyOn(projectApiUtils, 'deployProjectV1');
|
|
38
|
-
const getConfigAccountByIdSpy = vi.spyOn(configUtils, 'getConfigAccountById');
|
|
39
|
-
const promptUserSpy = vi.spyOn(promptUtils, 'promptUser');
|
|
40
|
-
const processExitSpy = vi.spyOn(process, 'exit');
|
|
41
|
-
const optionsSpy = vi
|
|
42
|
-
.spyOn(yargs, 'options')
|
|
43
|
-
.mockReturnValue(yargs);
|
|
44
|
-
const exampleSpy = vi
|
|
45
|
-
.spyOn(yargs, 'example')
|
|
46
|
-
.mockReturnValue(yargs);
|
|
47
|
-
const conflictsSpy = vi
|
|
48
|
-
.spyOn(yargs, 'conflicts')
|
|
49
|
-
.mockReturnValue(yargs);
|
|
50
|
-
describe('commands/project/deploy', () => {
|
|
51
|
-
const projectFlag = 'project';
|
|
52
|
-
const buildFlag = 'build';
|
|
53
|
-
const deployLatestBuildFlag = 'deployLatestBuild';
|
|
54
|
-
const profileFlag = 'profile';
|
|
55
|
-
const forceFlag = 'force';
|
|
56
|
-
describe('command', () => {
|
|
57
|
-
it('should have the correct command structure', () => {
|
|
58
|
-
expect(projectDeployCommand.command).toEqual('deploy');
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
describe('describe', () => {
|
|
62
|
-
it('should provide a description', () => {
|
|
63
|
-
expect(projectDeployCommand.describe).toBeDefined();
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
describe('builder', () => {
|
|
67
|
-
it('should support the correct options', () => {
|
|
68
|
-
projectDeployCommand.builder(yargs);
|
|
69
|
-
expect(conflictsSpy).toHaveBeenCalledTimes(2);
|
|
70
|
-
expect(conflictsSpy).toHaveBeenNthCalledWith(1, profileFlag, projectFlag);
|
|
71
|
-
expect(conflictsSpy).toHaveBeenNthCalledWith(2, profileFlag, 'account');
|
|
72
|
-
expect(optionsSpy).toHaveBeenCalledTimes(1);
|
|
73
|
-
expect(optionsSpy).toHaveBeenCalledWith({
|
|
74
|
-
[projectFlag]: expect.objectContaining({ type: 'string' }),
|
|
75
|
-
[buildFlag]: expect.objectContaining({
|
|
76
|
-
alias: ['build-id'],
|
|
77
|
-
type: 'number',
|
|
78
|
-
}),
|
|
79
|
-
[deployLatestBuildFlag]: expect.objectContaining({
|
|
80
|
-
type: 'boolean',
|
|
81
|
-
alias: ['deploy-latest-build'],
|
|
82
|
-
default: false,
|
|
83
|
-
}),
|
|
84
|
-
[profileFlag]: expect.objectContaining({
|
|
85
|
-
type: 'string',
|
|
86
|
-
alias: ['p'],
|
|
87
|
-
}),
|
|
88
|
-
[forceFlag]: expect.objectContaining({
|
|
89
|
-
type: 'boolean',
|
|
90
|
-
alias: ['f'],
|
|
91
|
-
}),
|
|
92
|
-
});
|
|
93
|
-
expect(addConfigOptions).toHaveBeenCalledTimes(1);
|
|
94
|
-
expect(addConfigOptions).toHaveBeenCalledWith(yargs);
|
|
95
|
-
expect(addAccountOptions).toHaveBeenCalledTimes(1);
|
|
96
|
-
expect(addAccountOptions).toHaveBeenCalledWith(yargs);
|
|
97
|
-
expect(addUseEnvironmentOptions).toHaveBeenCalledTimes(1);
|
|
98
|
-
expect(addUseEnvironmentOptions).toHaveBeenCalledWith(yargs);
|
|
99
|
-
expect(addJSONOutputOptions).toHaveBeenCalledTimes(1);
|
|
100
|
-
expect(addJSONOutputOptions).toHaveBeenCalledWith(yargs);
|
|
101
|
-
});
|
|
102
|
-
it('should provide examples', () => {
|
|
103
|
-
projectDeployCommand.builder(yargs);
|
|
104
|
-
expect(exampleSpy).toHaveBeenCalledTimes(1);
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
describe('handler', () => {
|
|
108
|
-
let projectConfig;
|
|
109
|
-
const accountType = 'STANDARD';
|
|
110
|
-
let args;
|
|
111
|
-
const projectNameFromPrompt = 'project name from prompt';
|
|
112
|
-
const deployDetails = {
|
|
113
|
-
id: 123,
|
|
114
|
-
buildResultType: 'DEPLOY_QUEUED',
|
|
115
|
-
};
|
|
116
|
-
const projectDetailUrl = 'http://project-details-page-url.com';
|
|
117
|
-
beforeEach(() => {
|
|
118
|
-
args = {
|
|
119
|
-
project: 'project name from options',
|
|
120
|
-
buildId: 2,
|
|
121
|
-
derivedAccountId: 1234567890,
|
|
122
|
-
};
|
|
123
|
-
projectConfig = {
|
|
124
|
-
name: 'project name from config',
|
|
125
|
-
srcDir: 'src',
|
|
126
|
-
platformVersion: '2025',
|
|
127
|
-
};
|
|
128
|
-
getProjectConfigSpy.mockResolvedValue({
|
|
129
|
-
projectConfig,
|
|
130
|
-
projectDir: 'projectDir',
|
|
131
|
-
});
|
|
132
|
-
projectNamePromptSpy.mockResolvedValue({
|
|
133
|
-
projectName: projectNameFromPrompt,
|
|
134
|
-
});
|
|
135
|
-
getProjectDetailUrlSpy.mockReturnValue(projectDetailUrl);
|
|
136
|
-
getConfigAccountByIdSpy.mockReturnValue({
|
|
137
|
-
accountId: 123,
|
|
138
|
-
name: 'SuperCoolTestAccount',
|
|
139
|
-
accountType,
|
|
140
|
-
env: 'qa',
|
|
141
|
-
});
|
|
142
|
-
fetchProjectSpy.mockReturnValue(mockHubSpotHttpResponse(exampleProject));
|
|
143
|
-
deployProjectV1Spy.mockReturnValue(mockHubSpotHttpResponse(deployDetails));
|
|
144
|
-
// Spy on process.exit so our tests don't close when it's called
|
|
145
|
-
// @ts-expect-error Doesn't match the actual signature because then the linter complains about unused variables
|
|
146
|
-
processExitSpy.mockImplementation(() => { });
|
|
147
|
-
});
|
|
148
|
-
it('should load the account config for the correct account id', async () => {
|
|
149
|
-
await projectDeployCommand.handler(args);
|
|
150
|
-
expect(getConfigAccountByIdSpy).toHaveBeenCalledTimes(1);
|
|
151
|
-
expect(getConfigAccountByIdSpy).toHaveBeenCalledWith(args.derivedAccountId);
|
|
152
|
-
});
|
|
153
|
-
it('should track the command usage', async () => {
|
|
154
|
-
await projectDeployCommand.handler(args);
|
|
155
|
-
expect(trackCommandUsage).toHaveBeenCalledTimes(1);
|
|
156
|
-
expect(trackCommandUsage).toHaveBeenCalledWith('project-deploy', { type: accountType }, args.derivedAccountId);
|
|
157
|
-
});
|
|
158
|
-
it('should load the project config', async () => {
|
|
159
|
-
await projectDeployCommand.handler(args);
|
|
160
|
-
expect(getProjectConfigSpy).toHaveBeenCalledTimes(1);
|
|
161
|
-
expect(getProjectConfigSpy).toHaveBeenCalled();
|
|
162
|
-
});
|
|
163
|
-
it('should prompt for the project name', async () => {
|
|
164
|
-
await projectDeployCommand.handler(args);
|
|
165
|
-
expect(projectNamePromptSpy).toHaveBeenCalledTimes(1);
|
|
166
|
-
expect(projectNamePromptSpy).toHaveBeenCalledWith(args.derivedAccountId, {
|
|
167
|
-
project: args.project,
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
it('should use the project name from the config is a project args is not provided', async () => {
|
|
171
|
-
delete args.project;
|
|
172
|
-
await projectDeployCommand.handler(args);
|
|
173
|
-
expect(projectNamePromptSpy).toHaveBeenCalledTimes(1);
|
|
174
|
-
expect(projectNamePromptSpy).toHaveBeenCalledWith(args.derivedAccountId, {
|
|
175
|
-
project: projectConfig.name,
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
it('should fetch the project details', async () => {
|
|
179
|
-
await projectDeployCommand.handler(args);
|
|
180
|
-
expect(fetchProjectSpy).toHaveBeenCalledTimes(1);
|
|
181
|
-
expect(fetchProjectSpy).toHaveBeenCalledWith(args.derivedAccountId, projectNameFromPrompt);
|
|
182
|
-
});
|
|
183
|
-
it('should use the name from the prompt if no others are defined', async () => {
|
|
184
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
185
|
-
const { project: __project, ...argsWithoutProject } = args;
|
|
186
|
-
const promptProjectName = 'project name from the prompt';
|
|
187
|
-
projectNamePromptSpy.mockResolvedValue({
|
|
188
|
-
projectName: promptProjectName,
|
|
189
|
-
});
|
|
190
|
-
getProjectConfigSpy.mockResolvedValue({
|
|
191
|
-
projectConfig: null,
|
|
192
|
-
projectDir: null,
|
|
193
|
-
});
|
|
194
|
-
await projectDeployCommand.handler(argsWithoutProject);
|
|
195
|
-
expect(projectNamePromptSpy).toHaveBeenCalledTimes(1);
|
|
196
|
-
expect(projectNamePromptSpy).toHaveBeenCalledWith(args.derivedAccountId, {});
|
|
197
|
-
expect(fetchProjectSpy).toHaveBeenCalledTimes(1);
|
|
198
|
-
expect(fetchProjectSpy).toHaveBeenCalledWith(args.derivedAccountId, promptProjectName);
|
|
199
|
-
});
|
|
200
|
-
it('should log an error and exit when latest build is not defined', async () => {
|
|
201
|
-
fetchProjectSpy.mockReturnValue(mockHubSpotHttpResponse({}));
|
|
202
|
-
await projectDeployCommand.handler(args);
|
|
203
|
-
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
204
|
-
expect(uiLogger.error).toHaveBeenCalledWith('Deploy error: no builds for this project were found.');
|
|
205
|
-
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
206
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
207
|
-
});
|
|
208
|
-
it('should log an error and exit when buildId option is not a valid build', async () => {
|
|
209
|
-
args.buildId = (exampleProject.latestBuild?.buildId ?? 0) + 1;
|
|
210
|
-
await projectDeployCommand.handler(args);
|
|
211
|
-
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
212
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringMatching(`Build ${args.buildId} does not exist for project`));
|
|
213
|
-
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
214
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
215
|
-
});
|
|
216
|
-
it('should log an error and exit when buildId option is already deployed', async () => {
|
|
217
|
-
args.buildId = exampleProject.deployedBuildId;
|
|
218
|
-
await projectDeployCommand.handler(args);
|
|
219
|
-
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
220
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringMatching(`Build ${args.buildId} is already deployed. View project builds in HubSpot.`));
|
|
221
|
-
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
222
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
223
|
-
});
|
|
224
|
-
it('should prompt for build id if no option is provided', async () => {
|
|
225
|
-
delete args.buildId;
|
|
226
|
-
promptUserSpy.mockResolvedValue({
|
|
227
|
-
buildId: exampleProject.latestBuild?.buildId ?? 0,
|
|
228
|
-
});
|
|
229
|
-
await projectDeployCommand.handler(args);
|
|
230
|
-
expect(promptUserSpy).toHaveBeenCalledTimes(1);
|
|
231
|
-
});
|
|
232
|
-
it('should log an error and exit if the prompted value is invalid', async () => {
|
|
233
|
-
delete args.buildId;
|
|
234
|
-
promptUserSpy.mockResolvedValue({});
|
|
235
|
-
await projectDeployCommand.handler(args);
|
|
236
|
-
expect(promptUserSpy).toHaveBeenCalledTimes(1);
|
|
237
|
-
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
238
|
-
expect(uiLogger.error).toHaveBeenCalledWith('You must specify a build to deploy');
|
|
239
|
-
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
240
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
241
|
-
});
|
|
242
|
-
it('should deploy the project', async () => {
|
|
243
|
-
await projectDeployCommand.handler(args);
|
|
244
|
-
expect(deployProjectV1Spy).toHaveBeenCalledTimes(1);
|
|
245
|
-
expect(deployProjectV1Spy).toHaveBeenCalledWith(args.derivedAccountId, projectNameFromPrompt, args.buildId, undefined);
|
|
246
|
-
});
|
|
247
|
-
it('should log an error and exit when the deploy fails', async () => {
|
|
248
|
-
// @ts-expect-error Testing an edge case where the response is empty
|
|
249
|
-
deployProjectV1Spy.mockResolvedValue({});
|
|
250
|
-
await projectDeployCommand.handler(args);
|
|
251
|
-
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
252
|
-
expect(uiLogger.error).toHaveBeenCalledWith(`Deploy error: an unknown error occurred.`);
|
|
253
|
-
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
254
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
255
|
-
});
|
|
256
|
-
it('should poll the deploy status', async () => {
|
|
257
|
-
await projectDeployCommand.handler(args);
|
|
258
|
-
expect(pollDeployStatus).toHaveBeenCalledTimes(1);
|
|
259
|
-
expect(pollDeployStatus).toHaveBeenCalledWith(args.derivedAccountId, projectNameFromPrompt, deployDetails.id, args.buildId);
|
|
260
|
-
});
|
|
261
|
-
it('log an error and exit if a 404 status is returned', async () => {
|
|
262
|
-
const commandReference = 'hs project upload';
|
|
263
|
-
const accountDescription = 'SuperCoolTestAccount';
|
|
264
|
-
uiCommandReferenceSpy.mockReturnValueOnce(commandReference);
|
|
265
|
-
uiAccountDescriptionSpy.mockReturnValueOnce(accountDescription);
|
|
266
|
-
fetchProjectSpy.mockImplementation(() => {
|
|
267
|
-
throw mockHubSpotHttpError('OH NO', {
|
|
268
|
-
status: HttpStatusCode.NotFound,
|
|
269
|
-
data: {},
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
await projectDeployCommand.handler(args);
|
|
273
|
-
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
274
|
-
expect(uiLogger.error).toHaveBeenCalledWith(`The project ${chalk.bold(projectNameFromPrompt)} does not exist in account ${accountDescription}. Run ${commandReference} to upload your project files to HubSpot.`);
|
|
275
|
-
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
276
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
277
|
-
});
|
|
278
|
-
it('log an error and exit if a 400 status is returned', async () => {
|
|
279
|
-
const errorMessage = 'Something bad happened';
|
|
280
|
-
fetchProjectSpy.mockImplementation(() => {
|
|
281
|
-
throw mockHubSpotHttpError(errorMessage, {
|
|
282
|
-
status: HttpStatusCode.BadRequest,
|
|
283
|
-
data: {},
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
await projectDeployCommand.handler(args);
|
|
287
|
-
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
288
|
-
expect(uiLogger.error).toHaveBeenCalledWith('The request was bad.');
|
|
289
|
-
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
290
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
291
|
-
});
|
|
292
|
-
it('log an error another unexpected status code is returned', async () => {
|
|
293
|
-
const errorMessage = 'Something bad happened';
|
|
294
|
-
fetchProjectSpy.mockImplementation(() => {
|
|
295
|
-
throw mockHubSpotHttpError(errorMessage, {
|
|
296
|
-
status: HttpStatusCode.MethodNotAllowed,
|
|
297
|
-
data: {},
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
await projectDeployCommand.handler(args);
|
|
301
|
-
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
302
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining(`The request for 'project deploy' in account ${args.derivedAccountId} failed due to a client error.`));
|
|
303
|
-
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
304
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import * as configLib from '@hubspot/local-dev-lib/config';
|
|
2
|
-
import * as projectConfigLib from '../../../lib/projects/config.js';
|
|
3
|
-
import * as platformVersionLib from '../../../lib/projects/platformVersion.js';
|
|
4
|
-
import * as projectProfilesLib from '../../../lib/projects/projectProfiles.js';
|
|
5
|
-
import * as projectParsingProfiles from '@hubspot/project-parsing-lib/profiles';
|
|
6
|
-
import * as promptUtilsLib from '../../../lib/prompts/promptUtils.js';
|
|
7
|
-
import * as usageTrackingLib from '../../../lib/usageTracking.js';
|
|
8
|
-
import * as errorHandlers from '../../../lib/errorHandlers/index.js';
|
|
9
|
-
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
10
|
-
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
11
|
-
import * as deprecatedFlowLib from '../dev/deprecatedFlow.js';
|
|
12
|
-
import * as unifiedFlowLib from '../dev/unifiedFlow.js';
|
|
13
|
-
import projectDevCommand from '../dev/index.js';
|
|
14
|
-
vi.mock('@hubspot/local-dev-lib/config');
|
|
15
|
-
vi.mock('@hubspot/project-parsing-lib/profiles');
|
|
16
|
-
vi.mock('../../../lib/projects/config.js');
|
|
17
|
-
vi.mock('../../../lib/projects/platformVersion.js');
|
|
18
|
-
vi.mock('../../../lib/projects/projectProfiles.js');
|
|
19
|
-
vi.mock('../../../lib/prompts/promptUtils.js');
|
|
20
|
-
vi.mock('../../../lib/errorHandlers/index.js');
|
|
21
|
-
vi.mock('../../../lib/ui/index.js');
|
|
22
|
-
vi.mock('../dev/deprecatedFlow.js');
|
|
23
|
-
vi.mock('../dev/unifiedFlow.js');
|
|
24
|
-
const getConfigAccountIfExistsSpy = vi.spyOn(configLib, 'getConfigAccountIfExists');
|
|
25
|
-
const getProjectConfigSpy = vi.spyOn(projectConfigLib, 'getProjectConfig');
|
|
26
|
-
const validateProjectConfigSpy = vi.spyOn(projectConfigLib, 'validateProjectConfig');
|
|
27
|
-
const isV2ProjectSpy = vi.spyOn(platformVersionLib, 'isV2Project');
|
|
28
|
-
const loadProfileSpy = vi.spyOn(projectProfilesLib, 'loadProfile');
|
|
29
|
-
const enforceProfileUsageSpy = vi.spyOn(projectProfilesLib, 'enforceProfileUsage');
|
|
30
|
-
const getAllHsProfilesSpy = vi.spyOn(projectParsingProfiles, 'getAllHsProfiles');
|
|
31
|
-
const listPromptSpy = vi.spyOn(promptUtilsLib, 'listPrompt');
|
|
32
|
-
const trackCommandUsageSpy = vi.spyOn(usageTrackingLib, 'trackCommandUsage');
|
|
33
|
-
const logErrorSpy = vi.spyOn(errorHandlers, 'logError');
|
|
34
|
-
const deprecatedProjectDevFlowSpy = vi.spyOn(deprecatedFlowLib, 'deprecatedProjectDevFlow');
|
|
35
|
-
const unifiedProjectDevFlowSpy = vi.spyOn(unifiedFlowLib, 'unifiedProjectDevFlow');
|
|
36
|
-
const processExitSpy = vi.spyOn(process, 'exit');
|
|
37
|
-
describe('commands/project/dev', () => {
|
|
38
|
-
beforeEach(() => {
|
|
39
|
-
// @ts-expect-error Mock implementation
|
|
40
|
-
processExitSpy.mockImplementation(() => { });
|
|
41
|
-
getProjectConfigSpy.mockResolvedValue({
|
|
42
|
-
projectConfig: {
|
|
43
|
-
name: 'test-project',
|
|
44
|
-
srcDir: 'src',
|
|
45
|
-
platformVersion: 'v2',
|
|
46
|
-
},
|
|
47
|
-
projectDir: '/test/project',
|
|
48
|
-
});
|
|
49
|
-
validateProjectConfigSpy.mockImplementation(() => { });
|
|
50
|
-
isV2ProjectSpy.mockReturnValue(true);
|
|
51
|
-
trackCommandUsageSpy.mockImplementation(async () => { });
|
|
52
|
-
deprecatedProjectDevFlowSpy.mockResolvedValue(undefined);
|
|
53
|
-
unifiedProjectDevFlowSpy.mockResolvedValue(undefined);
|
|
54
|
-
enforceProfileUsageSpy.mockResolvedValue(undefined);
|
|
55
|
-
getAllHsProfilesSpy.mockResolvedValue([]);
|
|
56
|
-
listPromptSpy.mockResolvedValue('dev');
|
|
57
|
-
});
|
|
58
|
-
describe('command', () => {
|
|
59
|
-
it('should have the correct command structure', () => {
|
|
60
|
-
expect(projectDevCommand.command).toEqual('dev');
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
describe('describe', () => {
|
|
64
|
-
it('should provide a description', () => {
|
|
65
|
-
expect(projectDevCommand.describe).toBeDefined();
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
describe('builder', () => {
|
|
69
|
-
it('should be a function', () => {
|
|
70
|
-
expect(typeof projectDevCommand.builder).toBe('function');
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
describe('handler', () => {
|
|
74
|
-
let args;
|
|
75
|
-
beforeEach(() => {
|
|
76
|
-
args = {
|
|
77
|
-
derivedAccountId: 123456,
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
describe('validation', () => {
|
|
81
|
-
it('should validate project config', async () => {
|
|
82
|
-
await projectDevCommand.handler(args);
|
|
83
|
-
expect(validateProjectConfigSpy).toHaveBeenCalledWith({
|
|
84
|
-
name: 'test-project',
|
|
85
|
-
srcDir: 'src',
|
|
86
|
-
platformVersion: 'v2',
|
|
87
|
-
}, '/test/project');
|
|
88
|
-
});
|
|
89
|
-
it('should exit if project config validation fails', async () => {
|
|
90
|
-
const error = new Error('Invalid config');
|
|
91
|
-
validateProjectConfigSpy.mockImplementation(() => {
|
|
92
|
-
throw error;
|
|
93
|
-
});
|
|
94
|
-
await projectDevCommand.handler(args);
|
|
95
|
-
expect(logErrorSpy).toHaveBeenCalledWith(error);
|
|
96
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
97
|
-
});
|
|
98
|
-
it('should exit if no project directory', async () => {
|
|
99
|
-
getProjectConfigSpy.mockResolvedValue({
|
|
100
|
-
projectConfig: {
|
|
101
|
-
name: 'test-project',
|
|
102
|
-
srcDir: 'src',
|
|
103
|
-
platformVersion: 'v2',
|
|
104
|
-
},
|
|
105
|
-
projectDir: null,
|
|
106
|
-
});
|
|
107
|
-
// Make process.exit actually throw to stop execution
|
|
108
|
-
processExitSpy.mockImplementation((code) => {
|
|
109
|
-
throw new Error(`process.exit called with ${code}`);
|
|
110
|
-
});
|
|
111
|
-
await expect(projectDevCommand.handler(args)).rejects.toThrow('process.exit called');
|
|
112
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('project'));
|
|
113
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
114
|
-
});
|
|
115
|
-
it('should error if using testingAccount and projectAccount with legacy project', async () => {
|
|
116
|
-
isV2ProjectSpy.mockReturnValue(false);
|
|
117
|
-
args.testingAccount = '111111';
|
|
118
|
-
args.projectAccount = '222222';
|
|
119
|
-
await projectDevCommand.handler(args);
|
|
120
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('--project-account and --testing-account'));
|
|
121
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
122
|
-
});
|
|
123
|
-
it('should error if using account flag with V2 project', async () => {
|
|
124
|
-
isV2ProjectSpy.mockReturnValue(true);
|
|
125
|
-
args.userProvidedAccount = '123456';
|
|
126
|
-
await projectDevCommand.handler(args);
|
|
127
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('--account flag'));
|
|
128
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
describe('account resolution', () => {
|
|
132
|
-
it('should use projectAccount flag', async () => {
|
|
133
|
-
args.projectAccount = '999999';
|
|
134
|
-
getConfigAccountIfExistsSpy.mockReturnValue({
|
|
135
|
-
accountId: 999999,
|
|
136
|
-
});
|
|
137
|
-
await projectDevCommand.handler(args);
|
|
138
|
-
expect(getConfigAccountIfExistsSpy).toHaveBeenCalledWith('999999');
|
|
139
|
-
expect(trackCommandUsageSpy).toHaveBeenCalledWith('project-dev', {}, 999999);
|
|
140
|
-
});
|
|
141
|
-
it('should use userProvidedAccount for legacy projects', async () => {
|
|
142
|
-
isV2ProjectSpy.mockReturnValue(false);
|
|
143
|
-
args.userProvidedAccount = '888888';
|
|
144
|
-
args.derivedAccountId = 888888;
|
|
145
|
-
await projectDevCommand.handler(args);
|
|
146
|
-
expect(trackCommandUsageSpy).toHaveBeenCalledWith('project-dev', {}, 888888);
|
|
147
|
-
});
|
|
148
|
-
it('should use profile accountId when profile specified', async () => {
|
|
149
|
-
args.profile = 'test-profile';
|
|
150
|
-
loadProfileSpy.mockReturnValue({
|
|
151
|
-
accountId: 777777,
|
|
152
|
-
});
|
|
153
|
-
await projectDevCommand.handler(args);
|
|
154
|
-
expect(loadProfileSpy).toHaveBeenCalledWith({
|
|
155
|
-
name: 'test-project',
|
|
156
|
-
srcDir: 'src',
|
|
157
|
-
platformVersion: 'v2',
|
|
158
|
-
}, '/test/project', 'test-profile');
|
|
159
|
-
expect(trackCommandUsageSpy).toHaveBeenCalledWith('project-dev', {}, 777777);
|
|
160
|
-
});
|
|
161
|
-
it('should exit if profile loading fails', async () => {
|
|
162
|
-
args.profile = 'invalid-profile';
|
|
163
|
-
const error = new Error('Profile not found');
|
|
164
|
-
loadProfileSpy.mockImplementation(() => {
|
|
165
|
-
throw error;
|
|
166
|
-
});
|
|
167
|
-
// Make process.exit actually throw to stop execution
|
|
168
|
-
processExitSpy.mockImplementation((code) => {
|
|
169
|
-
throw new Error(`process.exit called with ${code}`);
|
|
170
|
-
});
|
|
171
|
-
await expect(projectDevCommand.handler(args)).rejects.toThrow('process.exit called');
|
|
172
|
-
expect(logErrorSpy).toHaveBeenCalledWith(error);
|
|
173
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
174
|
-
});
|
|
175
|
-
it('should prompt for profile selection when profiles exist and no profile is specified', async () => {
|
|
176
|
-
getAllHsProfilesSpy.mockResolvedValue(['dev', 'prod']);
|
|
177
|
-
listPromptSpy.mockResolvedValue('dev');
|
|
178
|
-
loadProfileSpy.mockReturnValue({
|
|
179
|
-
accountId: 789012,
|
|
180
|
-
variables: {},
|
|
181
|
-
});
|
|
182
|
-
await projectDevCommand.handler(args);
|
|
183
|
-
expect(getAllHsProfilesSpy).toHaveBeenCalledWith('/test/project/src');
|
|
184
|
-
expect(listPromptSpy).toHaveBeenCalledWith(expect.any(String), {
|
|
185
|
-
choices: ['dev', 'prod'],
|
|
186
|
-
});
|
|
187
|
-
expect(loadProfileSpy).toHaveBeenCalledWith({
|
|
188
|
-
name: 'test-project',
|
|
189
|
-
srcDir: 'src',
|
|
190
|
-
platformVersion: 'v2',
|
|
191
|
-
}, '/test/project', 'dev');
|
|
192
|
-
expect(trackCommandUsageSpy).toHaveBeenCalledWith('project-dev', {}, 789012);
|
|
193
|
-
});
|
|
194
|
-
it('should exit if profile loading fails after selection', async () => {
|
|
195
|
-
getAllHsProfilesSpy.mockResolvedValue(['dev', 'prod']);
|
|
196
|
-
listPromptSpy.mockResolvedValue('dev');
|
|
197
|
-
const error = new Error('Failed to load profile');
|
|
198
|
-
loadProfileSpy.mockImplementation(() => {
|
|
199
|
-
throw error;
|
|
200
|
-
});
|
|
201
|
-
// Make process.exit actually throw to stop execution
|
|
202
|
-
processExitSpy.mockImplementation((code) => {
|
|
203
|
-
throw new Error(`process.exit called with ${code}`);
|
|
204
|
-
});
|
|
205
|
-
await expect(projectDevCommand.handler(args)).rejects.toThrow('process.exit called');
|
|
206
|
-
expect(logErrorSpy).toHaveBeenCalledWith(error);
|
|
207
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
208
|
-
});
|
|
209
|
-
it('should use derivedAccountId as fallback', async () => {
|
|
210
|
-
await projectDevCommand.handler(args);
|
|
211
|
-
expect(trackCommandUsageSpy).toHaveBeenCalledWith('project-dev', {}, 123456);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
describe('dev flow execution', () => {
|
|
215
|
-
it('should track command usage', async () => {
|
|
216
|
-
await projectDevCommand.handler(args);
|
|
217
|
-
expect(trackCommandUsageSpy).toHaveBeenCalledWith('project-dev', {}, 123456);
|
|
218
|
-
});
|
|
219
|
-
it('should run unified flow for V2 projects', async () => {
|
|
220
|
-
isV2ProjectSpy.mockReturnValue(true);
|
|
221
|
-
await projectDevCommand.handler(args);
|
|
222
|
-
expect(unifiedProjectDevFlowSpy).toHaveBeenCalledWith({
|
|
223
|
-
args,
|
|
224
|
-
targetProjectAccountId: 123456,
|
|
225
|
-
providedTargetTestingAccountId: undefined,
|
|
226
|
-
projectConfig: {
|
|
227
|
-
name: 'test-project',
|
|
228
|
-
srcDir: 'src',
|
|
229
|
-
platformVersion: 'v2',
|
|
230
|
-
},
|
|
231
|
-
projectDir: '/test/project',
|
|
232
|
-
profileConfig: undefined,
|
|
233
|
-
});
|
|
234
|
-
expect(deprecatedProjectDevFlowSpy).not.toHaveBeenCalled();
|
|
235
|
-
});
|
|
236
|
-
it('should run deprecated flow for legacy projects', async () => {
|
|
237
|
-
isV2ProjectSpy.mockReturnValue(false);
|
|
238
|
-
await projectDevCommand.handler(args);
|
|
239
|
-
expect(deprecatedProjectDevFlowSpy).toHaveBeenCalledWith({
|
|
240
|
-
args,
|
|
241
|
-
accountId: 123456,
|
|
242
|
-
projectConfig: {
|
|
243
|
-
name: 'test-project',
|
|
244
|
-
srcDir: 'src',
|
|
245
|
-
platformVersion: 'v2',
|
|
246
|
-
},
|
|
247
|
-
projectDir: '/test/project',
|
|
248
|
-
});
|
|
249
|
-
expect(unifiedProjectDevFlowSpy).not.toHaveBeenCalled();
|
|
250
|
-
});
|
|
251
|
-
it('should pass testingAccount to unified flow', async () => {
|
|
252
|
-
isV2ProjectSpy.mockReturnValue(true);
|
|
253
|
-
args.testingAccount = '555555';
|
|
254
|
-
getConfigAccountIfExistsSpy.mockReturnValue({
|
|
255
|
-
accountId: 555555,
|
|
256
|
-
});
|
|
257
|
-
await projectDevCommand.handler(args);
|
|
258
|
-
expect(unifiedProjectDevFlowSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
259
|
-
providedTargetTestingAccountId: 555555,
|
|
260
|
-
}));
|
|
261
|
-
});
|
|
262
|
-
it('should pass profile config to unified flow', async () => {
|
|
263
|
-
args.profile = 'dev-profile';
|
|
264
|
-
const profileConfig = { accountId: 666666 };
|
|
265
|
-
loadProfileSpy.mockReturnValue(profileConfig);
|
|
266
|
-
await projectDevCommand.handler(args);
|
|
267
|
-
expect(unifiedProjectDevFlowSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
268
|
-
profileConfig,
|
|
269
|
-
}));
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|