@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
|
@@ -2,7 +2,7 @@ import open from 'open';
|
|
|
2
2
|
import { OAUTH_SCOPES, DEFAULT_OAUTH_SCOPES, } from '@hubspot/local-dev-lib/constants/auth';
|
|
3
3
|
import { deleteEmptyConfigFile } from '@hubspot/local-dev-lib/config';
|
|
4
4
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from '../ui/logger.js';
|
|
6
6
|
import { promptUser } from './promptUtils.js';
|
|
7
7
|
import { getCliAccountNamePromptConfig, } from './accountNamePrompt.js';
|
|
8
8
|
import { uiInfoSection } from '../ui/index.js';
|
|
@@ -17,7 +17,7 @@ export async function personalAccessKeyPrompt({ env, account, }) {
|
|
|
17
17
|
let url = `${websiteOrigin}/l/personal-access-key`;
|
|
18
18
|
if (process.env.BROWSER !== 'none') {
|
|
19
19
|
uiInfoSection(lib.prompts.personalAccessKeyPrompt.personalAccessKeySetupTitle, () => {
|
|
20
|
-
|
|
20
|
+
uiLogger.log(lib.prompts.personalAccessKeyPrompt.personalAccessKeyBrowserOpenPrep);
|
|
21
21
|
});
|
|
22
22
|
if (account) {
|
|
23
23
|
url = `${websiteOrigin}/personal-access-key/${account}`;
|
|
@@ -33,7 +33,7 @@ export async function personalAccessKeyPrompt({ env, account, }) {
|
|
|
33
33
|
lib.prompts.personalAccessKeyPrompt.personalAccessKeyPromptChoices
|
|
34
34
|
.OPEN_BROWSER) {
|
|
35
35
|
open(url, { url: true });
|
|
36
|
-
|
|
36
|
+
uiLogger.log(lib.prompts.personalAccessKeyPrompt.logs.openingWebBrowser(url));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
const { personalAccessKey } = await promptUser(PERSONAL_ACCESS_KEY);
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { getCwd } from '@hubspot/local-dev-lib/path';
|
|
3
3
|
import { promptUser } from './promptUtils.js';
|
|
4
|
-
import {
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
5
5
|
export async function previewPrompt(promptOptions = {}) {
|
|
6
6
|
return promptUser([
|
|
7
7
|
{
|
|
8
8
|
name: 'src',
|
|
9
|
-
message:
|
|
9
|
+
message: lib.prompts.previewPrompt.enterSrc,
|
|
10
10
|
when: !promptOptions.src,
|
|
11
11
|
default: '.',
|
|
12
12
|
validate: (input) => {
|
|
13
13
|
if (!input) {
|
|
14
|
-
return
|
|
14
|
+
return lib.prompts.previewPrompt.errors.srcRequired;
|
|
15
15
|
}
|
|
16
16
|
return true;
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
name: 'dest',
|
|
21
|
-
message:
|
|
21
|
+
message: lib.prompts.previewPrompt.enterDest,
|
|
22
22
|
when: !promptOptions.dest,
|
|
23
23
|
default: path.basename(getCwd()),
|
|
24
24
|
validate: (input) => {
|
|
25
25
|
if (!input) {
|
|
26
|
-
return
|
|
26
|
+
return lib.prompts.previewPrompt.errors.destRequired;
|
|
27
27
|
}
|
|
28
28
|
return true;
|
|
29
29
|
},
|
|
@@ -34,7 +34,7 @@ export async function previewProjectPrompt(themeComponents) {
|
|
|
34
34
|
return promptUser([
|
|
35
35
|
{
|
|
36
36
|
name: 'themeComponentPath',
|
|
37
|
-
message:
|
|
37
|
+
message: lib.prompts.previewPrompt.themeProjectSelect,
|
|
38
38
|
type: 'list',
|
|
39
39
|
choices: themeComponents.map(t => {
|
|
40
40
|
const themeName = path.basename(t.path);
|
|
@@ -4,12 +4,12 @@ type ProjectAddPromptResponse = {
|
|
|
4
4
|
componentTemplate: ComponentTemplate;
|
|
5
5
|
name: string;
|
|
6
6
|
};
|
|
7
|
-
type
|
|
7
|
+
type ProjectAddPromptResponseV2 = {
|
|
8
8
|
componentTemplate: ComponentTemplate[];
|
|
9
9
|
};
|
|
10
10
|
export declare function projectAddPrompt(components: ComponentTemplate[], promptOptions?: {
|
|
11
11
|
name?: string;
|
|
12
12
|
type?: string;
|
|
13
13
|
}): Promise<ProjectAddPromptResponse>;
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function projectAddPromptV2(components: (ComponentTemplateChoice | Separator)[], selectedFeatures: string[] | undefined): Promise<ProjectAddPromptResponseV2>;
|
|
15
15
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Separator } from '@inquirer/prompts';
|
|
2
2
|
import { promptUser } from './promptUtils.js';
|
|
3
3
|
import { lib } from '../../lang/en.js';
|
|
4
|
+
import { uiLogger } from '../ui/logger.js';
|
|
4
5
|
function findComponentByPathOrLabel(components, componentPathOrLabel) {
|
|
5
6
|
return components.find(c => c.path === componentPathOrLabel || c.label === componentPathOrLabel);
|
|
6
7
|
}
|
|
@@ -44,7 +45,7 @@ export async function projectAddPrompt(components, promptOptions = {}) {
|
|
|
44
45
|
}
|
|
45
46
|
return result;
|
|
46
47
|
}
|
|
47
|
-
export async function
|
|
48
|
+
export async function projectAddPromptV2(components, selectedFeatures) {
|
|
48
49
|
const selectedComponents = [];
|
|
49
50
|
if (selectedFeatures) {
|
|
50
51
|
components.forEach(template => {
|
|
@@ -59,6 +60,11 @@ export async function projectAddPromptV3(components, selectedFeatures) {
|
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
62
|
}
|
|
63
|
+
if (!components?.length) {
|
|
64
|
+
uiLogger.error(lib.prompts.projectAddPrompt.errors.noSelectableChoices);
|
|
65
|
+
uiLogger.log('');
|
|
66
|
+
return { componentTemplate: [] };
|
|
67
|
+
}
|
|
62
68
|
const result = await promptUser([
|
|
63
69
|
{
|
|
64
70
|
name: 'componentTemplate',
|
|
@@ -2,11 +2,11 @@ import { getAccountId } from '@hubspot/local-dev-lib/config';
|
|
|
2
2
|
import { getSandboxUsageLimits } from '@hubspot/local-dev-lib/api/sandboxHubs';
|
|
3
3
|
import { HUBSPOT_ACCOUNT_TYPES, HUBSPOT_ACCOUNT_TYPE_STRINGS, } from '@hubspot/local-dev-lib/constants/config';
|
|
4
4
|
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
5
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
6
5
|
import { fetchDeveloperTestAccounts } from '@hubspot/local-dev-lib/api/developerTestAccounts';
|
|
7
6
|
import { promptUser } from './promptUtils.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { lib } from '../../lang/en.js';
|
|
8
|
+
import { uiLogger } from '../ui/logger.js';
|
|
9
|
+
import { uiAccountDescription } from '../ui/index.js';
|
|
10
10
|
import { isSandbox } from '../accountTypes.js';
|
|
11
11
|
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
12
12
|
function mapNestedAccount(accountConfig) {
|
|
@@ -36,12 +36,12 @@ export async function selectSandboxTargetAccountPrompt(accounts, defaultAccountC
|
|
|
36
36
|
sandboxUsage = data.usage;
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
|
-
|
|
39
|
+
uiLogger.error(lib.prompts.projectDevTargetAccountPrompt.noAccountId);
|
|
40
40
|
process.exit(EXIT_CODES.ERROR);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
catch (err) {
|
|
44
|
-
|
|
44
|
+
uiLogger.debug('Unable to fetch sandbox usage limits: ', err);
|
|
45
45
|
}
|
|
46
46
|
const sandboxAccounts = accounts
|
|
47
47
|
.reverse()
|
|
@@ -49,15 +49,11 @@ export async function selectSandboxTargetAccountPrompt(accounts, defaultAccountC
|
|
|
49
49
|
let disabledMessage = false;
|
|
50
50
|
if (sandboxUsage['DEVELOPER'] && sandboxUsage['DEVELOPER'].available === 0) {
|
|
51
51
|
if (sandboxAccounts.length < sandboxUsage['DEVELOPER'].limit) {
|
|
52
|
-
disabledMessage =
|
|
53
|
-
|
|
54
|
-
limit: sandboxUsage['DEVELOPER'].limit,
|
|
55
|
-
});
|
|
52
|
+
disabledMessage =
|
|
53
|
+
lib.prompts.projectDevTargetAccountPrompt.sandboxLimitWithSuggestion(sandboxUsage['DEVELOPER'].limit);
|
|
56
54
|
}
|
|
57
55
|
else {
|
|
58
|
-
disabledMessage =
|
|
59
|
-
limit: sandboxUsage['DEVELOPER'].limit,
|
|
60
|
-
});
|
|
56
|
+
disabledMessage = lib.prompts.projectDevTargetAccountPrompt.sandboxLimit(sandboxUsage['DEVELOPER'].limit);
|
|
61
57
|
}
|
|
62
58
|
}
|
|
63
59
|
// Order choices by Developer Sandbox -> Standard Sandbox
|
|
@@ -69,7 +65,7 @@ export async function selectSandboxTargetAccountPrompt(accounts, defaultAccountC
|
|
|
69
65
|
.filter(a => a.accountType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX)
|
|
70
66
|
.map(mapNestedAccount),
|
|
71
67
|
{
|
|
72
|
-
name:
|
|
68
|
+
name: lib.prompts.projectDevTargetAccountPrompt.createNewSandboxOption,
|
|
73
69
|
value: {
|
|
74
70
|
targetAccountId: null,
|
|
75
71
|
createNestedAccount: true,
|
|
@@ -77,7 +73,8 @@ export async function selectSandboxTargetAccountPrompt(accounts, defaultAccountC
|
|
|
77
73
|
disabled: disabledMessage,
|
|
78
74
|
},
|
|
79
75
|
{
|
|
80
|
-
name:
|
|
76
|
+
name: lib.prompts.projectDevTargetAccountPrompt
|
|
77
|
+
.chooseDefaultAccountOption,
|
|
81
78
|
value: {
|
|
82
79
|
targetAccountId: defaultAccountId,
|
|
83
80
|
createNestedAccount: false,
|
|
@@ -95,21 +92,19 @@ export async function selectDeveloperTestTargetAccountPrompt(accounts, defaultAc
|
|
|
95
92
|
devTestAccountsResponse = data;
|
|
96
93
|
}
|
|
97
94
|
else {
|
|
98
|
-
|
|
95
|
+
uiLogger.error(lib.prompts.projectDevTargetAccountPrompt.noAccountId);
|
|
99
96
|
process.exit(EXIT_CODES.ERROR);
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
99
|
catch (err) {
|
|
103
|
-
|
|
100
|
+
uiLogger.debug('Unable to fetch developer test account usage limits: ', err);
|
|
104
101
|
}
|
|
105
102
|
let disabledMessage = false;
|
|
106
103
|
if (devTestAccountsResponse &&
|
|
107
104
|
devTestAccountsResponse.results.length >=
|
|
108
105
|
devTestAccountsResponse.maxTestPortals) {
|
|
109
|
-
disabledMessage =
|
|
110
|
-
|
|
111
|
-
limit: devTestAccountsResponse.maxTestPortals,
|
|
112
|
-
});
|
|
106
|
+
disabledMessage =
|
|
107
|
+
lib.prompts.projectDevTargetAccountPrompt.developerTestAccountLimit(devTestAccountsResponse.maxTestPortals);
|
|
113
108
|
}
|
|
114
109
|
const devTestAccounts = [];
|
|
115
110
|
if (devTestAccountsResponse && devTestAccountsResponse.results) {
|
|
@@ -130,7 +125,8 @@ export async function selectDeveloperTestTargetAccountPrompt(accounts, defaultAc
|
|
|
130
125
|
const choices = [
|
|
131
126
|
...devTestAccounts,
|
|
132
127
|
{
|
|
133
|
-
name:
|
|
128
|
+
name: lib.prompts.projectDevTargetAccountPrompt
|
|
129
|
+
.createNewDeveloperTestAccountOption,
|
|
134
130
|
value: {
|
|
135
131
|
targetAccountId: null,
|
|
136
132
|
createNestedAccount: true,
|
|
@@ -146,10 +142,7 @@ async function selectTargetAccountPrompt(defaultAccountId, accountType, choices)
|
|
|
146
142
|
{
|
|
147
143
|
name: 'targetAccountInfo',
|
|
148
144
|
type: 'list',
|
|
149
|
-
message:
|
|
150
|
-
accountIdentifier: uiAccountDescription(accountId),
|
|
151
|
-
accountType,
|
|
152
|
-
}),
|
|
145
|
+
message: lib.prompts.projectDevTargetAccountPrompt.promptMessage(accountType, uiAccountDescription(accountId)),
|
|
153
146
|
choices,
|
|
154
147
|
loop: false,
|
|
155
148
|
},
|
|
@@ -161,10 +154,7 @@ export async function confirmDefaultAccountPrompt(accountName, accountType) {
|
|
|
161
154
|
{
|
|
162
155
|
name: 'useDefaultAccount',
|
|
163
156
|
type: 'confirm',
|
|
164
|
-
message:
|
|
165
|
-
accountName,
|
|
166
|
-
accountType,
|
|
167
|
-
}),
|
|
157
|
+
message: lib.prompts.projectDevTargetAccountPrompt.confirmDefaultAccount(accountName, accountType),
|
|
168
158
|
},
|
|
169
159
|
]);
|
|
170
160
|
return useDefaultAccount;
|
|
@@ -174,9 +164,7 @@ export async function confirmUseExistingDeveloperTestAccountPrompt(account) {
|
|
|
174
164
|
{
|
|
175
165
|
name: 'confirmUseExistingDeveloperTestAccount',
|
|
176
166
|
type: 'confirm',
|
|
177
|
-
message:
|
|
178
|
-
accountName: getNonConfigDeveloperTestAccountName(account),
|
|
179
|
-
}),
|
|
167
|
+
message: lib.prompts.projectDevTargetAccountPrompt.confirmUseExistingDeveloperTestAccount(getNonConfigDeveloperTestAccountName(account)),
|
|
180
168
|
},
|
|
181
169
|
]);
|
|
182
170
|
return confirmUseExistingDeveloperTestAccount;
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import { promptUser } from './promptUtils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { lib } from '../../lang/en.js';
|
|
3
3
|
import { ensureProjectExists } from '../projects/ensureProjectExists.js';
|
|
4
|
-
import { uiAccountDescription } from '../ui/index.js';
|
|
5
4
|
export async function projectNamePrompt(accountId, options = {}) {
|
|
6
5
|
const result = await promptUser({
|
|
7
6
|
name: 'projectName',
|
|
8
|
-
message:
|
|
7
|
+
message: lib.prompts.projectNamePrompt.enterName,
|
|
9
8
|
when: !options.project,
|
|
10
9
|
validate: async (val) => {
|
|
11
10
|
if (typeof val !== 'string' || !val) {
|
|
12
|
-
return
|
|
11
|
+
return lib.prompts.projectNamePrompt.errors.invalidName;
|
|
13
12
|
}
|
|
14
13
|
const { projectExists } = await ensureProjectExists(accountId, val, {
|
|
15
14
|
allowCreate: false,
|
|
16
15
|
noLogs: true,
|
|
17
16
|
});
|
|
18
17
|
if (!projectExists) {
|
|
19
|
-
return
|
|
20
|
-
projectName: val,
|
|
21
|
-
accountIdentifier: uiAccountDescription(accountId),
|
|
22
|
-
});
|
|
18
|
+
return lib.prompts.projectNamePrompt.errors.projectDoesNotExist(val, accountId);
|
|
23
19
|
}
|
|
24
20
|
return true;
|
|
25
21
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lib } from '../../lang/en.js';
|
|
2
2
|
import { promptUser } from './promptUtils.js';
|
|
3
3
|
export async function projectLogsPrompt({ functionChoices, promptOptions, projectName = '', }) {
|
|
4
4
|
if (!functionChoices) {
|
|
@@ -11,9 +11,7 @@ export async function projectLogsPrompt({ functionChoices, promptOptions, projec
|
|
|
11
11
|
{
|
|
12
12
|
name: 'functionName',
|
|
13
13
|
type: 'list',
|
|
14
|
-
message:
|
|
15
|
-
projectName,
|
|
16
|
-
}),
|
|
14
|
+
message: lib.prompts.projectLogsPrompt.functionName(projectName),
|
|
17
15
|
when: () => (!promptOptions || !promptOptions.function) &&
|
|
18
16
|
functionChoices.length > 0,
|
|
19
17
|
choices: functionChoices,
|
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
import { confirm, Separator as _Separator, select, input, checkbox, password, number, } from '@inquirer/prompts';
|
|
2
2
|
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
5
|
+
import { uiLogger } from '../ui/logger.js';
|
|
4
6
|
export const Separator = new _Separator();
|
|
5
7
|
export const PROMPT_THEME = { prefix: { idle: chalk.green('?') } };
|
|
6
8
|
function isUserCancellationError(error) {
|
|
7
9
|
return error instanceof Error && error.name === 'ExitPromptError';
|
|
8
10
|
}
|
|
11
|
+
function isNoSelectableChoicesError(error) {
|
|
12
|
+
return (error instanceof Error && error.message?.includes('No selectable choices'));
|
|
13
|
+
}
|
|
14
|
+
function handlePromptError(config, error) {
|
|
15
|
+
if (isUserCancellationError(error)) {
|
|
16
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
17
|
+
}
|
|
18
|
+
if (isNoSelectableChoicesError(error)) {
|
|
19
|
+
if (!Array.isArray(config)) {
|
|
20
|
+
uiLogger.log(config.message);
|
|
21
|
+
}
|
|
22
|
+
uiLogger.error(lib.prompts.promptUtils.errors.noSelectableChoices);
|
|
23
|
+
process.exit(EXIT_CODES.ERROR);
|
|
24
|
+
}
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
9
27
|
function mapPromptChoicesToChoices(choices) {
|
|
10
28
|
return (choices?.map(choice => {
|
|
11
29
|
if (typeof choice === 'string') {
|
|
@@ -86,10 +104,7 @@ export async function promptUser(config) {
|
|
|
86
104
|
}
|
|
87
105
|
}
|
|
88
106
|
catch (error) {
|
|
89
|
-
|
|
90
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
91
|
-
}
|
|
92
|
-
throw error;
|
|
107
|
+
handlePromptError(config, error);
|
|
93
108
|
}
|
|
94
109
|
}
|
|
95
110
|
function handleRawListPrompt(config) {
|
|
@@ -139,8 +154,10 @@ function handleCheckboxPrompt(config) {
|
|
|
139
154
|
}).then(resp => ({ [config.name]: resp }));
|
|
140
155
|
}
|
|
141
156
|
function handleConfirmPrompt(config) {
|
|
142
|
-
return
|
|
143
|
-
|
|
157
|
+
return confirm({
|
|
158
|
+
message: config.message,
|
|
159
|
+
default: config.default,
|
|
160
|
+
theme: PROMPT_THEME,
|
|
144
161
|
}).then(resp => ({ [config.name]: resp }));
|
|
145
162
|
}
|
|
146
163
|
function handleInputPrompt(config) {
|
|
@@ -165,12 +182,13 @@ function handleSelectPrompt(config) {
|
|
|
165
182
|
}
|
|
166
183
|
export async function confirmPrompt(message, options = {}) {
|
|
167
184
|
const { defaultAnswer = true } = options;
|
|
168
|
-
const
|
|
185
|
+
const { confirm: result } = await promptUser({
|
|
186
|
+
name: 'confirm',
|
|
187
|
+
type: 'confirm',
|
|
169
188
|
message,
|
|
170
189
|
default: defaultAnswer,
|
|
171
|
-
theme: PROMPT_THEME,
|
|
172
190
|
});
|
|
173
|
-
return
|
|
191
|
+
return result;
|
|
174
192
|
}
|
|
175
193
|
export async function listPrompt(message, { choices, when, defaultAnswer, validate, loop, }) {
|
|
176
194
|
const { choice } = await promptUser({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promptUser } from './promptUtils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { lib } from '../../lang/en.js';
|
|
3
3
|
import { uiAccountDescription } from '../ui/index.js';
|
|
4
4
|
import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
|
|
5
5
|
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
@@ -25,15 +25,15 @@ export async function sandboxTypePrompt() {
|
|
|
25
25
|
return promptUser([
|
|
26
26
|
{
|
|
27
27
|
name: 'type',
|
|
28
|
-
message:
|
|
28
|
+
message: lib.prompts.sandboxesPrompt.type.message,
|
|
29
29
|
type: 'list',
|
|
30
30
|
choices: [
|
|
31
31
|
{
|
|
32
|
-
name:
|
|
32
|
+
name: lib.prompts.sandboxesPrompt.type.developer,
|
|
33
33
|
value: HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX,
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
name:
|
|
36
|
+
name: lib.prompts.sandboxesPrompt.type.standard,
|
|
37
37
|
value: HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX,
|
|
38
38
|
},
|
|
39
39
|
],
|
|
@@ -52,9 +52,9 @@ export function deleteSandboxPrompt(promptParentAccount = false) {
|
|
|
52
52
|
return promptUser([
|
|
53
53
|
{
|
|
54
54
|
name: 'account',
|
|
55
|
-
message:
|
|
56
|
-
?
|
|
57
|
-
:
|
|
55
|
+
message: promptParentAccount
|
|
56
|
+
? lib.prompts.sandboxesPrompt.selectParentAccountName
|
|
57
|
+
: lib.prompts.sandboxesPrompt.selectAccountName,
|
|
58
58
|
type: 'list',
|
|
59
59
|
pageSize: 20,
|
|
60
60
|
choices,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { promptUser } from './promptUtils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { lib } from '../../lang/en.js';
|
|
3
3
|
export function secretValuePrompt() {
|
|
4
4
|
return promptUser([
|
|
5
5
|
{
|
|
6
6
|
name: 'secretValue',
|
|
7
7
|
type: 'password',
|
|
8
8
|
mask: '*',
|
|
9
|
-
message:
|
|
9
|
+
message: lib.prompts.secretPrompt.enterValue,
|
|
10
10
|
},
|
|
11
11
|
]);
|
|
12
12
|
}
|
|
@@ -15,7 +15,7 @@ export function secretNamePrompt() {
|
|
|
15
15
|
{
|
|
16
16
|
name: 'secretName',
|
|
17
17
|
type: 'input',
|
|
18
|
-
message:
|
|
18
|
+
message: lib.prompts.secretPrompt.enterName,
|
|
19
19
|
},
|
|
20
20
|
]);
|
|
21
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../ui/logger.js';
|
|
2
2
|
import { fetchPublicAppsForPortal } from '@hubspot/local-dev-lib/api/appsDev';
|
|
3
3
|
import { debugError } from '../errorHandlers/index.js';
|
|
4
4
|
import { lib } from '../../lang/en.js';
|
|
@@ -15,7 +15,7 @@ export async function selectAppPrompt(accountId, appId) {
|
|
|
15
15
|
debugError(err);
|
|
16
16
|
}
|
|
17
17
|
if (availableApps.length === 0) {
|
|
18
|
-
|
|
18
|
+
uiLogger.error(lib.prompts.selectAppPrompt.errors.noApps);
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
21
|
if (appId) {
|
|
@@ -24,7 +24,7 @@ export async function selectAppPrompt(accountId, appId) {
|
|
|
24
24
|
return targetApp;
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
|
|
27
|
+
uiLogger.error(lib.prompts.selectAppPrompt.errors.invalidAppId);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
const appPromptValue = await listPrompt(lib.prompts.selectAppPrompt.selectAppId, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import { promptUser } from './promptUtils.js';
|
|
3
|
-
import {
|
|
3
|
+
import { lib } from '../../lang/en.js';
|
|
4
4
|
import { debugError } from '../errorHandlers/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from '../ui/logger.js';
|
|
6
6
|
import { fetchTables } from '@hubspot/local-dev-lib/api/hubdb';
|
|
7
7
|
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
8
8
|
import { isValidPath, untildify } from '@hubspot/local-dev-lib/path';
|
|
@@ -10,18 +10,14 @@ async function fetchHubDBOptions(accountId) {
|
|
|
10
10
|
try {
|
|
11
11
|
const { data: { results: tables }, } = await fetchTables(accountId);
|
|
12
12
|
if (tables.length === 0) {
|
|
13
|
-
|
|
14
|
-
accountId,
|
|
15
|
-
}));
|
|
13
|
+
uiLogger.log(lib.prompts.selectHubDBTablePrompt.errors.noTables(accountId.toString()));
|
|
16
14
|
process.exit(EXIT_CODES.SUCCESS);
|
|
17
15
|
}
|
|
18
16
|
return tables;
|
|
19
17
|
}
|
|
20
18
|
catch (error) {
|
|
21
19
|
debugError(error, { accountId });
|
|
22
|
-
|
|
23
|
-
accountId,
|
|
24
|
-
}));
|
|
20
|
+
uiLogger.error(lib.prompts.selectHubDBTablePrompt.errors.errorFetchingTables(accountId.toString()));
|
|
25
21
|
process.exit(EXIT_CODES.ERROR);
|
|
26
22
|
}
|
|
27
23
|
}
|
|
@@ -32,7 +28,7 @@ export async function selectHubDBTablePrompt({ accountId, options, skipDestPromp
|
|
|
32
28
|
return promptUser([
|
|
33
29
|
{
|
|
34
30
|
name: 'tableId',
|
|
35
|
-
message:
|
|
31
|
+
message: lib.prompts.selectHubDBTablePrompt.selectTable,
|
|
36
32
|
when: !id && !isValidTable,
|
|
37
33
|
type: 'list',
|
|
38
34
|
choices: hubdbTables.map(table => {
|
|
@@ -44,17 +40,17 @@ export async function selectHubDBTablePrompt({ accountId, options, skipDestPromp
|
|
|
44
40
|
},
|
|
45
41
|
{
|
|
46
42
|
name: 'dest',
|
|
47
|
-
message:
|
|
43
|
+
message: lib.prompts.selectHubDBTablePrompt.enterDest,
|
|
48
44
|
when: !options.dest && !skipDestPrompt,
|
|
49
45
|
validate: (input) => {
|
|
50
46
|
if (!input) {
|
|
51
|
-
return
|
|
47
|
+
return lib.prompts.selectHubDBTablePrompt.errors.destRequired;
|
|
52
48
|
}
|
|
53
49
|
if (fs.existsSync(input)) {
|
|
54
|
-
return
|
|
50
|
+
return lib.prompts.selectHubDBTablePrompt.errors.invalidDest;
|
|
55
51
|
}
|
|
56
52
|
if (!isValidPath(input)) {
|
|
57
|
-
return
|
|
53
|
+
return lib.prompts.selectHubDBTablePrompt.errors.invalidCharacters;
|
|
58
54
|
}
|
|
59
55
|
return true;
|
|
60
56
|
},
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { promptUser } from './promptUtils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { lib } from '../../lang/en.js';
|
|
3
3
|
import { uiLine } from '../ui/index.js';
|
|
4
4
|
import { logError } from '../errorHandlers/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from '../ui/logger.js';
|
|
6
6
|
import { fetchPublicAppsForPortal } from '@hubspot/local-dev-lib/api/appsDev';
|
|
7
7
|
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
8
8
|
async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = false) {
|
|
9
9
|
try {
|
|
10
10
|
if (!accountId) {
|
|
11
|
-
|
|
11
|
+
uiLogger.error(lib.prompts.selectPublicAppForMigrationPrompt.errors.noAccountId);
|
|
12
12
|
process.exit(EXIT_CODES.ERROR);
|
|
13
13
|
}
|
|
14
14
|
const { data: { results: publicApps }, } = await fetchPublicAppsForPortal(accountId);
|
|
@@ -16,15 +16,13 @@ async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = fa
|
|
|
16
16
|
if (!filteredPublicApps.length ||
|
|
17
17
|
(isMigratingApp &&
|
|
18
18
|
!filteredPublicApps.some(app => !app.preventProjectMigrations || !app.listingInfo))) {
|
|
19
|
-
const headerTranslationKey = isMigratingApp
|
|
20
|
-
? 'noAppsMigration'
|
|
21
|
-
: 'noAppsClone';
|
|
22
|
-
const messageTranslationKey = isMigratingApp
|
|
23
|
-
? 'noAppsMigrationMessage'
|
|
24
|
-
: 'noAppsCloneMessage';
|
|
25
19
|
uiLine();
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
if (isMigratingApp) {
|
|
21
|
+
uiLogger.error(`${lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsMigration}\n${lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsMigrationMessage(accountName)}`);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
uiLogger.error(`${lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsClone}\n${lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsCloneMessage(accountName)}`);
|
|
25
|
+
}
|
|
28
26
|
uiLine();
|
|
29
27
|
process.exit(EXIT_CODES.SUCCESS);
|
|
30
28
|
}
|
|
@@ -32,28 +30,26 @@ async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = fa
|
|
|
32
30
|
}
|
|
33
31
|
catch (error) {
|
|
34
32
|
logError(error, accountId ? { accountId } : undefined);
|
|
35
|
-
|
|
33
|
+
uiLogger.error(lib.prompts.selectPublicAppForMigrationPrompt.errors.errorFetchingApps);
|
|
36
34
|
process.exit(EXIT_CODES.ERROR);
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
export async function selectPublicAppForMigrationPrompt({ accountId, accountName, isMigratingApp = false, }) {
|
|
40
38
|
const publicApps = await fetchPublicAppOptions(accountId, accountName, isMigratingApp);
|
|
41
|
-
const translationKey = isMigratingApp
|
|
42
|
-
? 'selectAppIdMigrate'
|
|
43
|
-
: 'selectAppIdClone';
|
|
44
39
|
return promptUser([
|
|
45
40
|
{
|
|
46
41
|
name: 'appId',
|
|
47
|
-
message:
|
|
48
|
-
accountName
|
|
49
|
-
|
|
42
|
+
message: isMigratingApp
|
|
43
|
+
? lib.prompts.selectPublicAppForMigrationPrompt.selectAppIdMigrate(accountName)
|
|
44
|
+
: lib.prompts.selectPublicAppForMigrationPrompt.selectAppIdClone(accountName),
|
|
50
45
|
type: 'list',
|
|
51
46
|
choices: publicApps.map(app => {
|
|
52
47
|
const { preventProjectMigrations, listingInfo } = app;
|
|
53
48
|
if (isMigratingApp && preventProjectMigrations && listingInfo) {
|
|
54
49
|
return {
|
|
55
50
|
name: `${app.name} (${app.id})`,
|
|
56
|
-
disabled:
|
|
51
|
+
disabled: lib.prompts.selectPublicAppForMigrationPrompt.errors
|
|
52
|
+
.cannotBeMigrated,
|
|
57
53
|
};
|
|
58
54
|
}
|
|
59
55
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { updateDefaultAccount, getConfigDefaultAccount, } from '@hubspot/local-dev-lib/config';
|
|
2
2
|
import { promptUser } from './promptUtils.js';
|
|
3
|
-
import {
|
|
3
|
+
import { lib } from '../../lang/en.js';
|
|
4
4
|
import { uiLogger } from '../ui/logger.js';
|
|
5
5
|
export async function setAsDefaultAccountPrompt(accountName) {
|
|
6
6
|
// Accounts for deprecated and new config
|
|
@@ -10,20 +10,16 @@ export async function setAsDefaultAccountPrompt(accountName) {
|
|
|
10
10
|
name: 'setAsDefault',
|
|
11
11
|
type: 'confirm',
|
|
12
12
|
when: defaultAccount !== accountName,
|
|
13
|
-
message:
|
|
13
|
+
message: lib.prompts.setAsDefaultAccountPrompt.setAsDefaultAccountMessage,
|
|
14
14
|
},
|
|
15
15
|
]);
|
|
16
16
|
uiLogger.log('');
|
|
17
17
|
if (setAsDefault) {
|
|
18
18
|
updateDefaultAccount(accountName);
|
|
19
|
-
uiLogger.success(
|
|
20
|
-
accountName,
|
|
21
|
-
}));
|
|
19
|
+
uiLogger.success(lib.prompts.setAsDefaultAccountPrompt.setAsDefaultAccount(accountName));
|
|
22
20
|
}
|
|
23
21
|
else {
|
|
24
|
-
uiLogger.log(
|
|
25
|
-
accountName: getConfigDefaultAccount(),
|
|
26
|
-
}));
|
|
22
|
+
uiLogger.log(lib.prompts.setAsDefaultAccountPrompt.keepingCurrentDefault(getConfigDefaultAccount()));
|
|
27
23
|
}
|
|
28
24
|
return setAsDefault;
|
|
29
25
|
}
|