@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
|
@@ -5,22 +5,21 @@ import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
|
5
5
|
import { uiLine } from '../../../lib/ui/index.js';
|
|
6
6
|
import { deprecatedProjectDevFlow } from './deprecatedFlow.js';
|
|
7
7
|
import { unifiedProjectDevFlow } from './unifiedFlow.js';
|
|
8
|
-
import {
|
|
8
|
+
import { isV2Project } from '../../../lib/projects/platformVersion.js';
|
|
9
9
|
import { makeYargsBuilder } from '../../../lib/yargsUtils.js';
|
|
10
10
|
import { loadProfile, exitIfUsingProfiles, } from '../../../lib/projectProfiles.js';
|
|
11
11
|
import { commands } from '../../../lang/en.js';
|
|
12
12
|
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
13
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
14
13
|
const command = 'dev';
|
|
15
14
|
const describe = commands.project.dev.describe;
|
|
16
|
-
function validateAccountFlags(testingAccount, projectAccount, userProvidedAccount,
|
|
15
|
+
function validateAccountFlags(testingAccount, projectAccount, userProvidedAccount, useV2) {
|
|
17
16
|
// Legacy projects do not support targetTestingAccount and targetProjectAccount
|
|
18
|
-
if (testingAccount && projectAccount && !
|
|
17
|
+
if (testingAccount && projectAccount && !useV2) {
|
|
19
18
|
uiLogger.error(commands.project.dev.errors.unsupportedAccountFlagLegacy);
|
|
20
19
|
process.exit(EXIT_CODES.ERROR);
|
|
21
20
|
}
|
|
22
|
-
if (userProvidedAccount &&
|
|
23
|
-
uiLogger.error(commands.project.dev.errors.
|
|
21
|
+
if (userProvidedAccount && useV2) {
|
|
22
|
+
uiLogger.error(commands.project.dev.errors.unsupportedAccountFlagV2);
|
|
24
23
|
process.exit(EXIT_CODES.ERROR);
|
|
25
24
|
}
|
|
26
25
|
}
|
|
@@ -28,15 +27,15 @@ async function handler(args) {
|
|
|
28
27
|
const { derivedAccountId, userProvidedAccount, testingAccount, projectAccount, } = args;
|
|
29
28
|
const { projectConfig, projectDir } = await getProjectConfig();
|
|
30
29
|
validateProjectConfig(projectConfig, projectDir);
|
|
31
|
-
const
|
|
30
|
+
const useV2Projects = isV2Project(projectConfig.platformVersion);
|
|
32
31
|
if (!projectDir) {
|
|
33
32
|
uiLogger.error(commands.project.dev.errors.noProjectConfig);
|
|
34
33
|
process.exit(EXIT_CODES.ERROR);
|
|
35
34
|
}
|
|
36
|
-
validateAccountFlags(testingAccount, projectAccount, userProvidedAccount,
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
uiLogger.log(commands.project.dev.logs.
|
|
35
|
+
validateAccountFlags(testingAccount, projectAccount, userProvidedAccount, useV2Projects);
|
|
36
|
+
uiLogger.log(commands.project.dev.logs.header);
|
|
37
|
+
if (useV2Projects) {
|
|
38
|
+
uiLogger.log(commands.project.dev.logs.learnMoreMessageV2);
|
|
40
39
|
}
|
|
41
40
|
else {
|
|
42
41
|
uiLogger.log(commands.project.dev.logs.learnMoreMessageLegacy);
|
|
@@ -55,7 +54,7 @@ async function handler(args) {
|
|
|
55
54
|
else if (userProvidedAccount && derivedAccountId) {
|
|
56
55
|
targetProjectAccountId = derivedAccountId;
|
|
57
56
|
}
|
|
58
|
-
if (!targetProjectAccountId &&
|
|
57
|
+
if (!targetProjectAccountId && isV2Project(projectConfig.platformVersion)) {
|
|
59
58
|
if (args.profile) {
|
|
60
59
|
profile = loadProfile(projectConfig, projectDir, args.profile);
|
|
61
60
|
if (!profile) {
|
|
@@ -74,13 +73,13 @@ async function handler(args) {
|
|
|
74
73
|
if (!targetProjectAccountId) {
|
|
75
74
|
// The user is not using profile or account flags, so we can use the derived accountId
|
|
76
75
|
targetProjectAccountId = derivedAccountId;
|
|
77
|
-
if (
|
|
76
|
+
if (useV2Projects) {
|
|
78
77
|
uiLogger.log('');
|
|
79
78
|
uiLogger.log(commands.project.dev.logs.defaultProjectAccountExplanation(targetProjectAccountId));
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
trackCommandUsage('project-dev', {}, targetProjectAccountId);
|
|
83
|
-
if (
|
|
82
|
+
if (isV2Project(projectConfig.platformVersion)) {
|
|
84
83
|
const targetTestingAccountId = (testingAccount && getAccountId(testingAccount)) || undefined;
|
|
85
84
|
await unifiedProjectDevFlow({
|
|
86
85
|
args,
|
|
@@ -110,15 +109,19 @@ function projectDevBuilder(yargs) {
|
|
|
110
109
|
yargs.options('testing-account', {
|
|
111
110
|
type: 'string',
|
|
112
111
|
description: commands.project.dev.options.testingAccount,
|
|
113
|
-
hidden: true,
|
|
114
112
|
implies: ['project-account'],
|
|
115
113
|
});
|
|
116
114
|
yargs.options('project-account', {
|
|
117
115
|
type: 'string',
|
|
118
116
|
description: commands.project.dev.options.projectAccount,
|
|
119
|
-
hidden: true,
|
|
120
117
|
implies: ['testingAccount'],
|
|
121
118
|
});
|
|
119
|
+
yargs.option('account', {
|
|
120
|
+
alias: 'a',
|
|
121
|
+
describe: '',
|
|
122
|
+
type: 'string',
|
|
123
|
+
description: commands.project.dev.options.account,
|
|
124
|
+
});
|
|
122
125
|
yargs.example([['$0 project dev', commands.project.dev.examples.default]]);
|
|
123
126
|
yargs.conflicts('profile', 'account');
|
|
124
127
|
yargs.conflicts('profile', 'testing-account');
|
|
@@ -127,7 +130,6 @@ function projectDevBuilder(yargs) {
|
|
|
127
130
|
}
|
|
128
131
|
export const builder = makeYargsBuilder(projectDevBuilder, command, describe, {
|
|
129
132
|
useGlobalOptions: true,
|
|
130
|
-
useAccountOptions: true,
|
|
131
133
|
useConfigOptions: true,
|
|
132
134
|
useEnvironmentOptions: true,
|
|
133
135
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import util from 'util';
|
|
3
3
|
import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
|
|
4
|
+
import { startPortManagerServer, stopPortManagerServer, } from '@hubspot/local-dev-lib/portManager';
|
|
4
5
|
import { isTranslationError } from '@hubspot/project-parsing-lib/src/lib/errors.js';
|
|
5
6
|
import { translateForLocalDev } from '@hubspot/project-parsing-lib';
|
|
6
7
|
import { getEnv, getConfigAccounts, getAccountConfig, } from '@hubspot/local-dev-lib/config';
|
|
@@ -8,7 +9,7 @@ import { getValidEnv } from '@hubspot/local-dev-lib/environment';
|
|
|
8
9
|
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
9
10
|
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
10
11
|
import { ensureProjectExists } from '../../../lib/projects/ensureProjectExists.js';
|
|
11
|
-
import { createInitialBuildForNewProject, createNewProjectForLocalDev, compareLocalProjectToDeployed, } from '../../../lib/projects/localDev/helpers/project.js';
|
|
12
|
+
import { createInitialBuildForNewProject, createNewProjectForLocalDev, compareLocalProjectToDeployed, checkAndInstallDependencies, } from '../../../lib/projects/localDev/helpers/project.js';
|
|
12
13
|
import { useExistingDevTestAccount, createDeveloperTestAccountForLocalDev, selectAccountTypePrompt, createSandboxForLocalDev, } from '../../../lib/projects/localDev/helpers/account.js';
|
|
13
14
|
import { selectDeveloperTestTargetAccountPrompt, selectSandboxTargetAccountPrompt, } from '../../../lib/prompts/projectDevTargetAccountPrompt.js';
|
|
14
15
|
import SpinniesManager from '../../../lib/ui/SpinniesManager.js';
|
|
@@ -19,7 +20,9 @@ import { isTestAccountOrSandbox, isUnifiedAccount, } from '../../../lib/accountT
|
|
|
19
20
|
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
20
21
|
import { commands } from '../../../lang/en.js';
|
|
21
22
|
import LocalDevWebsocketServer from '../../../lib/projects/localDev/LocalDevWebsocketServer.js';
|
|
23
|
+
import { confirmLocalDevIsNotRunning } from '../../../lib/projects/localDev/helpers/process.js';
|
|
22
24
|
export async function unifiedProjectDevFlow({ args, targetProjectAccountId, providedTargetTestingAccountId, projectConfig, projectDir, }) {
|
|
25
|
+
await confirmLocalDevIsNotRunning();
|
|
23
26
|
const env = getValidEnv(getEnv(targetProjectAccountId));
|
|
24
27
|
let projectNodes;
|
|
25
28
|
let projectProfileData;
|
|
@@ -118,7 +121,10 @@ export async function unifiedProjectDevFlow({ args, targetProjectAccountId, prov
|
|
|
118
121
|
project = await createNewProjectForLocalDev(projectConfig, targetProjectAccountId, false, false);
|
|
119
122
|
await createInitialBuildForNewProject(projectConfig, projectDir, targetProjectAccountId, true, args.profile);
|
|
120
123
|
}
|
|
124
|
+
// Check for missing/outdated dependencies
|
|
125
|
+
await checkAndInstallDependencies();
|
|
121
126
|
// End setup, start local dev process
|
|
127
|
+
await startPortManagerServer();
|
|
122
128
|
const localDevProcess = new LocalDevProcess({
|
|
123
129
|
initialProjectNodes: projectNodes,
|
|
124
130
|
initialProjectProfileData: projectProfileData,
|
|
@@ -131,11 +137,11 @@ export async function unifiedProjectDevFlow({ args, targetProjectAccountId, prov
|
|
|
131
137
|
projectData: project,
|
|
132
138
|
env,
|
|
133
139
|
});
|
|
134
|
-
await localDevProcess.start();
|
|
135
|
-
const watcher = new LocalDevWatcher(localDevProcess);
|
|
136
|
-
watcher.start();
|
|
137
140
|
const websocketServer = new LocalDevWebsocketServer(localDevProcess, args.debug);
|
|
141
|
+
const watcher = new LocalDevWatcher(localDevProcess);
|
|
138
142
|
await websocketServer.start();
|
|
143
|
+
await localDevProcess.start();
|
|
144
|
+
watcher.start();
|
|
139
145
|
handleKeypress(async (key) => {
|
|
140
146
|
if ((key.ctrl && key.name === 'c') || key.name === 'q') {
|
|
141
147
|
await Promise.all([
|
|
@@ -149,5 +155,6 @@ export async function unifiedProjectDevFlow({ args, targetProjectAccountId, prov
|
|
|
149
155
|
localDevProcess.stop(!isSIGHUP);
|
|
150
156
|
watcher.stop();
|
|
151
157
|
websocketServer.shutdown();
|
|
158
|
+
stopPortManagerServer();
|
|
152
159
|
});
|
|
153
160
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { getCwd, sanitizeFileName } from '@hubspot/local-dev-lib/path';
|
|
3
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
4
3
|
import { extractZipArchive } from '@hubspot/local-dev-lib/archive';
|
|
5
4
|
import { downloadProject, fetchProjectBuilds, } from '@hubspot/local-dev-lib/api/projects';
|
|
6
5
|
import { logError, ApiErrorContext } from '../../lib/errorHandlers/index.js';
|
|
7
6
|
import { getProjectConfig } from '../../lib/projects/config.js';
|
|
8
7
|
import { downloadProjectPrompt } from '../../lib/prompts/downloadProjectPrompt.js';
|
|
9
|
-
import {
|
|
8
|
+
import { commands } from '../../lang/en.js';
|
|
9
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
10
10
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
11
11
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
12
12
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
13
13
|
const command = 'download';
|
|
14
|
-
const describe =
|
|
14
|
+
const describe = commands.project.download.describe;
|
|
15
15
|
async function handler(args) {
|
|
16
16
|
const { projectConfig } = await getProjectConfig();
|
|
17
17
|
if (projectConfig) {
|
|
18
|
-
|
|
18
|
+
uiLogger.error(commands.project.download.warnings.cannotDownloadWithinProject);
|
|
19
19
|
process.exit(EXIT_CODES.ERROR);
|
|
20
20
|
}
|
|
21
21
|
const { dest, build, derivedAccountId } = args;
|
|
@@ -32,16 +32,16 @@ async function handler(args) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
if (!buildNumberToDownload) {
|
|
35
|
-
|
|
35
|
+
uiLogger.error(commands.project.download.errors.noBuildIdToDownload);
|
|
36
36
|
process.exit(EXIT_CODES.ERROR);
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const sanitizedProjectName = sanitizeFileName(projectName);
|
|
39
|
+
const absoluteDestPath = dest
|
|
40
|
+
? path.resolve(getCwd(), dest, sanitizedProjectName)
|
|
41
|
+
: path.resolve(getCwd(), sanitizedProjectName);
|
|
39
42
|
const { data: zippedProject } = await downloadProject(derivedAccountId, projectName, buildNumberToDownload);
|
|
40
|
-
await extractZipArchive(zippedProject, sanitizeFileName(projectName), path.resolve(absoluteDestPath)
|
|
41
|
-
|
|
42
|
-
buildId: buildNumberToDownload,
|
|
43
|
-
projectName,
|
|
44
|
-
}));
|
|
43
|
+
await extractZipArchive(zippedProject, sanitizeFileName(projectName), path.resolve(absoluteDestPath));
|
|
44
|
+
uiLogger.log(commands.project.download.logs.downloadSucceeded(buildNumberToDownload, projectName));
|
|
45
45
|
process.exit(EXIT_CODES.SUCCESS);
|
|
46
46
|
}
|
|
47
47
|
catch (e) {
|
|
@@ -55,15 +55,15 @@ async function handler(args) {
|
|
|
55
55
|
function projectDownloadBuilder(yargs) {
|
|
56
56
|
yargs.options({
|
|
57
57
|
project: {
|
|
58
|
-
describe:
|
|
58
|
+
describe: commands.project.download.options.project.describe,
|
|
59
59
|
type: 'string',
|
|
60
60
|
},
|
|
61
61
|
dest: {
|
|
62
|
-
describe:
|
|
62
|
+
describe: commands.project.download.options.dest.describe,
|
|
63
63
|
type: 'string',
|
|
64
64
|
},
|
|
65
65
|
build: {
|
|
66
|
-
describe:
|
|
66
|
+
describe: commands.project.download.options.build.describe,
|
|
67
67
|
alias: ['build-id'],
|
|
68
68
|
type: 'number',
|
|
69
69
|
},
|
|
@@ -71,7 +71,7 @@ function projectDownloadBuilder(yargs) {
|
|
|
71
71
|
yargs.example([
|
|
72
72
|
[
|
|
73
73
|
'$0 project download --project=myProject --dest=myProjectFolder',
|
|
74
|
-
|
|
74
|
+
commands.project.download.examples.default,
|
|
75
75
|
],
|
|
76
76
|
]);
|
|
77
77
|
return yargs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CommonArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
-
export type ProjectInstallDepsArgs = CommonArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
export type ProjectInstallDepsArgs = CommonArgs & ConfigArgs & {
|
|
3
3
|
packages?: string[];
|
|
4
4
|
};
|
|
5
5
|
declare const projectInstallDepsCommand: YargsCommandModule<unknown, ProjectInstallDepsArgs>;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
1
|
import { installPackages, getProjectPackageJsonLocations, } from '../../lib/dependencyManagement.js';
|
|
3
2
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
4
3
|
import { getProjectConfig } from '../../lib/projects/config.js';
|
|
5
4
|
import { promptUser } from '../../lib/prompts/promptUtils.js';
|
|
6
5
|
import path from 'path';
|
|
7
|
-
import {
|
|
6
|
+
import { commands } from '../../lang/en.js';
|
|
7
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
8
8
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
9
9
|
import { logError } from '../../lib/errorHandlers/index.js';
|
|
10
10
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
11
11
|
const command = 'install-deps [packages..]';
|
|
12
|
-
const describe =
|
|
12
|
+
const describe = commands.project.installDeps.help.describe;
|
|
13
13
|
async function handler(args) {
|
|
14
14
|
const { derivedAccountId, packages } = args;
|
|
15
15
|
try {
|
|
16
16
|
trackCommandUsage('project-install-deps', undefined, derivedAccountId);
|
|
17
17
|
const projectConfig = await getProjectConfig();
|
|
18
18
|
if (!projectConfig || !projectConfig.projectDir) {
|
|
19
|
-
|
|
19
|
+
uiLogger.error(commands.project.installDeps.noProjectConfig);
|
|
20
20
|
return process.exit(EXIT_CODES.ERROR);
|
|
21
21
|
}
|
|
22
22
|
const { projectDir } = projectConfig;
|
|
@@ -27,14 +27,14 @@ async function handler(args) {
|
|
|
27
27
|
name: 'selectedInstallLocations',
|
|
28
28
|
type: 'checkbox',
|
|
29
29
|
when: () => packages && packages.length > 0,
|
|
30
|
-
message:
|
|
30
|
+
message: commands.project.installDeps.installLocationPrompt,
|
|
31
31
|
choices: installLocations.map(dir => ({
|
|
32
32
|
name: path.relative(projectDir, dir),
|
|
33
33
|
value: dir,
|
|
34
34
|
})),
|
|
35
35
|
validate: (choices) => {
|
|
36
36
|
if (choices === undefined || choices.length === 0) {
|
|
37
|
-
return
|
|
37
|
+
return commands.project.installDeps.installLocationPromptRequired;
|
|
38
38
|
}
|
|
39
39
|
return true;
|
|
40
40
|
},
|
|
@@ -58,17 +58,18 @@ function projectInstallDepsBuilder(yargs) {
|
|
|
58
58
|
yargs.example([
|
|
59
59
|
[
|
|
60
60
|
'$0 project install-deps',
|
|
61
|
-
|
|
61
|
+
commands.project.installDeps.help.installAppDepsExample,
|
|
62
62
|
],
|
|
63
63
|
[
|
|
64
64
|
'$0 project install-deps dependency1 dependency2',
|
|
65
|
-
|
|
65
|
+
commands.project.installDeps.help.addDepToSubComponentExample,
|
|
66
66
|
],
|
|
67
67
|
]);
|
|
68
68
|
return yargs;
|
|
69
69
|
}
|
|
70
70
|
const builder = makeYargsBuilder(projectInstallDepsBuilder, command, describe, {
|
|
71
71
|
useGlobalOptions: true,
|
|
72
|
+
useConfigOptions: true,
|
|
72
73
|
});
|
|
73
74
|
const projectInstallDepsCommand = {
|
|
74
75
|
command,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AccountArgs, CommonArgs, ConfigArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
type ProjectListArgs = CommonArgs & ConfigArgs & AccountArgs;
|
|
3
|
+
declare const projectListCommand: YargsCommandModule<unknown, ProjectListArgs>;
|
|
4
|
+
export default projectListCommand;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
2
|
+
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
3
|
+
import { fetchProjects } from '@hubspot/local-dev-lib/api/projects';
|
|
4
|
+
import { logError } from '../../lib/errorHandlers/index.js';
|
|
5
|
+
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
6
|
+
import { getTableContents, getTableHeader } from '../../lib/ui/table.js';
|
|
7
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
8
|
+
import { commands } from '../../lang/en.js';
|
|
9
|
+
const command = ['list', 'ls'];
|
|
10
|
+
const describe = commands.project.list.describe;
|
|
11
|
+
async function getProjectData(accountId) {
|
|
12
|
+
try {
|
|
13
|
+
const { data: projects } = await fetchProjects(accountId);
|
|
14
|
+
return projects.results;
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
logError(e);
|
|
18
|
+
process.exit(EXIT_CODES.ERROR);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function formatProjectsAsTableRows(projects) {
|
|
22
|
+
const projectListData = [];
|
|
23
|
+
projects.forEach(project => {
|
|
24
|
+
projectListData.push([
|
|
25
|
+
project.name,
|
|
26
|
+
project.latestBuild ? project.latestBuild.platformVersion : '',
|
|
27
|
+
]);
|
|
28
|
+
});
|
|
29
|
+
return projectListData;
|
|
30
|
+
}
|
|
31
|
+
async function handler(args) {
|
|
32
|
+
const { derivedAccountId } = args;
|
|
33
|
+
trackCommandUsage('projects-list', undefined, derivedAccountId);
|
|
34
|
+
const projectData = await getProjectData(derivedAccountId);
|
|
35
|
+
if (projectData.length === 0) {
|
|
36
|
+
uiLogger.error(commands.project.list.errors.noProjectsFound(derivedAccountId));
|
|
37
|
+
process.exit(EXIT_CODES.ERROR);
|
|
38
|
+
}
|
|
39
|
+
const projectListData = formatProjectsAsTableRows(projectData);
|
|
40
|
+
projectListData.unshift(getTableHeader([
|
|
41
|
+
commands.project.list.labels.name,
|
|
42
|
+
commands.project.list.labels.platformVersion,
|
|
43
|
+
]));
|
|
44
|
+
uiLogger.log(commands.project.list.projects);
|
|
45
|
+
uiLogger.log(getTableContents(projectListData, { border: { bodyLeft: ' ' } }));
|
|
46
|
+
}
|
|
47
|
+
function projectListBuilder(yargs) {
|
|
48
|
+
yargs.example([['$0 project list']]);
|
|
49
|
+
return yargs;
|
|
50
|
+
}
|
|
51
|
+
const builder = makeYargsBuilder(projectListBuilder, command, describe, {
|
|
52
|
+
useGlobalOptions: true,
|
|
53
|
+
useConfigOptions: true,
|
|
54
|
+
useAccountOptions: true,
|
|
55
|
+
});
|
|
56
|
+
const projectListCommand = {
|
|
57
|
+
command,
|
|
58
|
+
describe,
|
|
59
|
+
handler,
|
|
60
|
+
builder,
|
|
61
|
+
};
|
|
62
|
+
export default projectListCommand;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
2
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
3
2
|
import { fetchProject, fetchProjectBuilds, } from '@hubspot/local-dev-lib/api/projects';
|
|
4
3
|
import { getTableContents, getTableHeader } from '../../lib/ui/table.js';
|
|
5
4
|
import { uiLink } from '../../lib/ui/index.js';
|
|
@@ -8,27 +7,24 @@ import { getProjectDetailUrl } from '../../lib/projects/urls.js';
|
|
|
8
7
|
import moment from 'moment';
|
|
9
8
|
import { promptUser } from '../../lib/prompts/promptUtils.js';
|
|
10
9
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
11
|
-
import {
|
|
10
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
12
11
|
import { logError, ApiErrorContext } from '../../lib/errorHandlers/index.js';
|
|
13
12
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
14
13
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
15
14
|
import { commands } from '../../lang/en.js';
|
|
16
15
|
const command = 'list-builds';
|
|
17
|
-
const describe =
|
|
16
|
+
const describe = commands.project.listBuilds.describe;
|
|
18
17
|
async function fetchAndDisplayBuilds(accountId, project, options) {
|
|
19
18
|
const { data: { results, paging }, } = await fetchProjectBuilds(accountId, project.name, options);
|
|
20
19
|
const currentDeploy = project.deployedBuildId;
|
|
21
20
|
if (options && options.after) {
|
|
22
|
-
|
|
23
|
-
count: results.length,
|
|
24
|
-
projectName: project.name,
|
|
25
|
-
}));
|
|
21
|
+
uiLogger.log(commands.project.listBuilds.showingNextBuilds(results.length, project.name));
|
|
26
22
|
}
|
|
27
23
|
else {
|
|
28
|
-
|
|
24
|
+
uiLogger.log(commands.project.listBuilds.showingRecentBuilds(results.length, project.name, uiLink(commands.project.listBuilds.viewAllBuildsLink, getProjectDetailUrl(project.name, accountId))));
|
|
29
25
|
}
|
|
30
26
|
if (results.length === 0) {
|
|
31
|
-
|
|
27
|
+
uiLogger.log(commands.project.listBuilds.errors.noBuilds);
|
|
32
28
|
}
|
|
33
29
|
else {
|
|
34
30
|
const builds = results.map(build => {
|
|
@@ -49,7 +45,7 @@ async function fetchAndDisplayBuilds(accountId, project, options) {
|
|
|
49
45
|
];
|
|
50
46
|
});
|
|
51
47
|
builds.unshift(getTableHeader(['Build ID', 'Status', 'Completed', 'Duration', 'Details']));
|
|
52
|
-
|
|
48
|
+
uiLogger.log(getTableContents(builds, {
|
|
53
49
|
columnDefault: {
|
|
54
50
|
paddingLeft: 3,
|
|
55
51
|
},
|
|
@@ -58,7 +54,7 @@ async function fetchAndDisplayBuilds(accountId, project, options) {
|
|
|
58
54
|
if (paging && paging.next) {
|
|
59
55
|
await promptUser({
|
|
60
56
|
name: 'more',
|
|
61
|
-
message:
|
|
57
|
+
message: commands.project.listBuilds.continueOrExitPrompt,
|
|
62
58
|
});
|
|
63
59
|
await fetchAndDisplayBuilds(accountId, project, {
|
|
64
60
|
limit: options.limit,
|
|
@@ -81,9 +77,7 @@ async function handler(args) {
|
|
|
81
77
|
}
|
|
82
78
|
catch (e) {
|
|
83
79
|
if (isHubSpotHttpError(e) && e.status === 404) {
|
|
84
|
-
|
|
85
|
-
projectName,
|
|
86
|
-
}));
|
|
80
|
+
uiLogger.error(commands.project.listBuilds.errors.projectNotFound(projectName));
|
|
87
81
|
}
|
|
88
82
|
else {
|
|
89
83
|
logError(e, new ApiErrorContext({
|
|
@@ -97,19 +91,16 @@ async function handler(args) {
|
|
|
97
91
|
function projectListBuildsBuilder(yargs) {
|
|
98
92
|
yargs.options({
|
|
99
93
|
project: {
|
|
100
|
-
describe:
|
|
94
|
+
describe: commands.project.listBuilds.options.project.describe,
|
|
101
95
|
type: 'string',
|
|
102
96
|
},
|
|
103
97
|
limit: {
|
|
104
|
-
describe:
|
|
98
|
+
describe: commands.project.listBuilds.options.limit.describe,
|
|
105
99
|
type: 'string',
|
|
106
100
|
},
|
|
107
101
|
});
|
|
108
102
|
yargs.example([
|
|
109
|
-
[
|
|
110
|
-
'$0 project list-builds',
|
|
111
|
-
i18n(`commands.project.subcommands.listBuilds.examples.default`),
|
|
112
|
-
],
|
|
103
|
+
['$0 project list-builds', commands.project.listBuilds.examples.default],
|
|
113
104
|
]);
|
|
114
105
|
return yargs;
|
|
115
106
|
}
|
package/commands/project/logs.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { getEnv } from '@hubspot/local-dev-lib/config';
|
|
2
2
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
3
3
|
import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
|
|
4
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
5
4
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
6
5
|
import { getTableContents, getTableHeader } from '../../lib/ui/table.js';
|
|
7
6
|
import { logError } from '../../lib/errorHandlers/index.js';
|
|
8
|
-
import { uiLine
|
|
7
|
+
import { uiLine } from '../../lib/ui/index.js';
|
|
9
8
|
import { projectLogsPrompt } from '../../lib/prompts/projectsLogsPrompt.js';
|
|
10
|
-
import {
|
|
9
|
+
import { commands } from '../../lang/en.js';
|
|
10
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
11
11
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
12
12
|
import { ProjectLogsManager } from '../../lib/projects/ProjectLogsManager.js';
|
|
13
13
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
@@ -16,34 +16,34 @@ function getPrivateAppsUrl(accountId) {
|
|
|
16
16
|
return `${baseUrl}/private-apps/${accountId}`;
|
|
17
17
|
}
|
|
18
18
|
function logTable(tableHeader, logsInfo) {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
uiLogger.log(commands.project.logs.logs.showingLogs);
|
|
20
|
+
uiLogger.log(getTableContents([tableHeader, logsInfo], { border: { bodyLeft: ' ' } }));
|
|
21
21
|
}
|
|
22
22
|
function logPreamble() {
|
|
23
23
|
if (ProjectLogsManager.isPublicFunction) {
|
|
24
24
|
logTable(getTableHeader([
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
commands.project.logs.table.accountHeader,
|
|
26
|
+
commands.project.logs.table.functionHeader,
|
|
27
|
+
commands.project.logs.table.endpointHeader,
|
|
28
28
|
]), [
|
|
29
29
|
ProjectLogsManager.accountId,
|
|
30
30
|
ProjectLogsManager.functionName,
|
|
31
31
|
ProjectLogsManager.endpointName,
|
|
32
32
|
]);
|
|
33
|
-
|
|
33
|
+
uiLogger.log(commands.project.logs.logs.hubspotLogsDirectLink(`${getPrivateAppsUrl(ProjectLogsManager.accountId)}/${ProjectLogsManager.appId}/logs/serverlessGatewayExecution?path=${ProjectLogsManager.endpointName}`));
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
36
|
logTable(getTableHeader([
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
commands.project.logs.table.accountHeader,
|
|
38
|
+
commands.project.logs.table.functionHeader,
|
|
39
39
|
]), [ProjectLogsManager.accountId, ProjectLogsManager.functionName]);
|
|
40
|
-
|
|
40
|
+
uiLogger.log(commands.project.logs.logs.hubspotLogsDirectLink(`${getPrivateAppsUrl(ProjectLogsManager.accountId)}/${ProjectLogsManager.appId}/logs/crm?serverlessFunction=${ProjectLogsManager.functionName}`));
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
uiLogger.log('');
|
|
43
43
|
uiLine();
|
|
44
44
|
}
|
|
45
45
|
const command = 'logs';
|
|
46
|
-
const describe =
|
|
46
|
+
const describe = commands.project.logs.describe;
|
|
47
47
|
async function handler(args) {
|
|
48
48
|
const { derivedAccountId } = args;
|
|
49
49
|
trackCommandUsage('project-logs', undefined, derivedAccountId);
|
|
@@ -70,38 +70,35 @@ function projectLogsBuilder(yargs) {
|
|
|
70
70
|
yargs.options({
|
|
71
71
|
function: {
|
|
72
72
|
alias: 'function',
|
|
73
|
-
describe:
|
|
73
|
+
describe: commands.project.logs.options.function.describe,
|
|
74
74
|
requiresArg: true,
|
|
75
75
|
type: 'string',
|
|
76
76
|
},
|
|
77
77
|
latest: {
|
|
78
78
|
alias: 'l',
|
|
79
|
-
describe:
|
|
79
|
+
describe: commands.project.logs.options.latest.describe,
|
|
80
80
|
type: 'boolean',
|
|
81
81
|
},
|
|
82
82
|
compact: {
|
|
83
|
-
describe:
|
|
83
|
+
describe: commands.project.logs.options.compact.describe,
|
|
84
84
|
type: 'boolean',
|
|
85
85
|
},
|
|
86
86
|
tail: {
|
|
87
87
|
alias: ['t', 'follow'],
|
|
88
|
-
describe:
|
|
88
|
+
describe: commands.project.logs.options.tail.describe,
|
|
89
89
|
type: 'boolean',
|
|
90
90
|
},
|
|
91
91
|
limit: {
|
|
92
|
-
describe:
|
|
92
|
+
describe: commands.project.logs.options.limit.describe,
|
|
93
93
|
type: 'number',
|
|
94
94
|
},
|
|
95
95
|
});
|
|
96
96
|
yargs.conflicts('tail', 'limit');
|
|
97
97
|
yargs.example([
|
|
98
|
-
[
|
|
99
|
-
'$0 project logs',
|
|
100
|
-
i18n(`commands.project.subcommands.logs.examples.default`),
|
|
101
|
-
],
|
|
98
|
+
['$0 project logs', commands.project.logs.examples.default],
|
|
102
99
|
[
|
|
103
100
|
'$0 project logs --function=my-function',
|
|
104
|
-
|
|
101
|
+
commands.project.logs.examples.withOptions,
|
|
105
102
|
],
|
|
106
103
|
]);
|
|
107
104
|
return yargs;
|
|
@@ -13,11 +13,13 @@ import { getWarningBox } from '../../ui/components/StatusMessageBoxes.js';
|
|
|
13
13
|
import { getHasMigratableThemes, migrateThemes2025_2, } from '../../lib/theme/migrate.js';
|
|
14
14
|
import { hasFeature } from '../../lib/hasFeature.js';
|
|
15
15
|
import { FEATURES } from '../../lib/constants.js';
|
|
16
|
+
import { trackCommandMetadataUsage, trackCommandUsage, } from '../../lib/usageTracking.js';
|
|
16
17
|
const { v2025_2 } = PLATFORM_VERSIONS;
|
|
17
18
|
const command = 'migrate';
|
|
18
19
|
const describe = commands.project.migrate.describe;
|
|
19
20
|
async function handler(args) {
|
|
20
|
-
const { platformVersion, unstable } = args;
|
|
21
|
+
const { platformVersion, unstable, derivedAccountId } = args;
|
|
22
|
+
await trackCommandUsage('project-migrate', {}, derivedAccountId);
|
|
21
23
|
const projectConfig = await getProjectConfig();
|
|
22
24
|
if (!projectConfig.projectConfig) {
|
|
23
25
|
uiLogger.error(commands.project.migrate.errors.noProjectConfig(uiCommandReference('hs app migrate')));
|
|
@@ -37,7 +39,6 @@ async function handler(args) {
|
|
|
37
39
|
}));
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
|
-
const { derivedAccountId } = args;
|
|
41
42
|
try {
|
|
42
43
|
const { hasMigratableThemes, migratableThemesCount } = await getHasMigratableThemes(projectConfig);
|
|
43
44
|
if (hasMigratableThemes) {
|
|
@@ -64,9 +65,11 @@ async function handler(args) {
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
catch (error) {
|
|
68
|
+
await trackCommandMetadataUsage('project-migrate', { successful: false }, derivedAccountId);
|
|
67
69
|
logError(error);
|
|
68
70
|
return process.exit(EXIT_CODES.ERROR);
|
|
69
71
|
}
|
|
72
|
+
await trackCommandMetadataUsage('project-migrate', { successful: true }, derivedAccountId);
|
|
70
73
|
return process.exit(EXIT_CODES.SUCCESS);
|
|
71
74
|
}
|
|
72
75
|
function projectMigrateBuilder(yargs) {
|