@hubspot/cli 8.0.11-experimental.0 → 8.0.11-experimental.2
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/api/migrate.js +3 -3
- package/bin/cli.js +5 -0
- package/commands/account/auth.js +12 -22
- package/commands/account/clean.js +5 -6
- package/commands/account/createOverride.js +7 -7
- package/commands/account/info.js +2 -1
- package/commands/account/list.js +3 -5
- package/commands/account/remove.js +2 -3
- package/commands/account/removeOverride.js +8 -10
- package/commands/account/rename.js +5 -6
- package/commands/account/use.js +8 -19
- package/commands/api.d.ts +10 -0
- package/commands/api.js +164 -0
- package/commands/app/migrate.js +12 -12
- package/commands/app/secret/add.js +6 -7
- package/commands/app/secret/delete.js +9 -10
- package/commands/app/secret/list.js +6 -7
- package/commands/app/secret/update.js +8 -9
- package/commands/auth.js +12 -12
- package/commands/cms/app/create.js +9 -5
- package/commands/cms/convertFields.js +8 -8
- package/commands/cms/delete.js +2 -3
- package/commands/cms/fetch.js +7 -7
- package/commands/cms/function/create.js +9 -5
- package/commands/cms/function/deploy.js +2 -3
- package/commands/cms/function/list.js +11 -7
- package/commands/cms/function/logs.js +17 -23
- package/commands/cms/function/server.js +2 -3
- package/commands/cms/getReactModule.js +7 -8
- package/commands/cms/lighthouseScore.js +25 -24
- package/commands/cms/lint.js +4 -5
- package/commands/cms/list.js +5 -6
- package/commands/cms/module/create.js +9 -5
- package/commands/cms/module/marketplace-validate.js +7 -8
- package/commands/cms/mv.js +2 -3
- package/commands/cms/template/create.js +10 -6
- package/commands/cms/theme/create.js +5 -5
- package/commands/cms/theme/generate-selectors.js +5 -4
- package/commands/cms/theme/marketplace-validate.js +8 -9
- package/commands/cms/theme/preview.js +16 -8
- package/commands/cms/upload.js +15 -12
- package/commands/cms/watch.js +5 -5
- package/commands/cms/webpack/create.js +5 -5
- package/commands/completion.js +3 -5
- package/commands/config/migrate.js +6 -7
- package/commands/config/set.js +5 -6
- package/commands/customObject/create.js +4 -5
- package/commands/customObject/createSchema.js +4 -5
- package/commands/customObject/deleteSchema.js +4 -5
- package/commands/customObject/fetchAllSchemas.js +2 -3
- package/commands/customObject/fetchSchema.js +2 -3
- package/commands/customObject/listSchemas.js +2 -3
- package/commands/customObject/updateSchema.js +4 -5
- package/commands/doctor.js +8 -8
- package/commands/feedback.js +6 -4
- package/commands/filemanager/fetch.js +5 -6
- package/commands/filemanager/upload.js +5 -5
- package/commands/getStarted.js +16 -18
- package/commands/hubdb/clear.js +5 -6
- package/commands/hubdb/create.js +4 -5
- package/commands/hubdb/delete.js +8 -9
- package/commands/hubdb/fetch.js +5 -6
- package/commands/hubdb/list.js +16 -14
- package/commands/init.js +14 -17
- package/commands/mcp/setup.js +5 -6
- package/commands/mcp/start.js +2 -3
- package/commands/open.js +4 -5
- package/commands/project/add.js +13 -8
- package/commands/project/create.js +20 -17
- package/commands/project/delete.d.ts +7 -0
- package/commands/project/delete.js +74 -0
- package/commands/project/deploy.js +39 -36
- package/commands/project/dev/deprecatedFlow.js +42 -15
- package/commands/project/dev/index.d.ts +3 -3
- package/commands/project/dev/index.js +29 -34
- package/commands/project/dev/unifiedFlow.js +37 -14
- package/commands/project/download.js +10 -11
- package/commands/project/info.js +19 -19
- package/commands/project/installDeps.js +9 -6
- package/commands/project/lint.js +11 -8
- package/commands/project/list.js +14 -14
- package/commands/project/listBuilds.js +8 -6
- package/commands/project/logs.js +5 -6
- package/commands/project/migrate.js +13 -13
- package/commands/project/open.js +5 -6
- package/commands/project/profile/add.js +12 -8
- package/commands/project/profile/delete.js +15 -11
- package/commands/project/updateDeps.js +9 -6
- package/commands/project/upload.js +33 -19
- package/commands/project/validate.js +12 -12
- package/commands/project/watch.js +22 -22
- package/commands/project.js +8 -3
- package/commands/sandbox/create.js +15 -15
- package/commands/sandbox/delete.js +13 -14
- package/commands/secret/addSecret.js +6 -7
- package/commands/secret/deleteSecret.js +5 -6
- package/commands/secret/listSecret.js +2 -3
- package/commands/secret/updateSecret.js +4 -5
- package/commands/testAccount/create.d.ts +1 -1
- package/commands/testAccount/create.js +24 -20
- package/commands/testAccount/createConfig.js +7 -8
- package/commands/testAccount/delete.js +27 -18
- package/commands/testAccount/importData.js +6 -7
- package/commands/upgrade.js +9 -10
- package/lang/en.d.ts +95 -7
- package/lang/en.js +98 -13
- package/lib/accountAuth.js +2 -2
- package/lib/app/migrate.js +7 -0
- package/lib/buildAccount.js +3 -3
- package/lib/constants.d.ts +0 -1
- package/lib/constants.js +0 -1
- package/lib/doctor/Diagnosis.js +5 -5
- package/lib/doctor/Doctor.js +2 -2
- package/lib/errorHandlers/index.js +4 -3
- package/lib/errorHandlers/suppressError.js +4 -0
- package/lib/errors/PromptExitError.d.ts +4 -2
- package/lib/errors/PromptExitError.js +3 -0
- package/lib/getStartedV2Actions.js +2 -2
- package/lib/hasFeature.js +1 -2
- package/lib/middleware/autoUpdateMiddleware.js +6 -3
- package/lib/process.d.ts +1 -1
- package/lib/process.js +10 -3
- package/lib/projects/ProjectLogsManager.js +2 -2
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/v2.js +3 -4
- package/lib/projects/delete.d.ts +13 -0
- package/lib/projects/delete.js +193 -0
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.js +11 -11
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +3 -1
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +2 -2
- package/lib/projects/localDev/DevSessionManager.d.ts +6 -3
- package/lib/projects/localDev/DevSessionManager.js +31 -19
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.d.ts +3 -0
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +16 -12
- package/lib/projects/localDev/LocalDevProcess.js +6 -5
- package/lib/projects/localDev/LocalDevState.d.ts +3 -2
- package/lib/projects/localDev/LocalDevState.js +3 -1
- package/lib/projects/localDev/helpers/account.d.ts +4 -3
- package/lib/projects/localDev/helpers/account.js +16 -19
- package/lib/projects/localDev/helpers/process.d.ts +1 -1
- package/lib/projects/localDev/helpers/process.js +4 -10
- package/lib/projects/localDev/helpers/project.d.ts +4 -3
- package/lib/projects/localDev/helpers/project.js +31 -15
- package/lib/projects/projectInfo.d.ts +3 -20
- package/lib/projects/projectInfo.js +32 -54
- package/lib/projects/projectProfiles.d.ts +1 -2
- package/lib/projects/projectProfiles.js +5 -17
- package/lib/projects/upload.js +22 -3
- package/lib/projects/workspaces.d.ts +42 -0
- package/lib/projects/workspaces.js +350 -0
- package/lib/prompts/createApiSamplePrompt.js +4 -0
- package/lib/prompts/projectProfilePrompt.d.ts +2 -0
- package/lib/prompts/projectProfilePrompt.js +46 -0
- package/lib/prompts/promptUtils.js +3 -2
- package/lib/prompts/selectHubDBTablePrompt.js +2 -2
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +2 -2
- package/lib/theme/cmsDevServerProcess.d.ts +2 -0
- package/lib/theme/cmsDevServerProcess.js +8 -7
- package/lib/ui/SpinniesManager.d.ts +1 -0
- package/lib/ui/SpinniesManager.js +20 -6
- package/lib/ui/spinniesUtils.d.ts +0 -1
- package/lib/ui/spinniesUtils.js +6 -16
- package/lib/usageTracking.d.ts +3 -4
- package/lib/yargs/makeYargsBuilder.d.ts +13 -0
- package/lib/yargs/makeYargsBuilder.js +33 -0
- package/lib/yargs/makeYargsHandlerWithUsageTracking.d.ts +3 -0
- package/lib/yargs/makeYargsHandlerWithUsageTracking.js +95 -0
- package/lib/yargs/strictEnforceBoolean.d.ts +1 -0
- package/lib/yargs/strictEnforceBoolean.js +13 -0
- package/lib/yargsUtils.d.ts +3 -16
- package/lib/yargsUtils.js +3 -48
- package/mcp-server/Tool.d.ts +15 -0
- package/mcp-server/Tool.js +53 -0
- package/mcp-server/server.js +5 -3
- package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +8 -6
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.js +8 -6
- package/mcp-server/tools/cms/HsCreateTemplateTool.d.ts +5 -3
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +8 -6
- package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +8 -6
- package/mcp-server/tools/cms/HsListFunctionsTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +8 -6
- package/mcp-server/tools/cms/HsListTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsListTool.js +8 -6
- package/mcp-server/tools/index.d.ts +3 -2
- package/mcp-server/tools/index.js +22 -22
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +6 -4
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +8 -6
- package/mcp-server/tools/project/CreateProjectTool.d.ts +6 -4
- package/mcp-server/tools/project/CreateProjectTool.js +9 -7
- package/mcp-server/tools/project/CreateTestAccountTool.d.ts +4 -2
- package/mcp-server/tools/project/CreateTestAccountTool.js +20 -8
- package/mcp-server/tools/project/DeployProjectTool.d.ts +4 -2
- package/mcp-server/tools/project/DeployProjectTool.js +4 -6
- package/mcp-server/tools/project/DocFetchTool.d.ts +4 -2
- package/mcp-server/tools/project/DocFetchTool.js +8 -6
- package/mcp-server/tools/project/DocsSearchTool.d.ts +9 -3
- package/mcp-server/tools/project/DocsSearchTool.js +32 -9
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +4 -2
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +8 -6
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +4 -2
- package/mcp-server/tools/project/GetApplicationInfoTool.js +8 -6
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +4 -2
- package/mcp-server/tools/project/GetBuildLogsTool.js +8 -6
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +4 -2
- package/mcp-server/tools/project/GetBuildStatusTool.js +8 -6
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +4 -2
- package/mcp-server/tools/project/GetConfigValuesTool.js +12 -7
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +4 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +4 -6
- package/mcp-server/tools/project/UploadProjectTools.d.ts +4 -2
- package/mcp-server/tools/project/UploadProjectTools.js +9 -7
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +4 -2
- package/mcp-server/tools/project/ValidateProjectTool.js +8 -6
- package/mcp-server/tools/project/constants.d.ts +2 -2
- package/mcp-server/types.d.ts +0 -7
- package/mcp-server/types.js +1 -13
- package/mcp-server/utils/logger.d.ts +10 -0
- package/mcp-server/utils/logger.js +29 -0
- package/mcp-server/utils/toolUsageTracking.js +0 -2
- package/package.json +12 -7
- package/types/LocalDev.d.ts +5 -0
- package/types/Projects.d.ts +19 -0
- package/types/Yargs.d.ts +18 -1
- 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__/info.test.d.ts +0 -1
- package/commands/project/__tests__/info.test.js +0 -145
- 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__/projectInfo.test.d.ts +0 -1
- package/lib/projects/__tests__/projectInfo.test.js +0 -114
- 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/projects/platformVersion.d.ts +0 -9
- package/lib/projects/platformVersion.js +0 -39
- 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,23 +1,23 @@
|
|
|
1
1
|
import { updatePackages, getProjectPackageJsonLocations, } from '../../lib/dependencyManagement.js';
|
|
2
2
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
3
|
+
import { isPromptExitError } from '../../lib/errors/PromptExitError.js';
|
|
3
4
|
import { getProjectConfig } from '../../lib/projects/config.js';
|
|
4
5
|
import { promptUser } from '../../lib/prompts/promptUtils.js';
|
|
5
6
|
import path from 'path';
|
|
6
7
|
import { commands } from '../../lang/en.js';
|
|
7
8
|
import { uiLogger } from '../../lib/ui/logger.js';
|
|
8
|
-
import {
|
|
9
|
+
import { makeYargsHandlerWithUsageTracking } from '../../lib/yargs/makeYargsHandlerWithUsageTracking.js';
|
|
9
10
|
import { logError } from '../../lib/errorHandlers/index.js';
|
|
10
11
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
11
12
|
const command = 'update-deps [packages..]';
|
|
12
13
|
const describe = commands.project.updateDeps.help.describe;
|
|
13
14
|
async function handler(args) {
|
|
14
|
-
const {
|
|
15
|
+
const { packages, exit } = args;
|
|
15
16
|
try {
|
|
16
|
-
trackCommandUsage('project-update-deps', undefined, derivedAccountId);
|
|
17
17
|
const projectConfig = await getProjectConfig();
|
|
18
18
|
if (!projectConfig || !projectConfig.projectDir) {
|
|
19
19
|
uiLogger.error(commands.project.updateDeps.noProjectConfig);
|
|
20
|
-
return
|
|
20
|
+
return exit(EXIT_CODES.ERROR);
|
|
21
21
|
}
|
|
22
22
|
const { projectDir } = projectConfig;
|
|
23
23
|
let installLocations = await getProjectPackageJsonLocations();
|
|
@@ -50,8 +50,11 @@ async function handler(args) {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
catch (e) {
|
|
53
|
+
if (isPromptExitError(e)) {
|
|
54
|
+
throw e;
|
|
55
|
+
}
|
|
53
56
|
logError(e);
|
|
54
|
-
return
|
|
57
|
+
return exit(EXIT_CODES.ERROR);
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
function projectUpdateDepsBuilder(yargs) {
|
|
@@ -74,7 +77,7 @@ const builder = makeYargsBuilder(projectUpdateDepsBuilder, command, describe, {
|
|
|
74
77
|
const projectUpdateDepsCommand = {
|
|
75
78
|
command,
|
|
76
79
|
describe,
|
|
77
|
-
handler,
|
|
80
|
+
handler: makeYargsHandlerWithUsageTracking('project-update-deps', handler),
|
|
78
81
|
builder,
|
|
79
82
|
};
|
|
80
83
|
export default projectUpdateDepsCommand;
|
|
@@ -2,8 +2,7 @@ import chalk from 'chalk';
|
|
|
2
2
|
import { uiLogger } from '../../lib/ui/logger.js';
|
|
3
3
|
import { getConfigAccountById } from '@hubspot/local-dev-lib/config';
|
|
4
4
|
import { isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
5
|
-
import {
|
|
6
|
-
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
5
|
+
import { isLegacyProject } from '@hubspot/project-parsing-lib/projects';
|
|
7
6
|
import { getProjectConfig, validateProjectConfig, } from '../../lib/projects/config.js';
|
|
8
7
|
import { logFeedbackMessage } from '../../lib/projects/ui.js';
|
|
9
8
|
import { handleProjectUpload } from '../../lib/projects/upload.js';
|
|
@@ -13,11 +12,13 @@ import { commands } from '../../lang/en.js';
|
|
|
13
12
|
import { PROJECT_ERROR_TYPES } from '../../lib/constants.js';
|
|
14
13
|
import { logError, ApiErrorContext } from '../../lib/errorHandlers/index.js';
|
|
15
14
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
15
|
+
import { makeYargsHandlerWithUsageTracking } from '../../lib/yargs/makeYargsHandlerWithUsageTracking.js';
|
|
16
16
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
17
|
+
import { projectProfilePrompt } from '../../lib/prompts/projectProfilePrompt.js';
|
|
17
18
|
const command = 'upload';
|
|
18
19
|
const describe = commands.project.upload.describe;
|
|
19
20
|
async function handler(args) {
|
|
20
|
-
const { forceCreate, message, derivedAccountId, skipValidation, formatOutputAsJson, profile, } = args;
|
|
21
|
+
const { forceCreate, message, derivedAccountId, skipValidation, formatOutputAsJson, profile: profileOption, useEnv: useEnvOption, exit, addUsageMetadata, } = args;
|
|
21
22
|
const jsonOutput = {};
|
|
22
23
|
const { projectConfig, projectDir } = await getProjectConfig();
|
|
23
24
|
try {
|
|
@@ -25,34 +26,47 @@ async function handler(args) {
|
|
|
25
26
|
}
|
|
26
27
|
catch (error) {
|
|
27
28
|
logError(error);
|
|
28
|
-
|
|
29
|
+
return exit(EXIT_CODES.ERROR);
|
|
30
|
+
}
|
|
31
|
+
if (!projectDir) {
|
|
32
|
+
uiLogger.error(commands.project.upload.errors.noProjectConfig);
|
|
33
|
+
return exit(EXIT_CODES.ERROR);
|
|
29
34
|
}
|
|
30
35
|
let targetAccountId;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
let profileName = args.profile;
|
|
37
|
+
if (!isLegacyProject(projectConfig?.platformVersion)) {
|
|
38
|
+
try {
|
|
39
|
+
const profileNamePromptResult = await projectProfilePrompt(projectDir, projectConfig, profileOption, !!useEnvOption);
|
|
40
|
+
if (profileNamePromptResult) {
|
|
41
|
+
profileName = profileNamePromptResult;
|
|
42
|
+
const profile = await loadAndValidateProfile(projectConfig, projectDir, profileName);
|
|
43
|
+
targetAccountId = profile.accountId;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
logError(error);
|
|
48
|
+
return exit(EXIT_CODES.ERROR);
|
|
34
49
|
}
|
|
35
|
-
}
|
|
36
|
-
catch (err) {
|
|
37
|
-
logError(err);
|
|
38
|
-
process.exit(EXIT_CODES.ERROR);
|
|
39
50
|
}
|
|
40
51
|
targetAccountId = targetAccountId || derivedAccountId;
|
|
41
52
|
const accountConfig = getConfigAccountById(targetAccountId);
|
|
42
53
|
const accountType = accountConfig && accountConfig.accountType;
|
|
43
|
-
|
|
54
|
+
addUsageMetadata({
|
|
55
|
+
type: accountType,
|
|
56
|
+
assetType: projectConfig.platformVersion,
|
|
57
|
+
});
|
|
44
58
|
try {
|
|
45
59
|
const { result, uploadError } = await handleProjectUpload({
|
|
46
60
|
accountId: targetAccountId,
|
|
47
61
|
projectConfig,
|
|
48
|
-
projectDir
|
|
62
|
+
projectDir,
|
|
49
63
|
callbackFunc: pollProjectBuildAndDeploy,
|
|
50
64
|
uploadMessage: message,
|
|
51
65
|
forceCreate,
|
|
52
66
|
isUploadCommand: true,
|
|
53
|
-
sendIR:
|
|
67
|
+
sendIR: !isLegacyProject(projectConfig.platformVersion),
|
|
54
68
|
skipValidation,
|
|
55
|
-
profile:
|
|
69
|
+
profile: profileName,
|
|
56
70
|
});
|
|
57
71
|
if (uploadError) {
|
|
58
72
|
if (isSpecifiedError(uploadError, {
|
|
@@ -68,7 +82,7 @@ async function handler(args) {
|
|
|
68
82
|
request: 'project upload',
|
|
69
83
|
}));
|
|
70
84
|
}
|
|
71
|
-
|
|
85
|
+
return exit(EXIT_CODES.ERROR);
|
|
72
86
|
}
|
|
73
87
|
if (result && result.succeeded && !result.buildResult.isAutoDeployEnabled) {
|
|
74
88
|
uiLogger.log(chalk.bold(commands.project.upload.logs.buildSucceeded(result.buildId)));
|
|
@@ -88,12 +102,12 @@ async function handler(args) {
|
|
|
88
102
|
accountId: targetAccountId,
|
|
89
103
|
request: 'project upload',
|
|
90
104
|
}));
|
|
91
|
-
|
|
105
|
+
return exit(EXIT_CODES.ERROR);
|
|
92
106
|
}
|
|
93
107
|
if (formatOutputAsJson) {
|
|
94
108
|
uiLogger.json(jsonOutput);
|
|
95
109
|
}
|
|
96
|
-
|
|
110
|
+
return exit(EXIT_CODES.SUCCESS);
|
|
97
111
|
}
|
|
98
112
|
function projectUploadBuilder(yargs) {
|
|
99
113
|
yargs.options({
|
|
@@ -139,7 +153,7 @@ const builder = makeYargsBuilder(projectUploadBuilder, command, describe, {
|
|
|
139
153
|
const projectUploadCommand = {
|
|
140
154
|
command,
|
|
141
155
|
describe,
|
|
142
|
-
handler,
|
|
156
|
+
handler: makeYargsHandlerWithUsageTracking('project-upload', handler),
|
|
143
157
|
builder,
|
|
144
158
|
};
|
|
145
159
|
export default projectUploadCommand;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { getConfigAccountById } from '@hubspot/local-dev-lib/config';
|
|
3
|
-
import {
|
|
4
|
-
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
3
|
+
import { isLegacyProject } from '@hubspot/project-parsing-lib/projects';
|
|
5
4
|
import { uiLogger } from '../../lib/ui/logger.js';
|
|
6
5
|
import { getProjectConfig, validateProjectConfig, } from '../../lib/projects/config.js';
|
|
7
6
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
7
|
+
import { makeYargsHandlerWithUsageTracking } from '../../lib/yargs/makeYargsHandlerWithUsageTracking.js';
|
|
8
8
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
9
9
|
import { validateSourceDirectory, handleTranslate, } from '../../lib/projects/upload.js';
|
|
10
10
|
import { commands } from '../../lang/en.js';
|
|
@@ -15,25 +15,25 @@ import SpinniesManager from '../../lib/ui/SpinniesManager.js';
|
|
|
15
15
|
const command = 'validate';
|
|
16
16
|
const describe = commands.project.validate.describe;
|
|
17
17
|
async function handler(args) {
|
|
18
|
-
const { derivedAccountId, profile } = args;
|
|
18
|
+
const { derivedAccountId, profile, exit, addUsageMetadata } = args;
|
|
19
19
|
const { projectConfig, projectDir } = await getProjectConfig();
|
|
20
20
|
const accountConfig = getConfigAccountById(derivedAccountId);
|
|
21
21
|
const accountType = accountConfig && accountConfig.accountType;
|
|
22
|
-
|
|
22
|
+
addUsageMetadata({ type: accountType });
|
|
23
23
|
if (!projectConfig || !projectDir) {
|
|
24
24
|
uiLogger.error(commands.project.validate.mustBeRanWithinAProject);
|
|
25
|
-
|
|
25
|
+
return exit(EXIT_CODES.ERROR);
|
|
26
26
|
}
|
|
27
|
-
if (
|
|
27
|
+
if (isLegacyProject(projectConfig.platformVersion)) {
|
|
28
28
|
uiLogger.error(commands.project.validate.badVersion);
|
|
29
|
-
|
|
29
|
+
return exit(EXIT_CODES.ERROR);
|
|
30
30
|
}
|
|
31
31
|
try {
|
|
32
32
|
validateProjectConfig(projectConfig, projectDir);
|
|
33
33
|
}
|
|
34
34
|
catch (error) {
|
|
35
35
|
logError(error);
|
|
36
|
-
|
|
36
|
+
return exit(EXIT_CODES.ERROR);
|
|
37
37
|
}
|
|
38
38
|
let validationSucceeded = true;
|
|
39
39
|
const srcDir = path.resolve(projectDir, projectConfig.srcDir);
|
|
@@ -100,17 +100,17 @@ async function handler(args) {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
if (!validationSucceeded) {
|
|
103
|
-
|
|
103
|
+
return exit(EXIT_CODES.ERROR);
|
|
104
104
|
}
|
|
105
105
|
try {
|
|
106
106
|
await validateSourceDirectory(srcDir, projectConfig, projectDir);
|
|
107
107
|
}
|
|
108
108
|
catch (e) {
|
|
109
109
|
logError(e);
|
|
110
|
-
|
|
110
|
+
return exit(EXIT_CODES.ERROR);
|
|
111
111
|
}
|
|
112
112
|
uiLogger.success(commands.project.validate.success(projectConfig.name));
|
|
113
|
-
|
|
113
|
+
return exit(EXIT_CODES.SUCCESS);
|
|
114
114
|
}
|
|
115
115
|
function projectValidateBuilder(yargs) {
|
|
116
116
|
yargs.options({
|
|
@@ -150,7 +150,7 @@ const builder = makeYargsBuilder(projectValidateBuilder, command, describe, {
|
|
|
150
150
|
const projectValidateCommand = {
|
|
151
151
|
command,
|
|
152
152
|
describe,
|
|
153
|
-
handler,
|
|
153
|
+
handler: makeYargsHandlerWithUsageTracking('project-validate', handler),
|
|
154
154
|
builder,
|
|
155
155
|
};
|
|
156
156
|
export default projectValidateCommand;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { cancelStagedBuild, fetchProjectBuilds, } from '@hubspot/local-dev-lib/api/projects';
|
|
2
2
|
import { isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
3
|
-
import {
|
|
3
|
+
import { isLegacyProject } from '@hubspot/project-parsing-lib/projects';
|
|
4
4
|
import { commands } from '../../lang/en.js';
|
|
5
5
|
import { createWatcher } from '../../lib/projects/watch.js';
|
|
6
6
|
import { logError, ApiErrorContext } from '../../lib/errorHandlers/index.js';
|
|
7
7
|
import { uiLogger } from '../../lib/ui/logger.js';
|
|
8
8
|
import { PROJECT_ERROR_TYPES } from '../../lib/constants.js';
|
|
9
|
-
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
10
9
|
import { getProjectConfig, validateProjectConfig, } from '../../lib/projects/config.js';
|
|
11
10
|
import { logFeedbackMessage } from '../../lib/projects/ui.js';
|
|
12
11
|
import { handleProjectUpload } from '../../lib/projects/upload.js';
|
|
13
12
|
import { pollBuildStatus, pollDeployStatus, } from '../../lib/projects/pollProjectBuildAndDeploy.js';
|
|
14
13
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
15
14
|
import { handleKeypress, handleExit } from '../../lib/process.js';
|
|
15
|
+
import { makeYargsHandlerWithUsageTracking } from '../../lib/yargs/makeYargsHandlerWithUsageTracking.js';
|
|
16
16
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
17
|
+
import { uiDeprecatedTag } from '../../lib/ui/index.js';
|
|
17
18
|
const command = 'watch';
|
|
18
|
-
const describe = commands.project.watch.describe;
|
|
19
|
+
const describe = uiDeprecatedTag(commands.project.watch.describe, false);
|
|
19
20
|
async function handleBuildStatus(accountId, projectName, buildId) {
|
|
20
21
|
const { isAutoDeployEnabled, deployStatusTaskLocator } = await pollBuildStatus(accountId, projectName, buildId, null);
|
|
21
22
|
if (isAutoDeployEnabled && deployStatusTaskLocator) {
|
|
@@ -23,28 +24,28 @@ async function handleBuildStatus(accountId, projectName, buildId) {
|
|
|
23
24
|
}
|
|
24
25
|
logFeedbackMessage(buildId);
|
|
25
26
|
}
|
|
26
|
-
function handleUserInput(accountId, projectName, currentBuildId) {
|
|
27
|
+
function handleUserInput(accountId, projectName, currentBuildId, exit) {
|
|
27
28
|
const onTerminate = async () => {
|
|
28
29
|
uiLogger.log(commands.project.watch.logs.processExited);
|
|
29
30
|
if (currentBuildId) {
|
|
30
31
|
try {
|
|
31
32
|
await cancelStagedBuild(accountId, projectName);
|
|
32
|
-
|
|
33
|
+
return exit(EXIT_CODES.SUCCESS);
|
|
33
34
|
}
|
|
34
35
|
catch (err) {
|
|
35
36
|
if (isSpecifiedError(err, {
|
|
36
37
|
subCategory: PROJECT_ERROR_TYPES.BUILD_NOT_IN_PROGRESS,
|
|
37
38
|
})) {
|
|
38
|
-
|
|
39
|
+
return exit(EXIT_CODES.SUCCESS);
|
|
39
40
|
}
|
|
40
41
|
else {
|
|
41
42
|
logError(err, new ApiErrorContext({ accountId }));
|
|
42
|
-
|
|
43
|
+
return exit(EXIT_CODES.ERROR);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
else {
|
|
47
|
-
|
|
48
|
+
return exit(EXIT_CODES.SUCCESS);
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
51
|
handleExit(onTerminate);
|
|
@@ -55,23 +56,22 @@ function handleUserInput(accountId, projectName, currentBuildId) {
|
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
async function handler(args) {
|
|
58
|
-
const { initialUpload, derivedAccountId } = args;
|
|
59
|
-
trackCommandUsage('project-watch', undefined, derivedAccountId);
|
|
59
|
+
const { initialUpload, derivedAccountId, exit } = args;
|
|
60
60
|
const { projectConfig, projectDir } = await getProjectConfig();
|
|
61
61
|
if (!projectConfig || !projectDir) {
|
|
62
62
|
uiLogger.error(commands.project.watch.errors.projectConfigNotFound);
|
|
63
|
-
return
|
|
63
|
+
return exit(EXIT_CODES.ERROR);
|
|
64
64
|
}
|
|
65
|
-
if (
|
|
66
|
-
uiLogger.error(projectConfig.platformVersion);
|
|
67
|
-
return
|
|
65
|
+
if (!isLegacyProject(projectConfig.platformVersion)) {
|
|
66
|
+
uiLogger.error(commands.project.watch.errors.v2ApiError(projectConfig.platformVersion));
|
|
67
|
+
return exit(EXIT_CODES.ERROR);
|
|
68
68
|
}
|
|
69
69
|
try {
|
|
70
70
|
validateProjectConfig(projectConfig, projectDir);
|
|
71
71
|
}
|
|
72
72
|
catch (error) {
|
|
73
73
|
logError(error);
|
|
74
|
-
|
|
74
|
+
return exit(EXIT_CODES.ERROR);
|
|
75
75
|
}
|
|
76
76
|
try {
|
|
77
77
|
const { data: { results: builds }, } = await fetchProjectBuilds(derivedAccountId, projectConfig.name);
|
|
@@ -79,14 +79,14 @@ async function handler(args) {
|
|
|
79
79
|
const handleWatchTermination = (error) => {
|
|
80
80
|
if (error) {
|
|
81
81
|
logError(error, new ApiErrorContext({ accountId: derivedAccountId }));
|
|
82
|
-
|
|
82
|
+
return exit(EXIT_CODES.ERROR);
|
|
83
83
|
}
|
|
84
84
|
else {
|
|
85
|
-
|
|
85
|
+
return exit(EXIT_CODES.SUCCESS);
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
const startWatching = async () => {
|
|
89
|
-
await createWatcher(derivedAccountId, projectConfig, projectDir, handleBuildStatus, handleUserInput, handleWatchTermination);
|
|
89
|
+
await createWatcher(derivedAccountId, projectConfig, projectDir, handleBuildStatus, (accountId, projectName, buildId) => handleUserInput(accountId, projectName, buildId, exit), handleWatchTermination);
|
|
90
90
|
};
|
|
91
91
|
// Upload all files if no build exists for this project yet
|
|
92
92
|
if (initialUpload || hasNoBuilds) {
|
|
@@ -98,7 +98,7 @@ async function handler(args) {
|
|
|
98
98
|
isUploadCommand: false,
|
|
99
99
|
});
|
|
100
100
|
if (projectNotFound) {
|
|
101
|
-
|
|
101
|
+
return exit(EXIT_CODES.ERROR);
|
|
102
102
|
}
|
|
103
103
|
if (uploadError) {
|
|
104
104
|
if (isSpecifiedError(uploadError, {
|
|
@@ -114,7 +114,7 @@ async function handler(args) {
|
|
|
114
114
|
request: 'project upload',
|
|
115
115
|
}));
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
return exit(EXIT_CODES.ERROR);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
else {
|
|
@@ -123,7 +123,7 @@ async function handler(args) {
|
|
|
123
123
|
}
|
|
124
124
|
catch (e) {
|
|
125
125
|
logError(e, new ApiErrorContext({ accountId: derivedAccountId }));
|
|
126
|
-
|
|
126
|
+
return exit(EXIT_CODES.ERROR);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
function projectWatchBuilder(yargs) {
|
|
@@ -146,7 +146,7 @@ const builder = makeYargsBuilder(projectWatchBuilder, command, describe, {
|
|
|
146
146
|
const projectWatchCommand = {
|
|
147
147
|
command,
|
|
148
148
|
describe,
|
|
149
|
-
handler,
|
|
149
|
+
handler: makeYargsHandlerWithUsageTracking('project-watch', handler),
|
|
150
150
|
builder,
|
|
151
151
|
};
|
|
152
152
|
export default projectWatchCommand;
|
package/commands/project.js
CHANGED
|
@@ -18,9 +18,10 @@ import profile from './project/profile.js';
|
|
|
18
18
|
import projectValidate from './project/validate.js';
|
|
19
19
|
import list from './project/list.js';
|
|
20
20
|
import info from './project/info.js';
|
|
21
|
+
import deleteProject from './project/delete.js';
|
|
21
22
|
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
22
23
|
import { getProjectConfig } from '../lib/projects/config.js';
|
|
23
|
-
import {
|
|
24
|
+
import { isSupportedPlatformVersion, LATEST_SUPPORTED_PLATFORM_VERSION, } from '@hubspot/project-parsing-lib/projects';
|
|
24
25
|
import { uiLogger } from '../lib/ui/logger.js';
|
|
25
26
|
import { debugError } from '../lib/errorHandlers/index.js';
|
|
26
27
|
const command = ['project', 'projects'];
|
|
@@ -30,8 +31,11 @@ const describe = commands.project.describe;
|
|
|
30
31
|
async function validatePlatformVersion() {
|
|
31
32
|
try {
|
|
32
33
|
const { projectConfig } = await getProjectConfig();
|
|
33
|
-
if
|
|
34
|
-
|
|
34
|
+
// Only warn if a platform version is explicitly set but not supported
|
|
35
|
+
// Don't warn if the platform version is missing/undefined
|
|
36
|
+
if (projectConfig?.platformVersion &&
|
|
37
|
+
!isSupportedPlatformVersion(projectConfig.platformVersion)) {
|
|
38
|
+
uiLogger.warn(lib.projects.platformVersion.unsupported(pkg.version, LATEST_SUPPORTED_PLATFORM_VERSION, projectConfig.platformVersion));
|
|
35
39
|
uiLogger.log('');
|
|
36
40
|
}
|
|
37
41
|
}
|
|
@@ -45,6 +49,7 @@ function projectBuilder(yargs) {
|
|
|
45
49
|
yargs
|
|
46
50
|
.command(create)
|
|
47
51
|
.command(add)
|
|
52
|
+
.command(deleteProject)
|
|
48
53
|
.command(watch)
|
|
49
54
|
.command(list)
|
|
50
55
|
.command(info)
|
|
@@ -7,30 +7,29 @@ import { commands, lib } from '../../lang/en.js';
|
|
|
7
7
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
8
8
|
import { uiFeatureHighlight, uiBetaTag } from '../../lib/ui/index.js';
|
|
9
9
|
import { SANDBOX_TYPE_MAP, validateSandboxUsageLimits, } from '../../lib/sandboxes.js';
|
|
10
|
-
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
11
10
|
import { sandboxTypePrompt } from '../../lib/prompts/sandboxesPrompt.js';
|
|
12
11
|
import { promptUser } from '../../lib/prompts/promptUtils.js';
|
|
13
12
|
import { logError } from '../../lib/errorHandlers/index.js';
|
|
14
13
|
import { buildV2Sandbox } from '../../lib/buildAccount.js';
|
|
15
14
|
import { hubspotAccountNamePrompt } from '../../lib/prompts/accountNamePrompt.js';
|
|
15
|
+
import { makeYargsHandlerWithUsageTracking } from '../../lib/yargs/makeYargsHandlerWithUsageTracking.js';
|
|
16
16
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
17
17
|
const command = 'create';
|
|
18
18
|
const describe = uiBetaTag(commands.sandbox.subcommands.create.describe, false);
|
|
19
19
|
async function handler(args) {
|
|
20
|
-
const { name, type, force, derivedAccountId } = args;
|
|
20
|
+
const { name, type, force, derivedAccountId, exit } = args;
|
|
21
21
|
const accountConfig = getConfigAccountById(derivedAccountId);
|
|
22
22
|
const env = getConfigAccountEnvironment(derivedAccountId);
|
|
23
|
-
trackCommandUsage('sandbox-create', {}, derivedAccountId);
|
|
24
23
|
// Check if account config exists
|
|
25
24
|
if (!accountConfig) {
|
|
26
25
|
uiLogger.error(commands.sandbox.subcommands.create.failure.noAccountConfig(derivedAccountId));
|
|
27
|
-
|
|
26
|
+
return exit(EXIT_CODES.ERROR);
|
|
28
27
|
}
|
|
29
28
|
// Default account is not a production portal
|
|
30
29
|
if (accountConfig.accountType &&
|
|
31
30
|
accountConfig.accountType !== HUBSPOT_ACCOUNT_TYPES.STANDARD) {
|
|
32
31
|
uiLogger.error(commands.sandbox.subcommands.create.failure.invalidAccountType(HUBSPOT_ACCOUNT_TYPE_STRINGS[HUBSPOT_ACCOUNT_TYPES[accountConfig.accountType]], accountConfig.name || ''));
|
|
33
|
-
|
|
32
|
+
return exit(EXIT_CODES.ERROR);
|
|
34
33
|
}
|
|
35
34
|
let typePrompt;
|
|
36
35
|
let namePrompt;
|
|
@@ -40,7 +39,7 @@ async function handler(args) {
|
|
|
40
39
|
}
|
|
41
40
|
else {
|
|
42
41
|
uiLogger.error(commands.sandbox.subcommands.create.failure.optionMissing.type);
|
|
43
|
-
|
|
42
|
+
return exit(EXIT_CODES.ERROR);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
const sandboxType = type
|
|
@@ -64,7 +63,7 @@ async function handler(args) {
|
|
|
64
63
|
else {
|
|
65
64
|
logError(err);
|
|
66
65
|
}
|
|
67
|
-
|
|
66
|
+
return exit(EXIT_CODES.ERROR);
|
|
68
67
|
}
|
|
69
68
|
if (!name) {
|
|
70
69
|
if (!force) {
|
|
@@ -72,14 +71,15 @@ async function handler(args) {
|
|
|
72
71
|
}
|
|
73
72
|
else {
|
|
74
73
|
uiLogger.error(commands.sandbox.subcommands.create.failure.optionMissing.name);
|
|
75
|
-
|
|
74
|
+
return exit(EXIT_CODES.ERROR);
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
|
-
const
|
|
79
|
-
if (!
|
|
77
|
+
const maybeSandboxName = name || (namePrompt && namePrompt.name);
|
|
78
|
+
if (!maybeSandboxName) {
|
|
80
79
|
uiLogger.error(commands.sandbox.subcommands.create.failure.optionMissing.name);
|
|
81
|
-
|
|
80
|
+
return exit(EXIT_CODES.ERROR);
|
|
82
81
|
}
|
|
82
|
+
const sandboxName = maybeSandboxName;
|
|
83
83
|
let contactRecordsSyncPromptResult = false;
|
|
84
84
|
if (!force) {
|
|
85
85
|
const isStandardSandbox = sandboxType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX;
|
|
@@ -101,7 +101,7 @@ async function handler(args) {
|
|
|
101
101
|
// Check if sandbox account config exists
|
|
102
102
|
if (!sandboxAccountConfig) {
|
|
103
103
|
uiLogger.error(commands.sandbox.subcommands.create.failure.noSandboxAccountConfig(result.sandbox.sandboxHubId));
|
|
104
|
-
|
|
104
|
+
return exit(EXIT_CODES.ERROR);
|
|
105
105
|
}
|
|
106
106
|
const highlightItems = ['accountsUseCommand', 'projectCreateCommand'];
|
|
107
107
|
if (sandboxType === HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX) {
|
|
@@ -111,11 +111,11 @@ async function handler(args) {
|
|
|
111
111
|
highlightItems.push('projectUploadCommand');
|
|
112
112
|
}
|
|
113
113
|
uiFeatureHighlight(highlightItems);
|
|
114
|
-
|
|
114
|
+
return exit(EXIT_CODES.SUCCESS);
|
|
115
115
|
}
|
|
116
116
|
catch (error) {
|
|
117
117
|
// Errors are logged in util functions
|
|
118
|
-
|
|
118
|
+
return exit(EXIT_CODES.ERROR);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
function sandboxCreateBuilder(yargs) {
|
|
@@ -150,7 +150,7 @@ const builder = makeYargsBuilder(sandboxCreateBuilder, command, describe, {
|
|
|
150
150
|
const sandboxCreateCommand = {
|
|
151
151
|
command,
|
|
152
152
|
describe,
|
|
153
|
-
handler,
|
|
153
|
+
handler: makeYargsHandlerWithUsageTracking('sandbox-create', handler),
|
|
154
154
|
builder,
|
|
155
155
|
};
|
|
156
156
|
export default sandboxCreateCommand;
|
|
@@ -4,7 +4,6 @@ import { deleteSandbox } from '@hubspot/local-dev-lib/api/sandboxHubs';
|
|
|
4
4
|
import { getConfigAccountEnvironment, removeAccountFromConfig, setConfigAccountAsDefault, getAllConfigAccounts, getConfigAccountIfExists, getConfigDefaultAccountIfExists, } from '@hubspot/local-dev-lib/config';
|
|
5
5
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
6
6
|
import { getValidEnv } from '@hubspot/local-dev-lib/environment';
|
|
7
|
-
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
8
7
|
import { logError, debugError } from '../../lib/errorHandlers/index.js';
|
|
9
8
|
import { commands } from '../../lang/en.js';
|
|
10
9
|
import { deleteSandboxPrompt } from '../../lib/prompts/sandboxesPrompt.js';
|
|
@@ -12,12 +11,12 @@ import { selectAccountFromConfig } from '../../lib/prompts/accountsPrompt.js';
|
|
|
12
11
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
13
12
|
import { promptUser } from '../../lib/prompts/promptUtils.js';
|
|
14
13
|
import { uiAuthCommandReference, uiBetaTag } from '../../lib/ui/index.js';
|
|
14
|
+
import { makeYargsHandlerWithUsageTracking } from '../../lib/yargs/makeYargsHandlerWithUsageTracking.js';
|
|
15
15
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
16
16
|
const command = 'delete';
|
|
17
17
|
const describe = uiBetaTag(commands.sandbox.subcommands.delete.describe, false);
|
|
18
18
|
async function handler(args) {
|
|
19
|
-
const { userProvidedAccount,
|
|
20
|
-
trackCommandUsage('sandbox-delete', {}, derivedAccountId);
|
|
19
|
+
const { userProvidedAccount, force, exit } = args;
|
|
21
20
|
let accountPrompt;
|
|
22
21
|
if (!userProvidedAccount) {
|
|
23
22
|
if (!force) {
|
|
@@ -27,19 +26,19 @@ async function handler(args) {
|
|
|
27
26
|
// Account is required, throw error if force flag is present and no account is specified
|
|
28
27
|
uiLogger.log('');
|
|
29
28
|
uiLogger.error(commands.sandbox.subcommands.delete.failure.noAccount);
|
|
30
|
-
|
|
29
|
+
return exit(EXIT_CODES.ERROR);
|
|
31
30
|
}
|
|
32
31
|
if (!accountPrompt) {
|
|
33
32
|
uiLogger.log('');
|
|
34
33
|
uiLogger.error(commands.sandbox.subcommands.delete.failure.noSandboxAccounts);
|
|
35
|
-
|
|
34
|
+
return exit(EXIT_CODES.ERROR);
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
const accountIdentifier = userProvidedAccount || accountPrompt.account;
|
|
39
38
|
const sandboxAccount = getConfigAccountIfExists(accountIdentifier);
|
|
40
39
|
if (!sandboxAccount) {
|
|
41
40
|
uiLogger.error(commands.sandbox.subcommands.delete.failure.noSandboxAccountId);
|
|
42
|
-
|
|
41
|
+
return exit(EXIT_CODES.ERROR);
|
|
43
42
|
}
|
|
44
43
|
const sandboxAccountId = sandboxAccount.accountId;
|
|
45
44
|
const defaultAccount = getConfigDefaultAccountIfExists();
|
|
@@ -56,14 +55,14 @@ async function handler(args) {
|
|
|
56
55
|
const parentAccountPrompt = await deleteSandboxPrompt(true);
|
|
57
56
|
if (!parentAccountPrompt) {
|
|
58
57
|
uiLogger.error(commands.sandbox.subcommands.delete.failure.noParentAccount);
|
|
59
|
-
|
|
58
|
+
return exit(EXIT_CODES.ERROR);
|
|
60
59
|
}
|
|
61
60
|
const parentAccount = getConfigAccountIfExists(parentAccountPrompt.account);
|
|
62
61
|
parentAccountId = parentAccount?.accountId;
|
|
63
62
|
}
|
|
64
63
|
else {
|
|
65
64
|
uiLogger.error(commands.sandbox.subcommands.delete.failure.noParentAccount);
|
|
66
|
-
|
|
65
|
+
return exit(EXIT_CODES.ERROR);
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
}
|
|
@@ -76,7 +75,7 @@ async function handler(args) {
|
|
|
76
75
|
uiLogger.log('');
|
|
77
76
|
uiLogger.error(commands.sandbox.subcommands.delete.failure.noParentPortalAvailable(command, url));
|
|
78
77
|
uiLogger.log('');
|
|
79
|
-
|
|
78
|
+
return exit(EXIT_CODES.ERROR);
|
|
80
79
|
}
|
|
81
80
|
uiLogger.debug(commands.sandbox.subcommands.delete.debug.deleting(sandboxAccountId));
|
|
82
81
|
if (isDefaultAccount) {
|
|
@@ -93,7 +92,7 @@ async function handler(args) {
|
|
|
93
92
|
},
|
|
94
93
|
]);
|
|
95
94
|
if (!confirmed) {
|
|
96
|
-
|
|
95
|
+
return exit(EXIT_CODES.SUCCESS);
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
await deleteSandbox(parentAccountId, sandboxAccountId);
|
|
@@ -111,7 +110,7 @@ async function handler(args) {
|
|
|
111
110
|
// If force is specified, skip prompt and set the parent account id as the default account
|
|
112
111
|
setConfigAccountAsDefault(parentAccountId);
|
|
113
112
|
}
|
|
114
|
-
|
|
113
|
+
return exit(EXIT_CODES.SUCCESS);
|
|
115
114
|
}
|
|
116
115
|
catch (err) {
|
|
117
116
|
debugError(err);
|
|
@@ -147,12 +146,12 @@ async function handler(args) {
|
|
|
147
146
|
// If force is specified, skip prompt and set the parent account id as the default account
|
|
148
147
|
setConfigAccountAsDefault(parentAccountId);
|
|
149
148
|
}
|
|
150
|
-
|
|
149
|
+
return exit(EXIT_CODES.SUCCESS);
|
|
151
150
|
}
|
|
152
151
|
else {
|
|
153
152
|
logError(err);
|
|
154
153
|
}
|
|
155
|
-
|
|
154
|
+
return exit(EXIT_CODES.ERROR);
|
|
156
155
|
}
|
|
157
156
|
}
|
|
158
157
|
function sandboxDeleteBuilder(yargs) {
|
|
@@ -183,7 +182,7 @@ const builder = makeYargsBuilder(sandboxDeleteBuilder, command, describe, {
|
|
|
183
182
|
const sandboxDeleteCommand = {
|
|
184
183
|
command,
|
|
185
184
|
describe,
|
|
186
|
-
handler,
|
|
185
|
+
handler: makeYargsHandlerWithUsageTracking('sandbox-delete', handler),
|
|
187
186
|
builder,
|
|
188
187
|
};
|
|
189
188
|
export default sandboxDeleteCommand;
|