@hubspot/cli 7.8.12-experimental.0 → 7.9.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +31 -25
- package/commands/__tests__/auth.test.js +5 -0
- package/commands/__tests__/cms.test.js +44 -1
- package/commands/__tests__/customObject.test.js +22 -1
- package/commands/__tests__/doctor.test.js +16 -16
- package/commands/__tests__/project.test.js +2 -0
- package/commands/account/auth.js +1 -0
- package/commands/account/clean.js +18 -27
- package/commands/account/createOverride.js +13 -31
- package/commands/account/info.js +20 -31
- package/commands/account/list.js +16 -22
- package/commands/account/remove.js +12 -20
- package/commands/account/removeOverride.js +11 -21
- package/commands/account/rename.js +6 -9
- package/commands/account/use.js +12 -26
- package/commands/account.js +2 -2
- package/commands/app/__tests__/migrate.test.js +5 -5
- package/commands/app/migrate.js +13 -18
- package/commands/app.js +1 -6
- package/commands/auth.d.ts +1 -0
- package/commands/auth.js +17 -7
- package/commands/{__tests__/remove.test.js → cms/__tests__/delete.test.js} +8 -8
- package/commands/{__tests__ → cms/__tests__}/fetch.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/function.test.js +7 -3
- package/commands/{__tests__ → cms/__tests__}/lint.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/list.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/mv.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/theme.test.js +9 -2
- package/commands/cms/app/create.d.ts +9 -0
- package/commands/cms/app/create.js +82 -0
- package/commands/cms/app.d.ts +3 -0
- package/commands/cms/app.js +17 -0
- package/commands/cms/convertFields.js +7 -9
- package/commands/cms/delete.d.ts +6 -0
- package/commands/cms/delete.js +43 -0
- package/commands/cms/fetch.d.ts +12 -0
- package/commands/cms/fetch.js +79 -0
- package/commands/{__tests__ → cms/function/__tests__}/logs.test.js +4 -5
- package/commands/cms/function/create.d.ts +12 -0
- package/commands/cms/function/create.js +84 -0
- package/commands/cms/function/deploy.d.ts +6 -0
- package/commands/cms/function/deploy.js +89 -0
- package/commands/cms/function/list.d.ts +6 -0
- package/commands/cms/function/list.js +60 -0
- package/commands/cms/function/logs.d.ts +10 -0
- package/commands/cms/function/logs.js +135 -0
- package/commands/cms/function/server.d.ts +10 -0
- package/commands/cms/function/server.js +69 -0
- package/commands/cms/function.d.ts +3 -0
- package/commands/cms/function.js +27 -0
- package/commands/cms/getReactModule.js +9 -14
- package/commands/cms/lighthouseScore.js +33 -36
- package/commands/cms/lint.d.ts +6 -0
- package/commands/cms/lint.js +83 -0
- package/commands/cms/list.d.ts +6 -0
- package/commands/cms/list.js +96 -0
- package/commands/cms/module/create.d.ts +11 -0
- package/commands/cms/module/create.js +84 -0
- package/commands/cms/module/marketplace-validate.d.ts +6 -0
- package/commands/cms/module/marketplace-validate.js +45 -0
- package/commands/cms/module.d.ts +3 -0
- package/commands/cms/module.js +17 -0
- package/commands/cms/mv.d.ts +7 -0
- package/commands/cms/mv.js +60 -0
- package/commands/cms/template/create.d.ts +9 -0
- package/commands/cms/template/create.js +72 -0
- package/commands/cms/template.d.ts +3 -0
- package/commands/cms/template.js +17 -0
- package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.js +2 -2
- package/commands/{theme → cms/theme}/__tests__/preview.test.js +2 -2
- package/commands/cms/theme/create.d.ts +6 -0
- package/commands/cms/theme/create.js +58 -0
- package/commands/cms/theme/generate-selectors.d.ts +6 -0
- package/commands/cms/theme/generate-selectors.js +171 -0
- package/commands/cms/theme/marketplace-validate.d.ts +6 -0
- package/commands/cms/theme/marketplace-validate.js +46 -0
- package/commands/cms/theme/preview.d.ts +12 -0
- package/commands/cms/theme/preview.js +224 -0
- package/commands/cms/theme.d.ts +3 -0
- package/commands/cms/theme.js +25 -0
- package/commands/cms/upload.d.ts +12 -0
- package/commands/cms/upload.js +212 -0
- package/commands/cms/watch.d.ts +14 -0
- package/commands/cms/watch.js +138 -0
- package/commands/cms/webpack/create.d.ts +6 -0
- package/commands/cms/webpack/create.js +58 -0
- package/commands/cms/webpack.d.ts +3 -0
- package/commands/cms/webpack.js +17 -0
- package/commands/cms.js +28 -2
- package/commands/completion.js +3 -3
- package/commands/config/set.d.ts +1 -1
- package/commands/config/set.js +64 -36
- package/commands/config.js +2 -2
- package/commands/create.js +6 -4
- package/commands/customObject/{schema/__tests__/create.test.js → __tests__/createSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/delete.test.js → __tests__/deleteSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/fetch-all.test.js → __tests__/fetch-all-schemas.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/fetch.test.js → __tests__/fetchSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/list.test.js → __tests__/listSchemas.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/update.test.js → __tests__/updateSchema.test.js} +5 -5
- package/commands/customObject/create.js +10 -12
- package/commands/customObject/createSchema.d.ts +6 -0
- package/commands/customObject/createSchema.js +56 -0
- package/commands/customObject/deleteSchema.d.ts +7 -0
- package/commands/customObject/deleteSchema.js +69 -0
- package/commands/customObject/fetchAllSchemas.d.ts +6 -0
- package/commands/customObject/fetchAllSchemas.js +57 -0
- package/commands/customObject/fetchSchema.d.ts +7 -0
- package/commands/customObject/fetchSchema.js +67 -0
- package/commands/customObject/listSchemas.d.ts +4 -0
- package/commands/customObject/listSchemas.js +35 -0
- package/commands/customObject/schema/create.d.ts +4 -6
- package/commands/customObject/schema/create.js +13 -38
- package/commands/customObject/schema/delete.d.ts +4 -7
- package/commands/customObject/schema/delete.js +15 -50
- package/commands/customObject/schema/fetch-all.d.ts +4 -6
- package/commands/customObject/schema/fetch-all.js +14 -40
- package/commands/customObject/schema/fetch.d.ts +4 -7
- package/commands/customObject/schema/fetch.js +14 -49
- package/commands/customObject/schema/list.d.ts +4 -4
- package/commands/customObject/schema/list.js +10 -19
- package/commands/customObject/schema/update.d.ts +4 -7
- package/commands/customObject/schema/update.js +15 -50
- package/commands/customObject/schema.js +5 -3
- package/commands/customObject/updateSchema.d.ts +7 -0
- package/commands/customObject/updateSchema.js +71 -0
- package/commands/customObject.js +22 -8
- package/commands/doctor.js +8 -11
- package/commands/feedback.js +7 -12
- package/commands/fetch.d.ts +4 -12
- package/commands/fetch.js +20 -47
- package/commands/filemanager/fetch.js +7 -7
- package/commands/filemanager/upload.js +15 -34
- package/commands/filemanager.js +2 -2
- package/commands/function/deploy.d.ts +4 -6
- package/commands/function/deploy.js +14 -89
- package/commands/function/list.d.ts +4 -6
- package/commands/function/list.js +14 -40
- package/commands/function/server.d.ts +4 -10
- package/commands/function/server.js +22 -31
- package/commands/function.d.ts +2 -4
- package/commands/function.js +25 -14
- package/commands/getStarted.js +2 -2
- package/commands/hubdb/clear.js +7 -15
- package/commands/hubdb/create.js +9 -15
- package/commands/hubdb/delete.js +8 -15
- package/commands/hubdb/fetch.js +6 -9
- package/commands/hubdb.d.ts +1 -1
- package/commands/hubdb.js +2 -2
- package/commands/init.js +2 -3
- package/commands/lint.d.ts +4 -6
- package/commands/lint.js +13 -65
- package/commands/list.d.ts +4 -6
- package/commands/list.js +14 -81
- package/commands/logs.d.ts +4 -10
- package/commands/logs.js +25 -94
- package/commands/module/marketplace-validate.d.ts +4 -6
- package/commands/module/marketplace-validate.js +15 -27
- package/commands/module.d.ts +2 -2
- package/commands/module.js +17 -15
- package/commands/mv.d.ts +4 -7
- package/commands/mv.js +14 -51
- package/commands/open.js +5 -5
- package/commands/project/__tests__/add.test.js +15 -13
- package/commands/project/__tests__/deploy.test.js +3 -4
- package/commands/project/__tests__/devUnifiedFlow.test.js +32 -0
- package/commands/project/__tests__/installDeps.test.js +8 -8
- package/commands/project/__tests__/list.test.js +31 -0
- package/commands/project/__tests__/logs.test.js +1 -1
- package/commands/project/__tests__/migrate.test.js +6 -5
- package/commands/project/__tests__/migrateApp.test.js +2 -5
- package/commands/project/__tests__/validate.test.js +98 -0
- package/commands/project/add.d.ts +2 -2
- package/commands/project/add.js +6 -5
- package/commands/project/cloneApp.js +14 -19
- package/commands/project/create.js +1 -2
- package/commands/project/deploy.js +3 -3
- package/commands/project/dev/deprecatedFlow.js +9 -18
- package/commands/project/dev/index.js +19 -17
- package/commands/project/dev/unifiedFlow.js +11 -4
- package/commands/project/download.js +15 -15
- package/commands/project/installDeps.d.ts +2 -2
- package/commands/project/installDeps.js +9 -8
- package/commands/project/list.d.ts +4 -0
- package/commands/project/list.js +62 -0
- package/commands/project/listBuilds.js +11 -20
- package/commands/project/logs.js +21 -24
- package/commands/project/migrate.js +5 -2
- package/commands/project/migrateApp.js +9 -15
- package/commands/project/open.js +6 -13
- package/commands/project/upload.d.ts +2 -2
- package/commands/project/upload.js +17 -26
- package/commands/project/validate.js +6 -6
- package/commands/project/watch.js +13 -22
- package/commands/project.js +4 -2
- package/commands/remove.d.ts +4 -6
- package/commands/remove.js +12 -24
- package/commands/sandbox/__tests__/create.test.js +5 -5
- package/commands/sandbox/create.js +22 -32
- package/commands/sandbox/delete.js +38 -63
- package/commands/sandbox.js +2 -2
- package/commands/secret/addSecret.js +7 -17
- package/commands/secret/deleteSecret.js +10 -20
- package/commands/secret/listSecret.js +8 -10
- package/commands/secret/updateSecret.js +9 -17
- package/commands/secret.js +2 -2
- package/commands/testAccount/__tests__/delete.test.js +2 -4
- package/commands/testAccount/create.js +2 -5
- package/commands/testAccount/delete.d.ts +4 -3
- package/commands/testAccount/delete.js +155 -14
- package/commands/theme/generate-selectors.d.ts +4 -6
- package/commands/theme/generate-selectors.js +14 -152
- package/commands/theme/marketplace-validate.d.ts +4 -6
- package/commands/theme/marketplace-validate.js +14 -25
- package/commands/theme/preview.d.ts +4 -12
- package/commands/theme/preview.js +18 -183
- package/commands/theme.d.ts +2 -2
- package/commands/theme.js +19 -13
- package/commands/upload.d.ts +4 -12
- package/commands/upload.js +19 -169
- package/commands/watch.d.ts +4 -14
- package/commands/watch.js +23 -88
- package/lang/en.d.ts +863 -542
- package/lang/en.js +912 -595
- package/lang/en.lyaml +4 -4
- package/lib/__tests__/buildAccount.test.js +4 -3
- package/lib/__tests__/commonOpts.test.js +1 -1
- package/lib/__tests__/dependencyManagement.test.js +1 -1
- package/lib/__tests__/developerTestAccounts.test.js +3 -3
- package/lib/__tests__/npm.test.js +1 -1
- package/lib/__tests__/oauth.test.js +4 -4
- package/lib/__tests__/process.test.js +10 -5
- package/lib/__tests__/sandboxSync.test.js +8 -8
- package/lib/__tests__/sandboxes.test.js +8 -8
- package/lib/__tests__/serverlessLogs.test.js +1 -1
- package/lib/__tests__/usageTracking.test.js +5 -5
- package/lib/__tests__/validation.test.js +2 -1
- package/lib/__tests__/yargsUtils.test.js +83 -9
- package/lib/app/__tests__/migrate.test.js +5 -5
- package/lib/app/__tests__/migrate_legacy.test.js +1 -1
- package/lib/app/migrate.js +1 -1
- package/lib/app/migrate_legacy.js +20 -24
- package/lib/buildAccount.d.ts +2 -2
- package/lib/buildAccount.js +32 -64
- package/lib/commonOpts.d.ts +1 -1
- package/lib/commonOpts.js +25 -22
- package/lib/configMigrate.js +88 -9
- package/lib/configOptions.js +7 -0
- package/lib/constants.d.ts +15 -1
- package/lib/constants.js +19 -1
- package/lib/dependencyManagement.js +9 -27
- package/lib/developerTestAccounts.js +9 -23
- package/lib/doctor/Diagnosis.js +11 -23
- package/lib/doctor/DiagnosticInfoBuilder.js +12 -11
- package/lib/doctor/Doctor.js +42 -90
- package/lib/doctor/__tests__/Doctor.test.js +4 -4
- package/lib/errorHandlers/index.js +12 -20
- package/lib/errorHandlers/suppressError.js +11 -18
- package/lib/generateSelectors.js +1 -1
- package/lib/lang.js +6 -5
- package/lib/links.js +4 -4
- package/lib/middleware/__test__/commandTargetingUtils.test.js +99 -0
- package/lib/middleware/__test__/configMiddleware.test.js +11 -11
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +6 -8
- package/lib/middleware/autoUpdateMiddleware.d.ts +2 -1
- package/lib/middleware/autoUpdateMiddleware.js +12 -2
- package/lib/middleware/commandTargetingUtils.d.ts +8 -0
- package/lib/middleware/commandTargetingUtils.js +74 -0
- package/lib/middleware/configMiddleware.d.ts +1 -1
- package/lib/middleware/configMiddleware.js +21 -81
- package/lib/middleware/gitMiddleware.js +5 -1
- package/lib/middleware/notificationsMiddleware.js +5 -11
- package/lib/middleware/yargsChecksMiddleware.js +6 -9
- package/lib/npm.js +2 -2
- package/lib/oauth.js +5 -5
- package/lib/process.js +5 -4
- package/lib/projectProfiles.d.ts +1 -1
- package/lib/projectProfiles.js +2 -10
- package/lib/projects/__tests__/AppDevModeInterface.test.js +101 -135
- package/lib/projects/__tests__/DevServerManager.test.js +183 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +6 -5
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +76 -45
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +1 -0
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +161 -0
- package/lib/projects/__tests__/deploy.test.js +9 -9
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +2 -0
- package/lib/projects/__tests__/platformVersion.test.js +8 -8
- package/lib/projects/__tests__/projects.test.js +12 -12
- package/lib/projects/__tests__/structure.test.js +3 -3
- package/lib/projects/__tests__/upload.test.d.ts +1 -0
- package/lib/projects/__tests__/upload.test.js +82 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +6 -6
- package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/{v3AddComponent.test.js → v2AddComponent.test.js} +39 -39
- package/lib/projects/add/{v3AddComponent.d.ts → v2AddComponent.d.ts} +1 -1
- package/lib/projects/add/{v3AddComponent.js → v2AddComponent.js} +5 -5
- package/lib/projects/create/__tests__/legacy.test.js +5 -5
- package/lib/projects/create/__tests__/v2.test.d.ts +1 -0
- package/lib/projects/create/__tests__/{v3.test.js → v2.test.js} +3 -3
- package/lib/projects/create/index.js +4 -4
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/{v3.d.ts → v2.d.ts} +3 -3
- package/lib/projects/create/{v3.js → v2.js} +5 -5
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +11 -3
- package/lib/projects/localDev/AppDevModeInterface.js +128 -115
- package/lib/projects/localDev/DevServerManager.d.ts +10 -29
- package/lib/projects/localDev/DevServerManager.js +20 -76
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +40 -0
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +120 -0
- package/lib/projects/localDev/LocalDevLogger.js +10 -11
- package/lib/projects/localDev/{LocalDevManager.js → LocalDevManager_DEPRECATED.js} +10 -11
- package/lib/projects/localDev/LocalDevProcess.js +3 -2
- package/lib/projects/localDev/LocalDevState.d.ts +3 -0
- package/lib/projects/localDev/LocalDevState.js +9 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +4 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +46 -16
- package/lib/projects/localDev/UIExtensionsDevModeInterface.d.ts +13 -0
- package/lib/projects/localDev/UIExtensionsDevModeInterface.js +37 -0
- package/lib/projects/localDev/helpers/account.d.ts +1 -1
- package/lib/projects/localDev/helpers/account.js +2 -2
- package/lib/projects/localDev/helpers/process.d.ts +1 -0
- package/lib/projects/localDev/helpers/process.js +15 -0
- package/lib/projects/localDev/helpers/project.d.ts +1 -0
- package/lib/projects/localDev/helpers/project.js +39 -3
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +3 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +9 -0
- package/lib/projects/platformVersion.d.ts +1 -1
- package/lib/projects/platformVersion.js +1 -1
- package/lib/projects/structure.d.ts +2 -2
- package/lib/projects/structure.js +6 -6
- package/lib/projects/upload.d.ts +2 -3
- package/lib/projects/upload.js +17 -9
- package/lib/projects/urls.d.ts +0 -1
- package/lib/projects/urls.js +0 -3
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +1 -0
- package/lib/prompts/__tests__/projectAddPrompt.test.js +10 -10
- package/lib/prompts/accountNamePrompt.js +14 -19
- package/lib/prompts/accountsPrompt.js +2 -2
- package/lib/prompts/cmsFieldPrompt.js +2 -2
- package/lib/prompts/createApiSamplePrompt.js +5 -5
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +10 -1
- package/lib/prompts/createFunctionPrompt.js +14 -14
- package/lib/prompts/createModulePrompt.js +9 -9
- package/lib/prompts/createTemplatePrompt.js +2 -2
- package/lib/prompts/downloadProjectPrompt.js +5 -8
- package/lib/prompts/installAppPrompt.d.ts +1 -6
- package/lib/prompts/installAppPrompt.js +1 -6
- package/lib/prompts/personalAccessKeyPrompt.js +3 -3
- package/lib/prompts/previewPrompt.js +6 -6
- package/lib/prompts/projectAddPrompt.d.ts +2 -2
- package/lib/prompts/projectAddPrompt.js +7 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +20 -32
- package/lib/prompts/projectNamePrompt.js +4 -8
- package/lib/prompts/projectsLogsPrompt.js +2 -4
- package/lib/prompts/promptUtils.js +27 -9
- package/lib/prompts/sandboxesPrompt.js +7 -7
- package/lib/prompts/secretPrompt.js +3 -3
- package/lib/prompts/selectAppPrompt.js +3 -3
- package/lib/prompts/selectHubDBTablePrompt.js +9 -13
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +15 -19
- package/lib/prompts/setAsDefaultAccountPrompt.js +4 -8
- package/lib/prompts/uploadPrompt.js +5 -5
- package/lib/sandboxSync.js +24 -41
- package/lib/sandboxes.js +19 -47
- package/lib/schema.js +3 -3
- package/lib/serverlessLogs.js +11 -13
- package/lib/theme/__tests__/migrate.test.js +6 -6
- package/lib/theme/migrate.js +2 -2
- package/lib/ui/SpinniesManager.d.ts +2 -0
- package/lib/ui/SpinniesManager.js +7 -0
- package/lib/ui/boxen.js +1 -2
- package/lib/ui/git.js +13 -10
- package/lib/ui/index.d.ts +6 -0
- package/lib/ui/index.js +55 -38
- package/lib/ui/serverlessFunctionLogs.js +9 -7
- package/lib/ui/uiMessages.d.ts +73 -0
- package/lib/ui/uiMessages.js +76 -0
- package/lib/usageTracking.js +7 -7
- package/lib/validation.js +20 -23
- package/lib/yargsUtils.d.ts +1 -1
- package/lib/yargsUtils.js +12 -5
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +4 -4
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +23 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +68 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +11 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.js +49 -0
- package/mcp-server/tools/project/GetConfigValuesTool.js +2 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +169 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +115 -0
- package/mcp-server/utils/toolUsageTracking.js +2 -2
- package/package.json +8 -7
- package/types/Cms.d.ts +6 -6
- package/types/Yargs.d.ts +1 -1
- package/commands/app/__tests__/install.test.js +0 -47
- package/commands/app/install.d.ts +0 -8
- package/commands/app/install.js +0 -122
- package/lib/middleware/__test__/utils.test.js +0 -51
- package/lib/middleware/utils.d.ts +0 -8
- package/lib/middleware/utils.js +0 -14
- package/lib/projects/localDev/DevServerManagerV2.d.ts +0 -22
- package/lib/projects/localDev/DevServerManagerV2.js +0 -81
- /package/commands/{customObject/schema → cms}/__tests__/delete.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/fetch.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/function.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/lint.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/list.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/mv.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/theme.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/function/__tests__}/logs.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.js +0 -0
- /package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/preview.test.d.ts +0 -0
- /package/commands/{__tests__/remove.test.d.ts → customObject/__tests__/createSchema.test.d.ts} +0 -0
- /package/commands/{app/__tests__/install.test.d.ts → customObject/__tests__/deleteSchema.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/create.test.d.ts → __tests__/fetch-all-schemas.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/fetch-all.test.d.ts → __tests__/fetchSchema.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/fetch.test.d.ts → __tests__/listSchemas.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/list.test.d.ts → __tests__/updateSchema.test.d.ts} +0 -0
- /package/commands/{customObject/schema/__tests__/update.test.d.ts → project/__tests__/list.test.d.ts} +0 -0
- /package/{lib/middleware/__test__/utils.test.d.ts → commands/project/__tests__/validate.test.d.ts} +0 -0
- /package/{commands/create → lib/cmsAssets}/api-sample.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/api-sample.js +0 -0
- /package/{commands/create → lib/cmsAssets}/app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/function.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/function.js +0 -0
- /package/{commands/create → lib/cmsAssets}/index.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/index.js +0 -0
- /package/{commands/create → lib/cmsAssets}/module.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/module.js +0 -0
- /package/{commands/create → lib/cmsAssets}/react-app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/react-app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/template.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/template.js +0 -0
- /package/{commands/create → lib/cmsAssets}/vue-app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/vue-app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/webpack-serverless.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/webpack-serverless.js +0 -0
- /package/{commands/create → lib/cmsAssets}/website-theme.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/website-theme.js +0 -0
- /package/lib/{projects/add/__tests__/v3AddComponent.test.d.ts → middleware/__test__/commandTargetingUtils.test.d.ts} +0 -0
- /package/lib/projects/{create/__tests__/v3.test.d.ts → __tests__/DevServerManager.test.d.ts} +0 -0
- /package/lib/projects/localDev/{LocalDevManager.d.ts → LocalDevManager_DEPRECATED.d.ts} +0 -0
package/lib/doctor/Doctor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../ui/logger.js';
|
|
2
2
|
import { getAccountId, getCWDAccountOverride, } from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import SpinniesManager from '../ui/SpinniesManager.js';
|
|
4
4
|
import { hasMissingPackages } from '../dependencyManagement.js';
|
|
@@ -13,9 +13,8 @@ import { PORT_MANAGER_SERVER_PORT } from '@hubspot/local-dev-lib/constants/ports
|
|
|
13
13
|
import { accessTokenForPersonalAccessKey, authorizedScopesForPortalAndUser, scopesOnAccessToken, } from '@hubspot/local-dev-lib/personalAccessKey';
|
|
14
14
|
import { isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
15
15
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
16
|
-
import { uiCommandReference } from '../ui/index.js';
|
|
17
16
|
import pkg from '../../package.json' with { type: 'json' };
|
|
18
|
-
import {
|
|
17
|
+
import { lib } from '../../lang/en.js';
|
|
19
18
|
import { uiLink } from '../ui/index.js';
|
|
20
19
|
const minMajorNodeVersion = 18;
|
|
21
20
|
export class Doctor {
|
|
@@ -31,7 +30,7 @@ export class Doctor {
|
|
|
31
30
|
}
|
|
32
31
|
async diagnose() {
|
|
33
32
|
SpinniesManager.add('runningDiagnostics', {
|
|
34
|
-
text:
|
|
33
|
+
text: lib.doctor.runningDiagnostics,
|
|
35
34
|
});
|
|
36
35
|
this.diagnosticInfo =
|
|
37
36
|
await this.diagnosticInfoBuilder.generateDiagnosticInfo();
|
|
@@ -48,7 +47,7 @@ export class Doctor {
|
|
|
48
47
|
this.performDefaultAccountOverrideFileChecks();
|
|
49
48
|
this.performCliConfigSettingsChecks();
|
|
50
49
|
SpinniesManager.succeed('runningDiagnostics', {
|
|
51
|
-
text:
|
|
50
|
+
text: lib.doctor.diagnosticsComplete,
|
|
52
51
|
succeedColor: 'white',
|
|
53
52
|
});
|
|
54
53
|
this.diagnosticInfo.diagnosis = this.diagnosis.toString();
|
|
@@ -74,10 +73,8 @@ export class Doctor {
|
|
|
74
73
|
if (!this.diagnosticInfo?.config) {
|
|
75
74
|
this.diagnosis?.addCLIConfigSection({
|
|
76
75
|
type: 'error',
|
|
77
|
-
message:
|
|
78
|
-
secondaryMessaging:
|
|
79
|
-
command: uiCommandReference('hs init'),
|
|
80
|
-
}),
|
|
76
|
+
message: lib.doctor.diagnosis.cliConfig.noConfigFile,
|
|
77
|
+
secondaryMessaging: lib.doctor.diagnosis.cliConfig.noConfigFileSecondary('hs init'),
|
|
81
78
|
});
|
|
82
79
|
return [];
|
|
83
80
|
}
|
|
@@ -87,15 +84,11 @@ export class Doctor {
|
|
|
87
84
|
if (this.diagnosticInfo?.defaultAccountOverrideFile) {
|
|
88
85
|
this.diagnosis?.addDefaultAccountOverrideFileSection({
|
|
89
86
|
type: 'warning',
|
|
90
|
-
message:
|
|
91
|
-
defaultAccountOverrideFile: this.diagnosticInfo.defaultAccountOverrideFile,
|
|
92
|
-
}),
|
|
87
|
+
message: lib.doctor.defaultAccountOverrideFileChecks.overrideActive(this.diagnosticInfo.defaultAccountOverrideFile),
|
|
93
88
|
});
|
|
94
89
|
this.diagnosis?.addDefaultAccountOverrideFileSection({
|
|
95
90
|
type: 'warning',
|
|
96
|
-
message:
|
|
97
|
-
overrideAccountId: getCWDAccountOverride(),
|
|
98
|
-
}),
|
|
91
|
+
message: lib.doctor.defaultAccountOverrideFileChecks.overrideAccountId(getCWDAccountOverride()),
|
|
99
92
|
});
|
|
100
93
|
}
|
|
101
94
|
}
|
|
@@ -103,8 +96,8 @@ export class Doctor {
|
|
|
103
96
|
if (this.diagnosticInfo?.configSettings.httpUseLocalhost) {
|
|
104
97
|
this.diagnosis?.addCLIConfigSection({
|
|
105
98
|
type: 'warning',
|
|
106
|
-
message:
|
|
107
|
-
secondaryMessaging:
|
|
99
|
+
message: lib.doctor.diagnosis.cliConfig.settings.httpUseLocalhost,
|
|
100
|
+
secondaryMessaging: lib.doctor.diagnosis.cliConfig.settings.httpUseLocalhostSecondary,
|
|
108
101
|
});
|
|
109
102
|
}
|
|
110
103
|
}
|
|
@@ -115,25 +108,20 @@ export class Doctor {
|
|
|
115
108
|
const missingScopes = (await authorizedScopesForPortalAndUser(this.accountId)).filter((data) => data.userAuthorized && !pakScopes.has(data.scopeGroup.name));
|
|
116
109
|
this.diagnosis?.addCLIConfigSection({
|
|
117
110
|
type: 'success',
|
|
118
|
-
message:
|
|
111
|
+
message: lib.doctor.accountChecks.active,
|
|
119
112
|
});
|
|
120
|
-
const linkToPakUI = uiLink(
|
|
113
|
+
const linkToPakUI = uiLink(lib.doctor.accountChecks.pak.viewScopes, `${getHubSpotWebsiteOrigin(this.diagnosticInfoBuilder?.env || 'PROD')}/personal-access-key/${this.diagnosticInfo?.account.accountId}`);
|
|
121
114
|
if (missingScopes.length > 0) {
|
|
122
115
|
this.diagnosis?.addCLIConfigSection({
|
|
123
116
|
type: 'warning',
|
|
124
|
-
message:
|
|
125
|
-
secondaryMessaging:
|
|
126
|
-
command: uiCommandReference(`hs auth`),
|
|
127
|
-
link: linkToPakUI,
|
|
128
|
-
}),
|
|
117
|
+
message: lib.doctor.accountChecks.pak.incomplete,
|
|
118
|
+
secondaryMessaging: lib.doctor.accountChecks.pak.incompleteSecondary(linkToPakUI),
|
|
129
119
|
});
|
|
130
120
|
}
|
|
131
121
|
else {
|
|
132
122
|
this.diagnosis?.addCLIConfigSection({
|
|
133
123
|
type: 'success',
|
|
134
|
-
message:
|
|
135
|
-
link: linkToPakUI,
|
|
136
|
-
}),
|
|
124
|
+
message: lib.doctor.accountChecks.pak.valid(linkToPakUI),
|
|
137
125
|
});
|
|
138
126
|
}
|
|
139
127
|
}
|
|
@@ -151,10 +139,8 @@ export class Doctor {
|
|
|
151
139
|
if (portalNotActive) {
|
|
152
140
|
this.diagnosis?.addCLIConfigSection({
|
|
153
141
|
type: 'error',
|
|
154
|
-
message:
|
|
155
|
-
secondaryMessaging:
|
|
156
|
-
command: uiCommandReference(`hs accounts clean`),
|
|
157
|
-
}),
|
|
142
|
+
message: lib.doctor.accountChecks.inactive,
|
|
143
|
+
secondaryMessaging: lib.doctor.accountChecks.inactiveSecondary('hs accounts clean'),
|
|
158
144
|
});
|
|
159
145
|
}
|
|
160
146
|
else if (isSpecifiedError(error, {
|
|
@@ -164,20 +150,18 @@ export class Doctor {
|
|
|
164
150
|
})) {
|
|
165
151
|
this.diagnosis?.addCLIConfigSection({
|
|
166
152
|
type: 'success',
|
|
167
|
-
message:
|
|
153
|
+
message: lib.doctor.accountChecks.active,
|
|
168
154
|
});
|
|
169
155
|
this.diagnosis?.addCLIConfigSection({
|
|
170
156
|
type: 'error',
|
|
171
|
-
message:
|
|
172
|
-
secondaryMessaging:
|
|
173
|
-
command: uiCommandReference(`hs auth`),
|
|
174
|
-
}),
|
|
157
|
+
message: lib.doctor.accountChecks.pak.invalid,
|
|
158
|
+
secondaryMessaging: lib.doctor.accountChecks.pak.invalidSecondary,
|
|
175
159
|
});
|
|
176
160
|
}
|
|
177
161
|
else {
|
|
178
162
|
this.diagnosis?.addCLIConfigSection({
|
|
179
163
|
type: 'error',
|
|
180
|
-
message:
|
|
164
|
+
message: lib.doctor.accountChecks.unableToDetermine,
|
|
181
165
|
});
|
|
182
166
|
}
|
|
183
167
|
}
|
|
@@ -186,7 +170,7 @@ export class Doctor {
|
|
|
186
170
|
if (!this.diagnosticInfo?.versions.node) {
|
|
187
171
|
return this.diagnosis?.addCliSection({
|
|
188
172
|
type: 'error',
|
|
189
|
-
message:
|
|
173
|
+
message: lib.doctor.nodeChecks.unableToDetermine,
|
|
190
174
|
});
|
|
191
175
|
}
|
|
192
176
|
const nodeVersion = this.diagnosticInfo?.versions.node?.split('.');
|
|
@@ -194,16 +178,12 @@ export class Doctor {
|
|
|
194
178
|
if (!currentNodeMajor || parseInt(currentNodeMajor) < minMajorNodeVersion) {
|
|
195
179
|
return this.diagnosis?.addCliSection({
|
|
196
180
|
type: 'warning',
|
|
197
|
-
message:
|
|
198
|
-
nodeVersion: this.diagnosticInfo?.versions.node,
|
|
199
|
-
}),
|
|
181
|
+
message: lib.doctor.nodeChecks.minimumNotMet(this.diagnosticInfo?.versions.node),
|
|
200
182
|
});
|
|
201
183
|
}
|
|
202
184
|
this.diagnosis?.addCliSection({
|
|
203
185
|
type: 'success',
|
|
204
|
-
message:
|
|
205
|
-
nodeVersion: this.diagnosticInfo?.versions.node,
|
|
206
|
-
}),
|
|
186
|
+
message: lib.doctor.nodeChecks.success(this.diagnosticInfo?.versions.node),
|
|
207
187
|
});
|
|
208
188
|
}
|
|
209
189
|
async checkIfNpmIsInstalled() {
|
|
@@ -211,14 +191,12 @@ export class Doctor {
|
|
|
211
191
|
if (!npmVersion) {
|
|
212
192
|
return this.diagnosis?.addCliSection({
|
|
213
193
|
type: 'error',
|
|
214
|
-
message:
|
|
194
|
+
message: lib.doctor.npmChecks.notInstalled,
|
|
215
195
|
});
|
|
216
196
|
}
|
|
217
197
|
this.diagnosis?.addCliSection({
|
|
218
198
|
type: 'success',
|
|
219
|
-
message:
|
|
220
|
-
npmVersion,
|
|
221
|
-
}),
|
|
199
|
+
message: lib.doctor.npmChecks.installed(npmVersion),
|
|
222
200
|
});
|
|
223
201
|
}
|
|
224
202
|
async checkCLIVersion() {
|
|
@@ -232,32 +210,22 @@ export class Doctor {
|
|
|
232
210
|
catch (e) {
|
|
233
211
|
return this.diagnosis?.addCliSection({
|
|
234
212
|
type: 'error',
|
|
235
|
-
message:
|
|
236
|
-
secondaryMessaging:
|
|
237
|
-
command: uiCommandReference(`hs --version`),
|
|
238
|
-
link: uiLink(i18n(`lib.doctor.hsChecks.unableToDetermineSecondaryLink`), `https://www.npmjs.com/package/${pkg.name}?activeTab=versions`),
|
|
239
|
-
}),
|
|
213
|
+
message: lib.doctor.hsChecks.unableToDetermine,
|
|
214
|
+
secondaryMessaging: lib.doctor.hsChecks.unableToDetermineSecondary('hs --version', `https://www.npmjs.com/package/${pkg.name}?activeTab=versions`),
|
|
240
215
|
});
|
|
241
216
|
}
|
|
242
217
|
if (latestCLIVersion !== pkg.version && nextCliVersion !== pkg.version) {
|
|
243
218
|
const onNextTag = pkg.version.includes('beta');
|
|
244
219
|
this.diagnosis?.addCliSection({
|
|
245
220
|
type: 'warning',
|
|
246
|
-
message:
|
|
247
|
-
|
|
248
|
-
}),
|
|
249
|
-
secondaryMessaging: i18n(`lib.doctor.hsChecks.notLatestSecondary`, {
|
|
250
|
-
hsVersion: onNextTag ? nextCliVersion : latestCLIVersion,
|
|
251
|
-
command: uiCommandReference(`npm install -g ${pkg.name}`),
|
|
252
|
-
}),
|
|
221
|
+
message: lib.doctor.hsChecks.notLatest(pkg.version),
|
|
222
|
+
secondaryMessaging: lib.doctor.hsChecks.notLatestSecondary(`npm install -g ${pkg.name}`, onNextTag ? nextCliVersion : latestCLIVersion),
|
|
253
223
|
});
|
|
254
224
|
}
|
|
255
225
|
else {
|
|
256
226
|
this.diagnosis?.addCliSection({
|
|
257
227
|
type: 'success',
|
|
258
|
-
message:
|
|
259
|
-
hsVersion: pkg.version,
|
|
260
|
-
}),
|
|
228
|
+
message: lib.doctor.hsChecks.latest(pkg.version),
|
|
261
229
|
});
|
|
262
230
|
}
|
|
263
231
|
}
|
|
@@ -271,12 +239,8 @@ export class Doctor {
|
|
|
271
239
|
foundError = true;
|
|
272
240
|
this.diagnosis?.addProjectSection({
|
|
273
241
|
type: 'warning',
|
|
274
|
-
message:
|
|
275
|
-
|
|
276
|
-
}),
|
|
277
|
-
secondaryMessaging: i18n(`lib.doctor.projectDependenciesChecks.missingDependenciesSecondary`, {
|
|
278
|
-
command: uiCommandReference('hs project install-deps'),
|
|
279
|
-
}),
|
|
242
|
+
message: lib.doctor.projectDependenciesChecks.missingDependencies(packageDirName),
|
|
243
|
+
secondaryMessaging: lib.doctor.projectDependenciesChecks.missingDependenciesSecondary('hs project install-deps'),
|
|
280
244
|
});
|
|
281
245
|
}
|
|
282
246
|
}
|
|
@@ -285,26 +249,22 @@ export class Doctor {
|
|
|
285
249
|
if (!(await this.isValidJsonFile(packageFile))) {
|
|
286
250
|
this.diagnosis?.addProjectSection({
|
|
287
251
|
type: 'error',
|
|
288
|
-
message:
|
|
289
|
-
filename: packageFile,
|
|
290
|
-
}),
|
|
252
|
+
message: lib.doctor.files.invalidJson(packageFile),
|
|
291
253
|
});
|
|
292
254
|
}
|
|
293
255
|
else {
|
|
294
256
|
this.diagnosis?.addProjectSection({
|
|
295
257
|
type: 'error',
|
|
296
|
-
message:
|
|
297
|
-
dir: packageDirName,
|
|
298
|
-
}),
|
|
258
|
+
message: lib.doctor.projectDependenciesChecks.unableToDetermine(packageDirName),
|
|
299
259
|
});
|
|
300
260
|
}
|
|
301
|
-
|
|
261
|
+
uiLogger.debug(e instanceof Error ? e.message : String(e));
|
|
302
262
|
}
|
|
303
263
|
}
|
|
304
264
|
if (!foundError) {
|
|
305
265
|
this.diagnosis?.addProjectSection({
|
|
306
266
|
type: 'success',
|
|
307
|
-
message:
|
|
267
|
+
message: lib.doctor.projectDependenciesChecks.success,
|
|
308
268
|
});
|
|
309
269
|
}
|
|
310
270
|
}
|
|
@@ -327,16 +287,14 @@ export class Doctor {
|
|
|
327
287
|
foundError = true;
|
|
328
288
|
this.diagnosis?.addProjectSection({
|
|
329
289
|
type: 'error',
|
|
330
|
-
message:
|
|
331
|
-
filename: jsonFile,
|
|
332
|
-
}),
|
|
290
|
+
message: lib.doctor.files.invalidJson(jsonFile),
|
|
333
291
|
});
|
|
334
292
|
}
|
|
335
293
|
}
|
|
336
294
|
if (!foundError) {
|
|
337
295
|
this.diagnosis?.addProjectSection({
|
|
338
296
|
type: 'success',
|
|
339
|
-
message:
|
|
297
|
+
message: lib.doctor.files.validJson,
|
|
340
298
|
});
|
|
341
299
|
}
|
|
342
300
|
}
|
|
@@ -344,20 +302,14 @@ export class Doctor {
|
|
|
344
302
|
if (await isPortManagerPortAvailable()) {
|
|
345
303
|
this.diagnosis?.addProjectSection({
|
|
346
304
|
type: 'success',
|
|
347
|
-
message:
|
|
348
|
-
port: PORT_MANAGER_SERVER_PORT,
|
|
349
|
-
}),
|
|
305
|
+
message: lib.doctor.port.available(PORT_MANAGER_SERVER_PORT),
|
|
350
306
|
});
|
|
351
307
|
return;
|
|
352
308
|
}
|
|
353
309
|
this.diagnosis?.addProjectSection({
|
|
354
310
|
type: 'warning',
|
|
355
|
-
message:
|
|
356
|
-
|
|
357
|
-
}),
|
|
358
|
-
secondaryMessaging: i18n(`lib.doctor.port.inUseSecondary`, {
|
|
359
|
-
command: uiCommandReference('hs project dev'),
|
|
360
|
-
}),
|
|
311
|
+
message: lib.doctor.port.inUse(PORT_MANAGER_SERVER_PORT),
|
|
312
|
+
secondaryMessaging: lib.doctor.port.inUseSecondary('hs project dev'),
|
|
361
313
|
});
|
|
362
314
|
}
|
|
363
315
|
}
|
|
@@ -6,7 +6,7 @@ import { HubSpotHttpError } from '@hubspot/local-dev-lib/models/HubSpotHttpError
|
|
|
6
6
|
import { AxiosError } from 'axios';
|
|
7
7
|
import { isSpecifiedError as _isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
8
8
|
import { promisify as _promisify } from 'util';
|
|
9
|
-
vi.mock('
|
|
9
|
+
vi.mock('../../ui/logger.js');
|
|
10
10
|
vi.mock('../Diagnosis');
|
|
11
11
|
vi.mock('../../ui/SpinniesManager');
|
|
12
12
|
vi.mock('../DiagnosticInfoBuilder');
|
|
@@ -336,7 +336,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
336
336
|
// @ts-expect-error Testing private method
|
|
337
337
|
expect(doctor.diagnosis.addProjectSection).toHaveBeenCalledWith({
|
|
338
338
|
type: 'error',
|
|
339
|
-
message: expect.stringMatching(/
|
|
339
|
+
message: expect.stringMatching(/Invalid JSON in/),
|
|
340
340
|
});
|
|
341
341
|
});
|
|
342
342
|
it('should add error section if it is unable to determine if dependencies need installed', async () => {
|
|
@@ -359,7 +359,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
359
359
|
expect(doctor.diagnosis?.addProjectSection).toHaveBeenCalledWith({
|
|
360
360
|
type: 'warning',
|
|
361
361
|
message: 'Port 8080 is in use',
|
|
362
|
-
secondaryMessaging: expect.stringMatching(/Make sure it is available
|
|
362
|
+
secondaryMessaging: expect.stringMatching(/Make sure it is available before running `hs project dev`/),
|
|
363
363
|
});
|
|
364
364
|
});
|
|
365
365
|
it('should add success section if port is available', async () => {
|
|
@@ -388,7 +388,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
388
388
|
// @ts-expect-error Testing private method
|
|
389
389
|
expect(doctor.diagnosis.addProjectSection).toHaveBeenCalledWith({
|
|
390
390
|
type: 'error',
|
|
391
|
-
message: expect.stringMatching(/
|
|
391
|
+
message: expect.stringMatching(/Invalid JSON in/),
|
|
392
392
|
});
|
|
393
393
|
});
|
|
394
394
|
});
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../ui/logger.js';
|
|
2
2
|
import { isHubSpotHttpError, isValidationError, } from '@hubspot/local-dev-lib/errors/index';
|
|
3
3
|
import { getConfig } from '@hubspot/local-dev-lib/config';
|
|
4
4
|
import { shouldSuppressError } from './suppressError.js';
|
|
5
|
-
import {
|
|
5
|
+
import { lib } from '../../lang/en.js';
|
|
6
6
|
import util from 'util';
|
|
7
|
-
import { uiCommandReference } from '../ui/index.js';
|
|
8
7
|
import { isProjectValidationError } from '../errors/ProjectValidationError.js';
|
|
9
8
|
export function logError(error, context) {
|
|
10
9
|
debugError(error, context);
|
|
11
10
|
if (isProjectValidationError(error)) {
|
|
12
|
-
|
|
11
|
+
uiLogger.error(error.message);
|
|
13
12
|
return;
|
|
14
13
|
}
|
|
15
14
|
if (shouldSuppressError(error, context)) {
|
|
@@ -24,7 +23,7 @@ export function logError(error, context) {
|
|
|
24
23
|
error.updateContext(context);
|
|
25
24
|
}
|
|
26
25
|
if (isHubSpotHttpError(error) && isValidationError(error)) {
|
|
27
|
-
|
|
26
|
+
uiLogger.error(error.formattedValidationErrors());
|
|
28
27
|
}
|
|
29
28
|
else if (isErrorWithMessageOrReason(error)) {
|
|
30
29
|
const message = [];
|
|
@@ -33,44 +32,37 @@ export function logError(error, context) {
|
|
|
33
32
|
message.push(msg);
|
|
34
33
|
}
|
|
35
34
|
});
|
|
36
|
-
|
|
35
|
+
uiLogger.error(message.join(' '));
|
|
37
36
|
}
|
|
38
37
|
else {
|
|
39
38
|
// Unknown errors
|
|
40
|
-
|
|
39
|
+
uiLogger.error(lib.errorHandlers.index.unknownErrorOccurred);
|
|
41
40
|
}
|
|
42
41
|
if (isHubSpotHttpError(error) && error.code === 'ETIMEDOUT') {
|
|
43
42
|
const config = getConfig();
|
|
44
43
|
const defaultTimeout = config?.httpTimeout;
|
|
45
44
|
// Timeout was caused by the default timeout
|
|
46
45
|
if (error.timeout && defaultTimeout === error.timeout) {
|
|
47
|
-
|
|
48
|
-
timeout: error.timeout,
|
|
49
|
-
configSetCommand: uiCommandReference('hs config set'),
|
|
50
|
-
}));
|
|
46
|
+
uiLogger.error(lib.errorHandlers.index.configTimeoutErrorOccurred(error.timeout, 'hs config set'));
|
|
51
47
|
}
|
|
52
48
|
// Timeout was caused by a custom timeout set by the CLI or LDL
|
|
53
49
|
else {
|
|
54
|
-
|
|
50
|
+
uiLogger.error(lib.errorHandlers.index.genericTimeoutErrorOccurred);
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
54
|
export function debugError(error, context) {
|
|
59
55
|
if (isHubSpotHttpError(error)) {
|
|
60
|
-
|
|
56
|
+
uiLogger.debug(error.toString());
|
|
61
57
|
}
|
|
62
58
|
else {
|
|
63
|
-
|
|
59
|
+
uiLogger.debug(lib.errorHandlers.index.errorOccurred(String(error)));
|
|
64
60
|
}
|
|
65
61
|
if (error instanceof Error && error.cause && !isHubSpotHttpError(error)) {
|
|
66
|
-
|
|
67
|
-
cause: util.inspect(error.cause, false, null, true),
|
|
68
|
-
}));
|
|
62
|
+
uiLogger.debug(lib.errorHandlers.index.errorCause(util.inspect(error.cause, false, null, true)));
|
|
69
63
|
}
|
|
70
64
|
if (context) {
|
|
71
|
-
|
|
72
|
-
context: util.inspect(context, false, null, true),
|
|
73
|
-
}));
|
|
65
|
+
uiLogger.debug(lib.errorHandlers.index.errorContext(util.inspect(context, false, null, true)));
|
|
74
66
|
}
|
|
75
67
|
}
|
|
76
68
|
export class ApiErrorContext {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isSpecifiedError, isMissingScopeError, } from '@hubspot/local-dev-lib/errors/index';
|
|
2
|
-
import {
|
|
2
|
+
import { uiLogger } from '../ui/logger.js';
|
|
3
3
|
import { PLATFORM_VERSION_ERROR_TYPES } from '../constants.js';
|
|
4
|
-
import {
|
|
5
|
-
import { uiAccountDescription, uiLine, uiLink
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
5
|
+
import { uiAccountDescription, uiLine, uiLink } from '../ui/index.js';
|
|
6
6
|
function createPlatformVersionError(err, subCategory) {
|
|
7
7
|
let translationKey = 'unspecifiedPlatformVersion';
|
|
8
8
|
let platformVersion = 'unspecified platformVersion';
|
|
@@ -17,25 +17,18 @@ function createPlatformVersionError(err, subCategory) {
|
|
|
17
17
|
translationKey = 'nonExistentPlatformVersion';
|
|
18
18
|
}
|
|
19
19
|
uiLine();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}));
|
|
20
|
+
uiLogger.error(lib.errorHandlers.suppressErrors.platformVersionErrors.header);
|
|
21
|
+
const errorMessage = lib.errorHandlers.suppressErrors.platformVersionErrors[translationKey];
|
|
22
|
+
uiLogger.log(typeof errorMessage === 'function'
|
|
23
|
+
? errorMessage(platformVersion)
|
|
24
|
+
: errorMessage);
|
|
25
|
+
uiLogger.log(lib.errorHandlers.suppressErrors.platformVersionErrors.updateProject);
|
|
26
|
+
uiLogger.log(lib.errorHandlers.suppressErrors.platformVersionErrors.betaLink(uiLink(lib.errorHandlers.suppressErrors.platformVersionErrors.docsLink, 'https://developers.hubspot.com/docs/developer-tooling/platform/versioning')));
|
|
28
27
|
uiLine();
|
|
29
28
|
}
|
|
30
29
|
export function shouldSuppressError(err, context) {
|
|
31
30
|
if (isMissingScopeError(err)) {
|
|
32
|
-
|
|
33
|
-
accountName: context?.accountId
|
|
34
|
-
? uiAccountDescription(context.accountId)
|
|
35
|
-
: '',
|
|
36
|
-
request: context?.request || 'request',
|
|
37
|
-
authCommand: uiCommandReference('hs auth'),
|
|
38
|
-
}));
|
|
31
|
+
uiLogger.error(lib.errorHandlers.suppressErrors.missingScopeError(context?.request || 'request', context?.accountId ? uiAccountDescription(context.accountId) : ''));
|
|
39
32
|
return true;
|
|
40
33
|
}
|
|
41
34
|
if (isSpecifiedError(err, {
|
package/lib/generateSelectors.js
CHANGED
|
@@ -11,7 +11,7 @@ export function getMaxFieldsDepth() {
|
|
|
11
11
|
export function findFieldsJsonPath(basePath) {
|
|
12
12
|
const _path = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath;
|
|
13
13
|
if (!fs.existsSync(_path)) {
|
|
14
|
-
uiLogger.error(commands.theme.subcommands.generateSelectors.errors.invalidPath(basePath));
|
|
14
|
+
uiLogger.error(commands.cms.subcommands.theme.subcommands.generateSelectors.errors.invalidPath(basePath));
|
|
15
15
|
process.exit(EXIT_CODES.ERROR);
|
|
16
16
|
}
|
|
17
17
|
const files = fs.readdirSync(_path);
|
package/lib/lang.js
CHANGED
|
@@ -2,7 +2,7 @@ import util from 'util';
|
|
|
2
2
|
import path, { dirname } from 'path';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
4
|
import yaml from 'js-yaml';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from './ui/logger.js';
|
|
6
6
|
import { interpolate } from './interpolation.js';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -22,10 +22,11 @@ function loadLanguageFromYaml() {
|
|
|
22
22
|
// Fall back to using the default language file
|
|
23
23
|
locale = languageFileExists ? nodeLocale : 'en';
|
|
24
24
|
languageObj = yaml.load(fs.readFileSync(path.join(__dirname, `../lang/${locale}.lyaml`), 'utf8'));
|
|
25
|
-
|
|
25
|
+
uiLogger.debug('Loaded language data: ' + util.inspect(languageObj, true, 999, true));
|
|
26
26
|
}
|
|
27
27
|
catch (e) {
|
|
28
|
-
|
|
28
|
+
uiLogger.error('Error loading language data: ' +
|
|
29
|
+
(e instanceof Error ? e.message : String(e)));
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
function getTextValue(lookupDotNotation) {
|
|
@@ -42,8 +43,8 @@ function getTextValue(lookupDotNotation) {
|
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
catch (e) {
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
uiLogger.debug(`Unable to access language property: ${lookupProps.join('.')}. Failed to access prop "${previouslyCheckedProp}".`);
|
|
47
|
+
uiLogger.error('Unable to access language property.');
|
|
47
48
|
return missingTextData;
|
|
48
49
|
}
|
|
49
50
|
if (!textValue) {
|
package/lib/links.js
CHANGED
|
@@ -2,7 +2,7 @@ import open from 'open';
|
|
|
2
2
|
import { getEnv } from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
|
|
4
4
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from './ui/logger.js';
|
|
6
6
|
import { getTableContents, getTableHeader } from './ui/table.js';
|
|
7
7
|
const COMMON_SITE_LINKS = {
|
|
8
8
|
APPS_MARKETPLACE: {
|
|
@@ -87,17 +87,17 @@ export function logSiteLinks(accountId) {
|
|
|
87
87
|
l.url,
|
|
88
88
|
]);
|
|
89
89
|
linksAsArray.unshift(getTableHeader(['Shortcut', '', 'Url']));
|
|
90
|
-
|
|
90
|
+
uiLogger.log(getTableContents(linksAsArray));
|
|
91
91
|
}
|
|
92
92
|
export function openLink(accountId, shortcut) {
|
|
93
93
|
const match = Object.values(COMMON_SITE_LINKS).find(l => l.shortcut === shortcut || (l.alias && l.alias === shortcut));
|
|
94
94
|
if (!match) {
|
|
95
|
-
|
|
95
|
+
uiLogger.error(`We couldn't find a shortcut matching ${shortcut}. Type 'hs open list' to see a list of available shortcuts`);
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
const baseUrl = getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD);
|
|
99
99
|
open(match.getUrl(accountId, baseUrl), { url: true });
|
|
100
|
-
|
|
100
|
+
uiLogger.success(`We opened ${match.getUrl(accountId, baseUrl)} in your browser`);
|
|
101
101
|
}
|
|
102
102
|
export function getProductUpdatesUrl(rolloutId, accountId) {
|
|
103
103
|
const baseUrl = getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as cliConfig from '@hubspot/local-dev-lib/config';
|
|
2
|
+
import { isTargetedCommand, shouldLoadConfigForCommand, shouldRunAccountValidationForCommand, shouldRunConfigValidationForCommand, } from '../commandTargetingUtils.js';
|
|
3
|
+
vi.mock('@hubspot/local-dev-lib/config');
|
|
4
|
+
const configFileExistsSpy = vi.spyOn(cliConfig, 'configFileExists');
|
|
5
|
+
const targetCommandMap = {
|
|
6
|
+
init: true,
|
|
7
|
+
account: {
|
|
8
|
+
use: true,
|
|
9
|
+
},
|
|
10
|
+
project: {
|
|
11
|
+
deploy: true,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
describe('lib/middleware/commandTargetingUtils', () => {
|
|
15
|
+
describe('isTargetedCommand()', () => {
|
|
16
|
+
it('should return true for a direct target command', () => {
|
|
17
|
+
const result = isTargetedCommand(['init'], targetCommandMap);
|
|
18
|
+
expect(result).toBe(true);
|
|
19
|
+
});
|
|
20
|
+
it('should return false for a command with a subcommand', () => {
|
|
21
|
+
const result = isTargetedCommand(['account'], targetCommandMap);
|
|
22
|
+
expect(result).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
it('should return true for a nested target command', () => {
|
|
25
|
+
const result = isTargetedCommand(['project', 'deploy'], targetCommandMap);
|
|
26
|
+
expect(result).toBe(true);
|
|
27
|
+
});
|
|
28
|
+
it('should return false for a non-existent command', () => {
|
|
29
|
+
const result = isTargetedCommand(['nonexistent'], targetCommandMap);
|
|
30
|
+
expect(result).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
it('should return false for a non-targeted command', () => {
|
|
33
|
+
const result = isTargetedCommand(['auth'], targetCommandMap);
|
|
34
|
+
expect(result).toBe(false);
|
|
35
|
+
});
|
|
36
|
+
it('should return false for a command with a targeted subcommand', () => {
|
|
37
|
+
const result = isTargetedCommand(['project'], targetCommandMap);
|
|
38
|
+
expect(result).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
it('should return false for a non-existent subcommand', () => {
|
|
41
|
+
const result = isTargetedCommand(['auth', 'nonexistent'], targetCommandMap);
|
|
42
|
+
expect(result).toBe(false);
|
|
43
|
+
});
|
|
44
|
+
it('should return false for an empty command array', () => {
|
|
45
|
+
const result = isTargetedCommand([], targetCommandMap);
|
|
46
|
+
expect(result).toBe(false);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe('shouldLoadConfigForCommand()', () => {
|
|
50
|
+
it('should return true for a command that requires a config file', () => {
|
|
51
|
+
const result = shouldLoadConfigForCommand(['account', 'use']);
|
|
52
|
+
expect(result).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
it('should return false for a command that does not require a config file', () => {
|
|
55
|
+
const result = shouldLoadConfigForCommand(['init']);
|
|
56
|
+
expect(result).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
it('should return false when the user is trying to migrate the global config', () => {
|
|
59
|
+
configFileExistsSpy.mockReturnValue(false);
|
|
60
|
+
const result = shouldLoadConfigForCommand(['config', 'migrate']);
|
|
61
|
+
expect(result).toBe(false);
|
|
62
|
+
});
|
|
63
|
+
it('should return true when the global config file does exist', () => {
|
|
64
|
+
configFileExistsSpy.mockReturnValue(true);
|
|
65
|
+
const result = shouldLoadConfigForCommand(['account', 'use']);
|
|
66
|
+
expect(result).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe('shouldRunAccountValidationForCommand()', () => {
|
|
70
|
+
it('should return true for a command that requires a config file', () => {
|
|
71
|
+
const result = shouldRunAccountValidationForCommand([
|
|
72
|
+
'project',
|
|
73
|
+
'upload',
|
|
74
|
+
]);
|
|
75
|
+
expect(result).toBe(true);
|
|
76
|
+
});
|
|
77
|
+
it('should return false for a command that does not require account validation', () => {
|
|
78
|
+
const result1 = shouldRunAccountValidationForCommand(['init']);
|
|
79
|
+
const result2 = shouldRunAccountValidationForCommand(['auth']);
|
|
80
|
+
const result3 = shouldRunAccountValidationForCommand([
|
|
81
|
+
'accounts',
|
|
82
|
+
'list',
|
|
83
|
+
]);
|
|
84
|
+
expect(result1).toBe(false);
|
|
85
|
+
expect(result2).toBe(false);
|
|
86
|
+
expect(result3).toBe(false);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
describe('shouldRunConfigValidationForCommand()', () => {
|
|
90
|
+
it('should return true for a command that requires a config file', () => {
|
|
91
|
+
const result = shouldRunConfigValidationForCommand(['account', 'use']);
|
|
92
|
+
expect(result).toBe(true);
|
|
93
|
+
});
|
|
94
|
+
it('should return false for a command that does not require config validation', () => {
|
|
95
|
+
const result = shouldRunConfigValidationForCommand(['init']);
|
|
96
|
+
expect(result).toBe(false);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
});
|