@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
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
|
+
import { DevModeInterface as UIEDevModeInterface } from '@hubspot/ui-extensions-dev-server';
|
|
3
|
+
import { startPortManagerServer, stopPortManagerServer, requestPorts, } from '@hubspot/local-dev-lib/portManager';
|
|
4
|
+
import { getHubSpotApiOrigin, getHubSpotWebsiteOrigin, } from '@hubspot/local-dev-lib/urls';
|
|
5
|
+
import { getAccountConfig } from '@hubspot/local-dev-lib/config';
|
|
6
|
+
import { ComponentTypes, } from '../../../types/Projects.js';
|
|
7
|
+
import { lib } from '../../../lang/en.js';
|
|
8
|
+
import { uiLogger } from '../../ui/logger.js';
|
|
9
|
+
const SERVER_KEYS = {
|
|
10
|
+
privateApp: 'privateApp',
|
|
11
|
+
publicApp: 'publicApp',
|
|
12
|
+
};
|
|
13
|
+
class DevServerManager_DEPRECATED {
|
|
14
|
+
initialized;
|
|
15
|
+
started;
|
|
16
|
+
componentsByType;
|
|
17
|
+
devServers;
|
|
18
|
+
constructor() {
|
|
19
|
+
this.initialized = false;
|
|
20
|
+
this.started = false;
|
|
21
|
+
this.componentsByType = {};
|
|
22
|
+
this.devServers = {
|
|
23
|
+
[SERVER_KEYS.privateApp]: {
|
|
24
|
+
componentType: ComponentTypes.PrivateApp,
|
|
25
|
+
serverInterface: UIEDevModeInterface,
|
|
26
|
+
},
|
|
27
|
+
[SERVER_KEYS.publicApp]: {
|
|
28
|
+
componentType: ComponentTypes.PublicApp,
|
|
29
|
+
serverInterface: UIEDevModeInterface,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async iterateDevServers(callback) {
|
|
34
|
+
const serverKeys = Object.keys(this.devServers);
|
|
35
|
+
for (let i = 0; i < serverKeys.length; i++) {
|
|
36
|
+
const serverKey = serverKeys[i];
|
|
37
|
+
const devServer = this.devServers[serverKey];
|
|
38
|
+
const compatibleComponents = this.componentsByType[devServer.componentType] || {};
|
|
39
|
+
if (Object.keys(compatibleComponents).length) {
|
|
40
|
+
await callback(devServer.serverInterface, compatibleComponents);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
uiLogger.debug(lib.DevServerManager.noCompatibleComponents(serverKey));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
arrangeComponentsByType(components) {
|
|
48
|
+
return components.reduce((acc, component) => {
|
|
49
|
+
if (!acc[component.type]) {
|
|
50
|
+
acc[component.type] = {};
|
|
51
|
+
}
|
|
52
|
+
if ('name' in component.config && component.config.name) {
|
|
53
|
+
acc[component.type][component.config.name] = component;
|
|
54
|
+
}
|
|
55
|
+
return acc;
|
|
56
|
+
}, {});
|
|
57
|
+
}
|
|
58
|
+
async setup({ components, onUploadRequired, accountId, setActiveApp, }) {
|
|
59
|
+
this.componentsByType = this.arrangeComponentsByType(components);
|
|
60
|
+
let env;
|
|
61
|
+
const accountConfig = getAccountConfig(accountId);
|
|
62
|
+
if (accountConfig) {
|
|
63
|
+
env = accountConfig.env;
|
|
64
|
+
}
|
|
65
|
+
await startPortManagerServer();
|
|
66
|
+
await this.iterateDevServers(async (serverInterface, compatibleComponents) => {
|
|
67
|
+
if (serverInterface.setup) {
|
|
68
|
+
await serverInterface.setup({
|
|
69
|
+
components: compatibleComponents,
|
|
70
|
+
onUploadRequired,
|
|
71
|
+
logger,
|
|
72
|
+
urls: {
|
|
73
|
+
api: getHubSpotApiOrigin(env),
|
|
74
|
+
web: getHubSpotWebsiteOrigin(env),
|
|
75
|
+
},
|
|
76
|
+
setActiveApp,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
this.initialized = true;
|
|
81
|
+
}
|
|
82
|
+
async start({ accountId, projectConfig, }) {
|
|
83
|
+
if (this.initialized) {
|
|
84
|
+
await this.iterateDevServers(async (serverInterface) => {
|
|
85
|
+
if (serverInterface.start) {
|
|
86
|
+
await serverInterface.start({
|
|
87
|
+
accountId,
|
|
88
|
+
projectConfig,
|
|
89
|
+
requestPorts,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
throw new Error(lib.DevServerManager.notInitialized);
|
|
96
|
+
}
|
|
97
|
+
this.started = true;
|
|
98
|
+
}
|
|
99
|
+
async fileChange({ filePath, event, }) {
|
|
100
|
+
if (this.started) {
|
|
101
|
+
this.iterateDevServers(async (serverInterface) => {
|
|
102
|
+
if (serverInterface.fileChange) {
|
|
103
|
+
await serverInterface.fileChange(filePath, event);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async cleanup() {
|
|
109
|
+
if (this.started) {
|
|
110
|
+
await this.iterateDevServers(async (serverInterface) => {
|
|
111
|
+
if (serverInterface.cleanup) {
|
|
112
|
+
await serverInterface.cleanup();
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
await stopPortManagerServer();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const Manager = new DevServerManager_DEPRECATED();
|
|
120
|
+
export default Manager;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getAccountId, hasLocalStateFlag } from '@hubspot/local-dev-lib/config';
|
|
2
2
|
import { getConfigDefaultAccount } from '@hubspot/local-dev-lib/config';
|
|
3
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
4
3
|
import { uiLogger } from '../../ui/logger.js';
|
|
5
4
|
import { uiBetaTag, uiLine, uiAccountDescription, uiCommandReference, } from '../../ui/index.js';
|
|
6
5
|
import { lib } from '../../../lang/en.js';
|
|
@@ -26,7 +25,7 @@ class LocalDevLogger {
|
|
|
26
25
|
}
|
|
27
26
|
handleError(e, langFunction) {
|
|
28
27
|
if (this.state.debug) {
|
|
29
|
-
|
|
28
|
+
uiLogger.error(e instanceof Error ? e.message : String(e));
|
|
30
29
|
}
|
|
31
30
|
uiLogger.error(langFunction(e instanceof Error ? e.message : ''));
|
|
32
31
|
}
|
|
@@ -119,35 +118,35 @@ class LocalDevLogger {
|
|
|
119
118
|
uiLogger.log(lib.LocalDevProcess.projectConfigMismatch);
|
|
120
119
|
}
|
|
121
120
|
uploadError(error) {
|
|
122
|
-
|
|
121
|
+
uiLogger.log('');
|
|
123
122
|
logError(error);
|
|
124
123
|
uiLogger.log(lib.LocalDevProcess.uploadFailed);
|
|
125
|
-
|
|
124
|
+
uiLogger.log('');
|
|
126
125
|
}
|
|
127
126
|
uploadSuccess() {
|
|
128
|
-
|
|
127
|
+
uiLogger.log('');
|
|
129
128
|
uiLogger.log(lib.LocalDevProcess.uploadSuccess);
|
|
130
129
|
uiLine();
|
|
131
|
-
|
|
130
|
+
uiLogger.log('');
|
|
132
131
|
}
|
|
133
132
|
uploadSuccessAutoDeployDisabled() {
|
|
134
133
|
uiLogger.warn(lib.LocalDevProcess.uploadSuccessAutoDeployDisabled);
|
|
135
134
|
uiLine();
|
|
136
|
-
|
|
135
|
+
uiLogger.log('');
|
|
137
136
|
}
|
|
138
137
|
deployError(error) {
|
|
139
|
-
|
|
138
|
+
uiLogger.log('');
|
|
140
139
|
if (error) {
|
|
141
140
|
logError(error);
|
|
142
141
|
}
|
|
143
142
|
uiLogger.log(lib.LocalDevProcess.deployFailed);
|
|
144
|
-
|
|
143
|
+
uiLogger.log('');
|
|
145
144
|
}
|
|
146
145
|
deploySuccess() {
|
|
147
|
-
|
|
146
|
+
uiLogger.log('');
|
|
148
147
|
uiLogger.log(lib.LocalDevProcess.deploySuccess);
|
|
149
148
|
uiLine();
|
|
150
|
-
|
|
149
|
+
uiLogger.log('');
|
|
151
150
|
}
|
|
152
151
|
monitorConsoleOutput() {
|
|
153
152
|
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
@@ -4,13 +4,12 @@ import chalk from 'chalk';
|
|
|
4
4
|
import { fetchAppInstallationData } from '@hubspot/local-dev-lib/api/localDevAuth';
|
|
5
5
|
import { fetchPublicAppsForPortal, fetchPublicAppProductionInstallCounts, } from '@hubspot/local-dev-lib/api/appsDev';
|
|
6
6
|
import { getAccountId, getConfigDefaultAccount, } from '@hubspot/local-dev-lib/config';
|
|
7
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
8
7
|
import { PROJECT_CONFIG_FILE } from '../../constants.js';
|
|
9
8
|
import SpinniesManager from '../../ui/SpinniesManager.js';
|
|
10
|
-
import
|
|
9
|
+
import DevServerManager_DEPRECATED from './DevServerManager_DEPRECATED.js';
|
|
11
10
|
import { EXIT_CODES } from '../../enums/exitCodes.js';
|
|
12
11
|
import { getAccountHomeUrl } from '../urls.js';
|
|
13
|
-
import { componentIsApp, componentIsPublicApp, CONFIG_FILES, getAppCardConfigs, getComponentUid, } from '
|
|
12
|
+
import { componentIsApp, componentIsPublicApp, CONFIG_FILES, getAppCardConfigs, getComponentUid, } from '../structure.js';
|
|
14
13
|
import { ComponentTypes, } from '../../../types/Projects.js';
|
|
15
14
|
import { UI_COLORS, uiCommandReference, uiAccountDescription, uiBetaTag, uiLink, uiLine, } from '../../ui/index.js';
|
|
16
15
|
import { logError } from '../../errorHandlers/index.js';
|
|
@@ -314,7 +313,7 @@ class LocalDevManager {
|
|
|
314
313
|
}
|
|
315
314
|
async devServerSetup() {
|
|
316
315
|
try {
|
|
317
|
-
await
|
|
316
|
+
await DevServerManager_DEPRECATED.setup({
|
|
318
317
|
components: this.runnableComponents,
|
|
319
318
|
onUploadRequired: this.logUploadWarning.bind(this),
|
|
320
319
|
accountId: this.targetAccountId,
|
|
@@ -324,7 +323,7 @@ class LocalDevManager {
|
|
|
324
323
|
}
|
|
325
324
|
catch (e) {
|
|
326
325
|
if (this.debug) {
|
|
327
|
-
|
|
326
|
+
uiLogger.error(e instanceof Error ? e.message : String(e));
|
|
328
327
|
}
|
|
329
328
|
uiLogger.error(lib.LocalDevManager.devServer.setupError(e instanceof Error ? e.message : ''));
|
|
330
329
|
return false;
|
|
@@ -332,14 +331,14 @@ class LocalDevManager {
|
|
|
332
331
|
}
|
|
333
332
|
async devServerStart() {
|
|
334
333
|
try {
|
|
335
|
-
await
|
|
334
|
+
await DevServerManager_DEPRECATED.start({
|
|
336
335
|
accountId: this.targetAccountId,
|
|
337
336
|
projectConfig: this.projectConfig,
|
|
338
337
|
});
|
|
339
338
|
}
|
|
340
339
|
catch (e) {
|
|
341
340
|
if (this.debug) {
|
|
342
|
-
|
|
341
|
+
uiLogger.error(e instanceof Error ? e.message : String(e));
|
|
343
342
|
}
|
|
344
343
|
uiLogger.error(lib.LocalDevManager.devServer.startError(e instanceof Error ? e.message : ''));
|
|
345
344
|
process.exit(EXIT_CODES.ERROR);
|
|
@@ -347,23 +346,23 @@ class LocalDevManager {
|
|
|
347
346
|
}
|
|
348
347
|
devServerFileChange(filePath, event) {
|
|
349
348
|
try {
|
|
350
|
-
|
|
349
|
+
DevServerManager_DEPRECATED.fileChange({ filePath, event });
|
|
351
350
|
}
|
|
352
351
|
catch (e) {
|
|
353
352
|
if (this.debug) {
|
|
354
|
-
|
|
353
|
+
uiLogger.error(e instanceof Error ? e.message : String(e));
|
|
355
354
|
}
|
|
356
355
|
uiLogger.error(lib.LocalDevManager.devServer.fileChangeError(e instanceof Error ? e.message : ''));
|
|
357
356
|
}
|
|
358
357
|
}
|
|
359
358
|
async devServerCleanup() {
|
|
360
359
|
try {
|
|
361
|
-
await
|
|
360
|
+
await DevServerManager_DEPRECATED.cleanup();
|
|
362
361
|
return true;
|
|
363
362
|
}
|
|
364
363
|
catch (e) {
|
|
365
364
|
if (this.debug) {
|
|
366
|
-
|
|
365
|
+
uiLogger.error(e instanceof Error ? e.message : String(e));
|
|
367
366
|
}
|
|
368
367
|
uiLogger.error(lib.LocalDevManager.devServer.cleanupError(e instanceof Error ? e.message : ''));
|
|
369
368
|
return false;
|
|
@@ -5,7 +5,7 @@ import path from 'path';
|
|
|
5
5
|
import open from 'open';
|
|
6
6
|
import LocalDevState from './LocalDevState.js';
|
|
7
7
|
import LocalDevLogger from './LocalDevLogger.js';
|
|
8
|
-
import
|
|
8
|
+
import DevServerManager from './DevServerManager.js';
|
|
9
9
|
import { EXIT_CODES } from '../../enums/exitCodes.js';
|
|
10
10
|
import { getProjectConfig } from '../config.js';
|
|
11
11
|
import { handleProjectUpload } from '../upload.js';
|
|
@@ -23,7 +23,7 @@ class LocalDevProcess {
|
|
|
23
23
|
constructor(options) {
|
|
24
24
|
this.state = new LocalDevState(options);
|
|
25
25
|
this._logger = new LocalDevLogger(this.state);
|
|
26
|
-
this.devServerManager = new
|
|
26
|
+
this.devServerManager = new DevServerManager({
|
|
27
27
|
localDevState: this.state,
|
|
28
28
|
logger: this._logger,
|
|
29
29
|
});
|
|
@@ -149,6 +149,7 @@ class LocalDevProcess {
|
|
|
149
149
|
this.openLocalDevUi();
|
|
150
150
|
}
|
|
151
151
|
await this.startDevServers();
|
|
152
|
+
this.state.devServersStarted = true;
|
|
152
153
|
this.logger.monitorConsoleOutput();
|
|
153
154
|
}
|
|
154
155
|
async stop(showProgress = true) {
|
|
@@ -19,6 +19,7 @@ declare class LocalDevState {
|
|
|
19
19
|
private _appData;
|
|
20
20
|
private _devServerMessage;
|
|
21
21
|
private _uploadWarnings;
|
|
22
|
+
private _devServersStarted;
|
|
22
23
|
constructor({ targetProjectAccountId, targetTestingAccountId, projectConfig, projectDir, projectData, debug, initialProjectNodes, initialProjectProfileData, profile, env, }: LocalDevStateConstructorOptions);
|
|
23
24
|
private runListeners;
|
|
24
25
|
get targetProjectAccountId(): number;
|
|
@@ -51,6 +52,8 @@ declare class LocalDevState {
|
|
|
51
52
|
get devServerMessage(): string;
|
|
52
53
|
set devServerMessage(message: LocalDevServerMessage);
|
|
53
54
|
get uploadWarnings(): Set<string>;
|
|
55
|
+
get devServersStarted(): boolean;
|
|
56
|
+
set devServersStarted(started: boolean);
|
|
54
57
|
addUploadWarning(warning: string): void;
|
|
55
58
|
clearUploadWarnings(): void;
|
|
56
59
|
addListener<K extends keyof LocalDevState>(key: K, listener: LocalDevStateListener<K>): void;
|
|
@@ -15,6 +15,7 @@ class LocalDevState {
|
|
|
15
15
|
_appData;
|
|
16
16
|
_devServerMessage;
|
|
17
17
|
_uploadWarnings;
|
|
18
|
+
_devServersStarted;
|
|
18
19
|
constructor({ targetProjectAccountId, targetTestingAccountId, projectConfig, projectDir, projectData, debug, initialProjectNodes, initialProjectProfileData, profile, env, }) {
|
|
19
20
|
this._targetProjectAccountId = targetProjectAccountId;
|
|
20
21
|
this._targetTestingAccountId = targetTestingAccountId;
|
|
@@ -30,6 +31,7 @@ class LocalDevState {
|
|
|
30
31
|
this._appData = {};
|
|
31
32
|
this._devServerMessage = LOCAL_DEV_SERVER_MESSAGE_TYPES.INITIAL;
|
|
32
33
|
this._uploadWarnings = new Set();
|
|
34
|
+
this._devServersStarted = false;
|
|
33
35
|
this._listeners = {};
|
|
34
36
|
}
|
|
35
37
|
runListeners(key) {
|
|
@@ -106,6 +108,13 @@ class LocalDevState {
|
|
|
106
108
|
get uploadWarnings() {
|
|
107
109
|
return this._uploadWarnings;
|
|
108
110
|
}
|
|
111
|
+
get devServersStarted() {
|
|
112
|
+
return this._devServersStarted;
|
|
113
|
+
}
|
|
114
|
+
set devServersStarted(started) {
|
|
115
|
+
this._devServersStarted = started;
|
|
116
|
+
this.runListeners('devServersStarted');
|
|
117
|
+
}
|
|
109
118
|
addUploadWarning(warning) {
|
|
110
119
|
this.uploadWarnings.add(warning);
|
|
111
120
|
this.runListeners('uploadWarnings');
|
|
@@ -3,19 +3,22 @@ declare class LocalDevWebsocketServer {
|
|
|
3
3
|
private server?;
|
|
4
4
|
private debug?;
|
|
5
5
|
private localDevProcess;
|
|
6
|
-
private ALLOWED_ORIGINS;
|
|
7
6
|
constructor(localDevProcess: LocalDevProcess, debug?: boolean);
|
|
8
7
|
private log;
|
|
9
8
|
private logError;
|
|
10
9
|
private sendMessage;
|
|
11
10
|
private handleUpload;
|
|
12
11
|
private handleDeploy;
|
|
12
|
+
private handleAppInstallSuccess;
|
|
13
|
+
private handleAppInstallFailure;
|
|
14
|
+
private handleAppInstallInitiated;
|
|
13
15
|
private setupMessageHandlers;
|
|
14
16
|
private sendCliMetadata;
|
|
15
17
|
private sendProjectData;
|
|
16
18
|
private setupProjectNodesListener;
|
|
17
19
|
private setupAppDataListener;
|
|
18
20
|
private setupUploadWarningsListener;
|
|
21
|
+
private setupDevServersStartedListener;
|
|
19
22
|
private setupStateListeners;
|
|
20
23
|
start(): Promise<void>;
|
|
21
24
|
shutdown(): void;
|
|
@@ -1,37 +1,33 @@
|
|
|
1
1
|
import { WebSocketServer } from 'ws';
|
|
2
2
|
import { isPortManagerServerRunning, requestPorts, } from '@hubspot/local-dev-lib/portManager';
|
|
3
|
-
import {
|
|
3
|
+
import { uiLogger } from '../../ui/logger.js';
|
|
4
4
|
import { addLocalStateFlag } from '@hubspot/local-dev-lib/config';
|
|
5
|
-
import { LOCAL_DEV_UI_MESSAGE_SEND_TYPES, LOCAL_DEV_SERVER_MESSAGE_TYPES, CONFIG_LOCAL_STATE_FLAGS, } from '../../constants.js';
|
|
5
|
+
import { LOCAL_DEV_UI_MESSAGE_SEND_TYPES, LOCAL_DEV_SERVER_MESSAGE_TYPES, CONFIG_LOCAL_STATE_FLAGS, LOCAL_DEV_WEBSOCKET_SERVER_INSTANCE_ID, } from '../../constants.js';
|
|
6
6
|
import { lib } from '../../../lang/en.js';
|
|
7
7
|
import { removeAnsiCodes } from '../../ui/removeAnsiCodes.js';
|
|
8
|
-
import { isDeployWebsocketMessage, isViewedWelcomeScreenWebsocketMessage, isUploadWebsocketMessage, } from './localDevWebsocketServerUtils.js';
|
|
8
|
+
import { isDeployWebsocketMessage, isViewedWelcomeScreenWebsocketMessage, isUploadWebsocketMessage, isAppInstallFailureWebsocketMessage, isAppInstallSuccessWebsocketMessage, isAppInstallInitiatedWebsocketMessage, } from './localDevWebsocketServerUtils.js';
|
|
9
9
|
import pkg from '../../../package.json' with { type: 'json' };
|
|
10
|
-
const
|
|
11
|
-
const LOCAL_DEV_WEBSOCKET_SERVER_VERSION = 1;
|
|
10
|
+
const LOCAL_DEV_WEBSOCKET_SERVER_VERSION = 2;
|
|
12
11
|
const LOG_PREFIX = '[LocalDevWebsocketServer]';
|
|
12
|
+
const DOMAINS = ['hubspot.com', 'hubspotqa.com'];
|
|
13
|
+
const SUBDOMAINS = ['local', 'app', 'app-na2', 'app-na3', 'app-ap1', 'app-eu1'];
|
|
14
|
+
const ALLOWED_ORIGIN_REGEX = new RegExp(`^https://(${SUBDOMAINS.join('|')})\\.(${DOMAINS.join('|')})$`);
|
|
13
15
|
class LocalDevWebsocketServer {
|
|
14
16
|
server;
|
|
15
17
|
debug;
|
|
16
18
|
localDevProcess;
|
|
17
|
-
ALLOWED_ORIGINS = [
|
|
18
|
-
'https://app.hubspot.com',
|
|
19
|
-
'https://app.hubspotqa.com',
|
|
20
|
-
'https://local.hubspot.com',
|
|
21
|
-
'https://local.hubspotqa.com',
|
|
22
|
-
];
|
|
23
19
|
constructor(localDevProcess, debug) {
|
|
24
20
|
this.localDevProcess = localDevProcess;
|
|
25
21
|
this.debug = debug;
|
|
26
22
|
}
|
|
27
23
|
log(message) {
|
|
28
24
|
if (this.debug) {
|
|
29
|
-
|
|
25
|
+
uiLogger.log(`${LOG_PREFIX} ${message}`);
|
|
30
26
|
}
|
|
31
27
|
}
|
|
32
28
|
logError(message) {
|
|
33
29
|
if (this.debug) {
|
|
34
|
-
|
|
30
|
+
uiLogger.error(`${LOG_PREFIX} ${message}`);
|
|
35
31
|
}
|
|
36
32
|
}
|
|
37
33
|
sendMessage(websocket, message) {
|
|
@@ -65,6 +61,15 @@ class LocalDevWebsocketServer {
|
|
|
65
61
|
},
|
|
66
62
|
});
|
|
67
63
|
}
|
|
64
|
+
async handleAppInstallSuccess() {
|
|
65
|
+
this.localDevProcess.sendDevServerMessage(LOCAL_DEV_SERVER_MESSAGE_TYPES.STATIC_AUTH_APP_INSTALL_SUCCESS);
|
|
66
|
+
}
|
|
67
|
+
async handleAppInstallFailure() {
|
|
68
|
+
this.localDevProcess.sendDevServerMessage(LOCAL_DEV_SERVER_MESSAGE_TYPES.STATIC_AUTH_APP_INSTALL_FAILURE);
|
|
69
|
+
}
|
|
70
|
+
async handleAppInstallInitiated() {
|
|
71
|
+
this.localDevProcess.sendDevServerMessage(LOCAL_DEV_SERVER_MESSAGE_TYPES.OAUTH_APP_INSTALL_INITIATED);
|
|
72
|
+
}
|
|
68
73
|
setupMessageHandlers(websocket) {
|
|
69
74
|
websocket.on('message', data => {
|
|
70
75
|
try {
|
|
@@ -82,6 +87,15 @@ class LocalDevWebsocketServer {
|
|
|
82
87
|
else if (isViewedWelcomeScreenWebsocketMessage(message)) {
|
|
83
88
|
addLocalStateFlag(CONFIG_LOCAL_STATE_FLAGS.LOCAL_DEV_UI_WELCOME);
|
|
84
89
|
}
|
|
90
|
+
else if (isAppInstallSuccessWebsocketMessage(message)) {
|
|
91
|
+
this.handleAppInstallSuccess();
|
|
92
|
+
}
|
|
93
|
+
else if (isAppInstallFailureWebsocketMessage(message)) {
|
|
94
|
+
this.handleAppInstallFailure();
|
|
95
|
+
}
|
|
96
|
+
else if (isAppInstallInitiatedWebsocketMessage(message)) {
|
|
97
|
+
this.handleAppInstallInitiated();
|
|
98
|
+
}
|
|
85
99
|
else {
|
|
86
100
|
this.logError(lib.LocalDevWebsocketServer.errors.unknownMessageType(message.type));
|
|
87
101
|
}
|
|
@@ -150,23 +164,39 @@ class LocalDevWebsocketServer {
|
|
|
150
164
|
this.localDevProcess.removeStateListener('uploadWarnings', listener);
|
|
151
165
|
});
|
|
152
166
|
}
|
|
167
|
+
setupDevServersStartedListener(websocket) {
|
|
168
|
+
const listener = (devServersStarted) => {
|
|
169
|
+
if (devServersStarted) {
|
|
170
|
+
this.sendMessage(websocket, {
|
|
171
|
+
type: LOCAL_DEV_UI_MESSAGE_SEND_TYPES.DEV_SERVERS_STARTED,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
this.localDevProcess.addStateListener('devServersStarted', listener);
|
|
176
|
+
websocket.on('close', () => {
|
|
177
|
+
this.localDevProcess.removeStateListener('devServersStarted', listener);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
153
180
|
setupStateListeners(websocket) {
|
|
154
181
|
this.setupProjectNodesListener(websocket);
|
|
155
182
|
this.setupAppDataListener(websocket);
|
|
156
183
|
this.setupUploadWarningsListener(websocket);
|
|
184
|
+
this.setupDevServersStartedListener(websocket);
|
|
157
185
|
}
|
|
158
186
|
async start() {
|
|
159
187
|
const portManagerIsRunning = await isPortManagerServerRunning();
|
|
160
188
|
if (!portManagerIsRunning) {
|
|
161
189
|
throw new Error(lib.LocalDevWebsocketServer.errors.portManagerNotRunning(LOG_PREFIX));
|
|
162
190
|
}
|
|
163
|
-
const portData = await requestPorts([
|
|
164
|
-
|
|
191
|
+
const portData = await requestPorts([
|
|
192
|
+
{ instanceId: LOCAL_DEV_WEBSOCKET_SERVER_INSTANCE_ID },
|
|
193
|
+
]);
|
|
194
|
+
const port = portData[LOCAL_DEV_WEBSOCKET_SERVER_INSTANCE_ID];
|
|
165
195
|
this.server = new WebSocketServer({ port });
|
|
166
196
|
this.log(lib.LocalDevWebsocketServer.logs.startup(port));
|
|
167
197
|
this.server.on('connection', (ws, req) => {
|
|
168
198
|
const origin = req.headers.origin;
|
|
169
|
-
if (!origin || !
|
|
199
|
+
if (!origin || !ALLOWED_ORIGIN_REGEX.test(origin)) {
|
|
170
200
|
ws.close(1008, lib.LocalDevWebsocketServer.errors.originNotAllowed(origin));
|
|
171
201
|
return;
|
|
172
202
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import LocalDevState from './LocalDevState.js';
|
|
2
|
+
type UIExtensionsDevModeInterfaceConstructorOptions = {
|
|
3
|
+
localDevState: LocalDevState;
|
|
4
|
+
};
|
|
5
|
+
declare class UIExtensionsDevModeInterface {
|
|
6
|
+
localDevState: LocalDevState;
|
|
7
|
+
constructor(options: UIExtensionsDevModeInterfaceConstructorOptions);
|
|
8
|
+
setup(): Promise<void>;
|
|
9
|
+
start(): Promise<void>;
|
|
10
|
+
fileChange(filePath: string, event: string): Promise<void>;
|
|
11
|
+
cleanup(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export default UIExtensionsDevModeInterface;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { requestPorts } from '@hubspot/local-dev-lib/portManager';
|
|
2
|
+
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
3
|
+
import { DevModeUnifiedInterface as UIEDevModeInterface } from '@hubspot/ui-extensions-dev-server';
|
|
4
|
+
import { getHubSpotApiOrigin, getHubSpotWebsiteOrigin, } from '@hubspot/local-dev-lib/urls';
|
|
5
|
+
class UIExtensionsDevModeInterface {
|
|
6
|
+
localDevState;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.localDevState = options.localDevState;
|
|
9
|
+
}
|
|
10
|
+
async setup() {
|
|
11
|
+
return UIEDevModeInterface.setup({
|
|
12
|
+
// @ts-expect-error TODO: reconcile types between CLI and UIE Dev Server
|
|
13
|
+
components: this.localDevState.projectNodes,
|
|
14
|
+
profileData: this.localDevState.projectProfileData,
|
|
15
|
+
logger,
|
|
16
|
+
urls: {
|
|
17
|
+
api: getHubSpotApiOrigin(this.localDevState.env),
|
|
18
|
+
web: getHubSpotWebsiteOrigin(this.localDevState.env),
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async start() {
|
|
23
|
+
return UIEDevModeInterface.start({
|
|
24
|
+
accountId: this.localDevState.targetTestingAccountId,
|
|
25
|
+
// @ts-expect-error TODO: reconcile types between CLI and UIE Dev Server
|
|
26
|
+
projectConfig: this.localDevState.projectConfig,
|
|
27
|
+
requestPorts,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async fileChange(filePath, event) {
|
|
31
|
+
return UIEDevModeInterface.fileChange(filePath, event);
|
|
32
|
+
}
|
|
33
|
+
async cleanup() {
|
|
34
|
+
return UIEDevModeInterface.cleanup();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export default UIExtensionsDevModeInterface;
|
|
@@ -8,7 +8,7 @@ export declare function checkIfParentAccountIsAuthed(accountConfig: CLIAccount):
|
|
|
8
8
|
export declare function checkIfAccountFlagIsSupported(accountConfig: CLIAccount, hasPublicApps: boolean): void;
|
|
9
9
|
export declare function suggestRecommendedNestedAccount(accounts: CLIAccount[], accountConfig: CLIAccount, hasPublicApps: boolean): Promise<ProjectDevTargetAccountPromptResponse>;
|
|
10
10
|
export declare function createSandboxForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
|
|
11
|
-
export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment,
|
|
11
|
+
export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment, useV2?: boolean): Promise<number>;
|
|
12
12
|
export declare function useExistingDevTestAccount(env: Environment, account: DeveloperTestAccount): Promise<void>;
|
|
13
13
|
export declare function hasSandboxes(account: CLIAccount): Promise<boolean>;
|
|
14
14
|
export declare function selectAccountTypePrompt(accountConfig: CLIAccount): Promise<string | null>;
|
|
@@ -138,7 +138,7 @@ export async function createSandboxForLocalDev(accountId, accountConfig, env) {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
// Create a developer test account and return its accountId
|
|
141
|
-
export async function createDeveloperTestAccountForLocalDev(accountId, accountConfig, env,
|
|
141
|
+
export async function createDeveloperTestAccountForLocalDev(accountId, accountConfig, env, useV2 = false) {
|
|
142
142
|
let currentPortalCount = 0;
|
|
143
143
|
let maxTestPortals = 10;
|
|
144
144
|
try {
|
|
@@ -168,7 +168,7 @@ export async function createDeveloperTestAccountForLocalDev(accountId, accountCo
|
|
|
168
168
|
accountType: HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST,
|
|
169
169
|
});
|
|
170
170
|
trackCommandMetadataUsage('developer-test-account-create', { step: 'project-dev' }, accountId);
|
|
171
|
-
const result = await buildDeveloperTestAccount(name, accountConfig, env, maxTestPortals,
|
|
171
|
+
const result = await buildDeveloperTestAccount(name, accountConfig, env, maxTestPortals, useV2);
|
|
172
172
|
return result;
|
|
173
173
|
}
|
|
174
174
|
catch (err) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function confirmLocalDevIsNotRunning(): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LOCAL_DEV_WEBSOCKET_SERVER_INSTANCE_ID } from '../../../constants.js';
|
|
2
|
+
import { EXIT_CODES } from '../../../enums/exitCodes.js';
|
|
3
|
+
import { getServerPortByInstanceId } from '@hubspot/local-dev-lib/portManager';
|
|
4
|
+
import { uiLogger } from '../../../ui/logger.js';
|
|
5
|
+
import { commands } from '../../../../lang/en.js';
|
|
6
|
+
export async function confirmLocalDevIsNotRunning() {
|
|
7
|
+
try {
|
|
8
|
+
await getServerPortByInstanceId(LOCAL_DEV_WEBSOCKET_SERVER_INSTANCE_ID);
|
|
9
|
+
uiLogger.error(commands.project.dev.errors.localDevAlreadyRunning);
|
|
10
|
+
process.exit(EXIT_CODES.ERROR);
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -10,3 +10,4 @@ export declare function compareLocalProjectToDeployed(projectConfig: ProjectConf
|
|
|
10
10
|
export declare function isDeployedProjectUpToDateWithLocal(projectConfig: ProjectConfig, accountId: number, deployedBuildId: number, localProjectNodes: {
|
|
11
11
|
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
12
12
|
}, profile?: string): Promise<boolean>;
|
|
13
|
+
export declare function checkAndInstallDependencies(): Promise<void>;
|
|
@@ -20,6 +20,7 @@ import { handleProjectUpload } from '../../upload.js';
|
|
|
20
20
|
import { pollProjectBuildAndDeploy } from '../../pollProjectBuildAndDeploy.js';
|
|
21
21
|
import { debugError, logError } from '../../../errorHandlers/index.js';
|
|
22
22
|
import { ApiErrorContext } from '../../../errorHandlers/index.js';
|
|
23
|
+
import { getProjectPackageJsonLocations, hasMissingPackages, installPackages, } from '../../../dependencyManagement.js';
|
|
23
24
|
// Prompt the user to create a new project if one doesn't exist on their target account
|
|
24
25
|
export async function createNewProjectForLocalDev(projectConfig, targetAccountId, shouldCreateWithoutConfirmation, hasPublicApps) {
|
|
25
26
|
// Create the project without prompting if this is a newly created sandbox
|
|
@@ -153,9 +154,8 @@ export async function isDeployedProjectUpToDateWithLocal(projectConfig, accountI
|
|
|
153
154
|
try {
|
|
154
155
|
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'hubspot-project-compare-'));
|
|
155
156
|
const { data: zippedProject } = await downloadProject(accountId, projectConfig.name, deployedBuildId);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const deployedProjectSourceDir = path.join(extractedProjectPath, projectConfig.srcDir);
|
|
157
|
+
await extractZipArchive(zippedProject, sanitizeFileName(projectConfig.name), tempDir, { hideLogs: true });
|
|
158
|
+
const deployedProjectSourceDir = path.join(tempDir, projectConfig.srcDir);
|
|
159
159
|
const { intermediateNodesIndexedByUid: deployedProjectNodes } = await translate({
|
|
160
160
|
projectSourceDir: deployedProjectSourceDir,
|
|
161
161
|
platformVersion: projectConfig.platformVersion,
|
|
@@ -174,3 +174,39 @@ export async function isDeployedProjectUpToDateWithLocal(projectConfig, accountI
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
+
export async function checkAndInstallDependencies() {
|
|
178
|
+
SpinniesManager.init();
|
|
179
|
+
uiLogger.log('');
|
|
180
|
+
SpinniesManager.add('checkingDependencies', {
|
|
181
|
+
text: lib.localDevHelpers.project.checkAndInstallDependencies
|
|
182
|
+
.checkingDependencies,
|
|
183
|
+
});
|
|
184
|
+
try {
|
|
185
|
+
const installLocations = await getProjectPackageJsonLocations();
|
|
186
|
+
const locationsToInstall = [];
|
|
187
|
+
for (const location of installLocations) {
|
|
188
|
+
if (await hasMissingPackages(location)) {
|
|
189
|
+
locationsToInstall.push(location);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (locationsToInstall.length > 0) {
|
|
193
|
+
SpinniesManager.remove('checkingDependencies');
|
|
194
|
+
await installPackages({ installLocations: locationsToInstall });
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
SpinniesManager.succeed('checkingDependencies', {
|
|
198
|
+
text: lib.localDevHelpers.project.checkAndInstallDependencies
|
|
199
|
+
.dependenciesUpToDate,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
uiLogger.log('');
|
|
203
|
+
}
|
|
204
|
+
catch (e) {
|
|
205
|
+
logError(e);
|
|
206
|
+
SpinniesManager.fail('checkingDependencies', {
|
|
207
|
+
text: lib.localDevHelpers.project.checkAndInstallDependencies
|
|
208
|
+
.dependenciesFailure,
|
|
209
|
+
});
|
|
210
|
+
process.exit(EXIT_CODES.ERROR);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -2,3 +2,6 @@ import { LocalDevDeployWebsocketMessage, LocalDevWebsocketMessage } from '../../
|
|
|
2
2
|
export declare function isUploadWebsocketMessage(message: LocalDevWebsocketMessage): boolean;
|
|
3
3
|
export declare function isDeployWebsocketMessage(message: LocalDevWebsocketMessage): message is LocalDevDeployWebsocketMessage;
|
|
4
4
|
export declare function isViewedWelcomeScreenWebsocketMessage(message: LocalDevWebsocketMessage): boolean;
|
|
5
|
+
export declare function isAppInstallSuccessWebsocketMessage(message: LocalDevWebsocketMessage): boolean;
|
|
6
|
+
export declare function isAppInstallInitiatedWebsocketMessage(message: LocalDevWebsocketMessage): boolean;
|
|
7
|
+
export declare function isAppInstallFailureWebsocketMessage(message: LocalDevWebsocketMessage): boolean;
|