@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
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../../ui/logger.js';
|
|
2
2
|
import * as cliConfig from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import * as validation from '../../validation.js';
|
|
4
4
|
import { EXIT_CODES } from '../../enums/exitCodes.js';
|
|
5
|
-
import { handleDeprecatedEnvVariables, injectAccountIdMiddleware,
|
|
6
|
-
vi.mock('
|
|
7
|
-
|
|
5
|
+
import { handleDeprecatedEnvVariables, injectAccountIdMiddleware, loadAndValidateConfigMiddleware, validateAccountOptions, } from '../configMiddleware.js';
|
|
6
|
+
vi.mock('../../ui/logger.js', () => ({
|
|
7
|
+
uiLogger: {
|
|
8
8
|
error: vi.fn(),
|
|
9
9
|
log: vi.fn(),
|
|
10
10
|
},
|
|
@@ -39,7 +39,7 @@ describe('lib/middleware/configMiddleware', () => {
|
|
|
39
39
|
$0: 'hs',
|
|
40
40
|
};
|
|
41
41
|
handleDeprecatedEnvVariables(argv);
|
|
42
|
-
expect(
|
|
42
|
+
expect(uiLogger.log).toHaveBeenCalledWith(expect.stringContaining('The HUBSPOT_PORTAL_ID environment variable is deprecated. Please use HUBSPOT_ACCOUNT_ID instead.'));
|
|
43
43
|
expect(process.env.HUBSPOT_ACCOUNT_ID).toBe('123');
|
|
44
44
|
process.env = originalEnv;
|
|
45
45
|
});
|
|
@@ -56,7 +56,7 @@ describe('lib/middleware/configMiddleware', () => {
|
|
|
56
56
|
$0: 'hs',
|
|
57
57
|
};
|
|
58
58
|
handleDeprecatedEnvVariables(argv);
|
|
59
|
-
expect(
|
|
59
|
+
expect(uiLogger.log).not.toHaveBeenCalled();
|
|
60
60
|
expect(process.env.HUBSPOT_ACCOUNT_ID).toBe('456');
|
|
61
61
|
process.env = originalEnv;
|
|
62
62
|
});
|
|
@@ -93,7 +93,7 @@ describe('lib/middleware/configMiddleware', () => {
|
|
|
93
93
|
expect(getAccountIdSpy).toHaveBeenCalledWith('test-account');
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
|
-
describe('
|
|
96
|
+
describe('loadAndValidateConfigMiddleware()', () => {
|
|
97
97
|
it('should exit with error when config file exists and --config flag is used', async () => {
|
|
98
98
|
configFileExistsSpy.mockReturnValue(true);
|
|
99
99
|
const argv = {
|
|
@@ -101,9 +101,9 @@ describe('lib/middleware/configMiddleware', () => {
|
|
|
101
101
|
config: 'custom-config.json',
|
|
102
102
|
$0: 'hs',
|
|
103
103
|
};
|
|
104
|
-
await expect(
|
|
104
|
+
await expect(loadAndValidateConfigMiddleware(argv)).rejects.toThrow();
|
|
105
105
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
106
|
-
expect(
|
|
106
|
+
expect(uiLogger.error).toHaveBeenCalledWith('A configuration file already exists at /path/to/config. To specify a new configuration file, delete the existing one and try again.');
|
|
107
107
|
});
|
|
108
108
|
it('should load config and validate for non-init commands', async () => {
|
|
109
109
|
configFileExistsSpy.mockReturnValue(false);
|
|
@@ -113,7 +113,7 @@ describe('lib/middleware/configMiddleware', () => {
|
|
|
113
113
|
_: ['some-command'],
|
|
114
114
|
$0: 'hs',
|
|
115
115
|
};
|
|
116
|
-
await
|
|
116
|
+
await loadAndValidateConfigMiddleware(argv);
|
|
117
117
|
expect(loadConfigSpy).toHaveBeenCalled();
|
|
118
118
|
expect(validateConfigSpy).toHaveBeenCalled();
|
|
119
119
|
});
|
|
@@ -123,7 +123,7 @@ describe('lib/middleware/configMiddleware', () => {
|
|
|
123
123
|
_: ['init'],
|
|
124
124
|
$0: 'hs',
|
|
125
125
|
};
|
|
126
|
-
await
|
|
126
|
+
await loadAndValidateConfigMiddleware(argv);
|
|
127
127
|
expect(loadConfigSpy).not.toHaveBeenCalled();
|
|
128
128
|
expect(validateConfigSpy).not.toHaveBeenCalled();
|
|
129
129
|
});
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
1
|
import { EXIT_CODES } from '../../enums/exitCodes.js';
|
|
3
2
|
import * as projectsConfig from '../../projects/config.js';
|
|
4
3
|
import { performChecks } from '../yargsChecksMiddleware.js';
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { uiLogger } from '../../ui/logger.js';
|
|
5
|
+
import { commands } from '../../../lang/en.js';
|
|
6
|
+
vi.mock('../../ui/logger', () => ({
|
|
7
|
+
uiLogger: {
|
|
7
8
|
error: vi.fn(),
|
|
8
9
|
},
|
|
9
10
|
}));
|
|
10
11
|
vi.mock('../../projects/config');
|
|
11
|
-
vi.mock('../../lang', () => ({
|
|
12
|
-
i18n: vi.fn(key => key),
|
|
13
|
-
}));
|
|
14
12
|
const getIsInProjectSpy = vi.spyOn(projectsConfig, 'getIsInProject');
|
|
15
13
|
const processExitSpy = vi.spyOn(process, 'exit');
|
|
16
14
|
describe('lib/middleware/yargsChecksMiddleware', () => {
|
|
@@ -29,7 +27,7 @@ describe('lib/middleware/yargsChecksMiddleware', () => {
|
|
|
29
27
|
getIsInProjectSpy.mockReturnValue(true);
|
|
30
28
|
expect(() => performChecks(argv)).toThrow();
|
|
31
29
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
32
|
-
expect(
|
|
30
|
+
expect(uiLogger.error).toHaveBeenCalledWith(commands.generalErrors.srcIsProject(argv.src, argv._.toString()));
|
|
33
31
|
});
|
|
34
32
|
it('should return true when no checks fail', () => {
|
|
35
33
|
const argv = {
|
|
@@ -40,7 +38,7 @@ describe('lib/middleware/yargsChecksMiddleware', () => {
|
|
|
40
38
|
getIsInProjectSpy.mockReturnValue(false);
|
|
41
39
|
expect(performChecks(argv)).toBe(true);
|
|
42
40
|
expect(processExitSpy).not.toHaveBeenCalled();
|
|
43
|
-
expect(
|
|
41
|
+
expect(uiLogger.error).not.toHaveBeenCalled();
|
|
44
42
|
});
|
|
45
43
|
});
|
|
46
44
|
});
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Arguments } from 'yargs';
|
|
2
|
+
export declare function autoUpdateCLI(argv: Arguments): Promise<void>;
|
|
@@ -7,6 +7,7 @@ import { lib } from '../../lang/en.js';
|
|
|
7
7
|
import { DEFAULT_PACKAGE_MANAGER, isGloballyInstalled, executeInstall, } from '../npm.js';
|
|
8
8
|
import { debugError } from '../errorHandlers/index.js';
|
|
9
9
|
import { uiLogger } from '../ui/logger.js';
|
|
10
|
+
import { isTargetedCommand } from './commandTargetingUtils.js';
|
|
10
11
|
// Default behavior is to check for notifications at most once per day
|
|
11
12
|
// update-notifier stores the last checked date in the user's home directory
|
|
12
13
|
const notifier = updateNotifier({
|
|
@@ -33,13 +34,22 @@ function updateNotification() {
|
|
|
33
34
|
},
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
const SKIP_AUTO_UPDATE_COMMANDS = {
|
|
38
|
+
config: {
|
|
39
|
+
set: true,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const preventAutoUpdateForCommand = (commandParts) => {
|
|
43
|
+
return isTargetedCommand(commandParts, SKIP_AUTO_UPDATE_COMMANDS);
|
|
44
|
+
};
|
|
45
|
+
export async function autoUpdateCLI(argv) {
|
|
37
46
|
// This lets us back to default update-notifier behavior
|
|
38
47
|
let showManualInstallHelp = true;
|
|
39
48
|
if (notifier &&
|
|
40
49
|
notifier.update &&
|
|
41
50
|
!process.env.SKIP_HUBSPOT_CLI_AUTO_UPDATES &&
|
|
42
|
-
isConfigFlagEnabled('allowAutoUpdates')
|
|
51
|
+
isConfigFlagEnabled('allowAutoUpdates') &&
|
|
52
|
+
!preventAutoUpdateForCommand(argv._)) {
|
|
43
53
|
// Ignore all update notifications if the current version is a pre-release
|
|
44
54
|
if (!notifier.update.current.includes('-')) {
|
|
45
55
|
// Attempt auto-update if the current version is not the latest version
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type TargetCommandMap = {
|
|
2
|
+
[key: string]: boolean | TargetCommandMap;
|
|
3
|
+
};
|
|
4
|
+
export declare function isTargetedCommand(commandParts: (string | number)[], targetCommandMap: TargetCommandMap): boolean;
|
|
5
|
+
export declare function shouldLoadConfigForCommand(commandParts: (string | number)[]): boolean;
|
|
6
|
+
export declare function shouldRunConfigValidationForCommand(commandParts: (string | number)[]): boolean;
|
|
7
|
+
export declare function shouldRunAccountValidationForCommand(commandParts: (string | number)[]): boolean;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { configFileExists } from '@hubspot/local-dev-lib/config';
|
|
2
|
+
export function isTargetedCommand(commandParts, targetCommandMap) {
|
|
3
|
+
const currentCommandPart = commandParts[0];
|
|
4
|
+
if (!targetCommandMap[currentCommandPart]) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
if (typeof targetCommandMap[currentCommandPart] === 'boolean' &&
|
|
8
|
+
targetCommandMap[currentCommandPart]) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (commandParts.length > 1) {
|
|
12
|
+
const targetSubCommandMap = targetCommandMap[currentCommandPart];
|
|
13
|
+
if (!targetSubCommandMap) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return isTargetedCommand(commandParts.slice(1), targetSubCommandMap);
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const SKIP_CONFIG_LOADING_COMMANDS = {
|
|
21
|
+
init: true,
|
|
22
|
+
feedback: true,
|
|
23
|
+
};
|
|
24
|
+
// Returns true if the command requires a config file to be present
|
|
25
|
+
export function shouldLoadConfigForCommand(commandParts) {
|
|
26
|
+
const globalConfigExists = configFileExists(true);
|
|
27
|
+
// the user is trying to migrate the global config
|
|
28
|
+
const isGlobalConfigMigration = !globalConfigExists &&
|
|
29
|
+
isTargetedCommand(commandParts, {
|
|
30
|
+
account: { auth: true },
|
|
31
|
+
config: { migrate: true },
|
|
32
|
+
});
|
|
33
|
+
return (!isGlobalConfigMigration &&
|
|
34
|
+
!isTargetedCommand(commandParts, SKIP_CONFIG_LOADING_COMMANDS));
|
|
35
|
+
}
|
|
36
|
+
const SKIP_CONFIG_VALIDATION_COMMANDS = {
|
|
37
|
+
auth: true,
|
|
38
|
+
mcp: {
|
|
39
|
+
setup: true,
|
|
40
|
+
start: true,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
// Returns true if the command requires a valid config file to be present
|
|
44
|
+
// Should only run if config has been loaded
|
|
45
|
+
export function shouldRunConfigValidationForCommand(commandParts) {
|
|
46
|
+
return (shouldLoadConfigForCommand(commandParts) &&
|
|
47
|
+
!isTargetedCommand(commandParts, SKIP_CONFIG_VALIDATION_COMMANDS));
|
|
48
|
+
}
|
|
49
|
+
const accountsSubCommands = {
|
|
50
|
+
auth: true,
|
|
51
|
+
clean: true,
|
|
52
|
+
list: true,
|
|
53
|
+
ls: true,
|
|
54
|
+
remove: true,
|
|
55
|
+
use: true,
|
|
56
|
+
};
|
|
57
|
+
const sandboxesSubCommands = {
|
|
58
|
+
delete: true,
|
|
59
|
+
};
|
|
60
|
+
const SKIP_ACCOUNT_VALIDATION_COMMANDS = {
|
|
61
|
+
account: accountsSubCommands,
|
|
62
|
+
accounts: accountsSubCommands,
|
|
63
|
+
sandbox: sandboxesSubCommands,
|
|
64
|
+
sandboxes: sandboxesSubCommands,
|
|
65
|
+
config: {
|
|
66
|
+
migrate: true,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
// Returns true if the command requires a valid account to be set in the config
|
|
70
|
+
// Should only run if config has been loaded and validated
|
|
71
|
+
export function shouldRunAccountValidationForCommand(commandParts) {
|
|
72
|
+
return (shouldRunConfigValidationForCommand(commandParts) &&
|
|
73
|
+
!isTargetedCommand(commandParts, SKIP_ACCOUNT_VALIDATION_COMMANDS));
|
|
74
|
+
}
|
|
@@ -9,5 +9,5 @@ export declare function handleDeprecatedEnvVariables(argv: Arguments<{
|
|
|
9
9
|
export declare function injectAccountIdMiddleware(argv: Arguments<{
|
|
10
10
|
account?: string;
|
|
11
11
|
}>): Promise<void>;
|
|
12
|
-
export declare function
|
|
12
|
+
export declare function loadAndValidateConfigMiddleware(argv: Arguments<CLIOptions>): Promise<void>;
|
|
13
13
|
export declare function validateAccountOptions(argv: Arguments): Promise<void>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
1
|
import { loadConfig, getAccountId, configFileExists, getConfigPath, validateConfig, } from '@hubspot/local-dev-lib/config';
|
|
3
2
|
import { validateAccount } from '../validation.js';
|
|
4
3
|
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
5
|
-
import {
|
|
4
|
+
import { commands } from '../../lang/en.js';
|
|
6
5
|
import { uiDeprecatedTag } from '../ui/index.js';
|
|
7
|
-
import { isTargetedCommand } from './
|
|
6
|
+
import { isTargetedCommand, shouldLoadConfigForCommand, shouldRunAccountValidationForCommand, shouldRunConfigValidationForCommand, } from './commandTargetingUtils.js';
|
|
8
7
|
import { parseStringToNumber } from '../parsing.js';
|
|
9
8
|
import { uiLogger } from '../ui/logger.js';
|
|
10
9
|
import { lib } from '../../lang/en.js';
|
|
@@ -14,9 +13,7 @@ export function handleDeprecatedEnvVariables(argv) {
|
|
|
14
13
|
if (argv.useEnv &&
|
|
15
14
|
process.env.HUBSPOT_PORTAL_ID &&
|
|
16
15
|
!process.env.HUBSPOT_ACCOUNT_ID) {
|
|
17
|
-
uiDeprecatedTag(
|
|
18
|
-
configPath: getConfigPath(),
|
|
19
|
-
}));
|
|
16
|
+
uiDeprecatedTag(commands.generalErrors.handleDeprecatedEnvVariables.portalEnvVarDeprecated);
|
|
20
17
|
process.env.HUBSPOT_ACCOUNT_ID = process.env.HUBSPOT_PORTAL_ID;
|
|
21
18
|
}
|
|
22
19
|
}
|
|
@@ -39,99 +36,42 @@ export async function injectAccountIdMiddleware(argv) {
|
|
|
39
36
|
argv.derivedAccountId = getAccountId(account);
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
|
-
|
|
43
|
-
init: { target: true },
|
|
44
|
-
auth: { target: true },
|
|
45
|
-
mcp: {
|
|
46
|
-
target: false,
|
|
47
|
-
subCommands: {
|
|
48
|
-
setup: { target: true },
|
|
49
|
-
start: { target: true },
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
export async function loadConfigMiddleware(argv) {
|
|
39
|
+
export async function loadAndValidateConfigMiddleware(argv) {
|
|
54
40
|
// Skip this when no command is provided
|
|
55
41
|
if (!argv._.length || argv.help) {
|
|
56
42
|
return;
|
|
57
43
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
!validateConfig()) {
|
|
61
|
-
process.exit(EXIT_CODES.ERROR);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
if (!configFileExists(true) &&
|
|
65
|
-
isTargetedCommand(argv._, {
|
|
66
|
-
account: { target: false, subCommands: { auth: { target: true } } },
|
|
67
|
-
config: { target: false, subCommands: { migrate: { target: true } } },
|
|
68
|
-
})) {
|
|
44
|
+
// Do not load or validate the config for the commands that do not require it
|
|
45
|
+
if (!shouldLoadConfigForCommand(argv._)) {
|
|
69
46
|
return;
|
|
70
47
|
}
|
|
48
|
+
// If the config file exists and the --config flag is used, exit with an error
|
|
71
49
|
if (configFileExists(true) &&
|
|
72
50
|
argv.config &&
|
|
73
|
-
!isTargetedCommand(argv._, {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
51
|
+
!isTargetedCommand(argv._, { config: { migrate: true } })) {
|
|
52
|
+
uiLogger.error(commands.generalErrors.loadConfigMiddleware.configFileExists(getConfigPath()));
|
|
53
|
+
process.exit(EXIT_CODES.ERROR);
|
|
54
|
+
}
|
|
55
|
+
const config = loadConfig(argv.config, argv);
|
|
56
|
+
// We don't run validation for auth because users should be able to run it when
|
|
57
|
+
// no accounts are configured, but we still want to exit if the config file is not found
|
|
58
|
+
if (isTargetedCommand(argv._, { auth: true }) && !config) {
|
|
79
59
|
process.exit(EXIT_CODES.ERROR);
|
|
80
60
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (isTargetedCommand(argv._, { auth: { target: true } }) && !config) {
|
|
61
|
+
// Only validate the config if the command requires it
|
|
62
|
+
if (shouldRunConfigValidationForCommand(argv._)) {
|
|
63
|
+
const configIsValid = validateConfig();
|
|
64
|
+
if (!configIsValid) {
|
|
86
65
|
process.exit(EXIT_CODES.ERROR);
|
|
87
66
|
}
|
|
88
67
|
}
|
|
89
|
-
maybeValidateConfig();
|
|
90
68
|
}
|
|
91
|
-
const accountsSubCommands = {
|
|
92
|
-
target: false,
|
|
93
|
-
subCommands: {
|
|
94
|
-
auth: { target: true },
|
|
95
|
-
clean: { target: true },
|
|
96
|
-
list: { target: true },
|
|
97
|
-
ls: { target: true },
|
|
98
|
-
remove: { target: true },
|
|
99
|
-
use: { target: true },
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
const sandboxesSubCommands = {
|
|
103
|
-
target: false,
|
|
104
|
-
subCommands: {
|
|
105
|
-
delete: { target: true },
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
const configSubCommands = {
|
|
109
|
-
target: false,
|
|
110
|
-
subCommands: {
|
|
111
|
-
migrate: { target: true },
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
const SKIP_ACCOUNT_VALIDATION = {
|
|
115
|
-
init: { target: true },
|
|
116
|
-
auth: { target: true },
|
|
117
|
-
mcp: {
|
|
118
|
-
target: false,
|
|
119
|
-
subCommands: {
|
|
120
|
-
setup: { target: true },
|
|
121
|
-
start: { target: true },
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
account: accountsSubCommands,
|
|
125
|
-
accounts: accountsSubCommands,
|
|
126
|
-
sandbox: sandboxesSubCommands,
|
|
127
|
-
sandboxes: sandboxesSubCommands,
|
|
128
|
-
config: configSubCommands,
|
|
129
|
-
};
|
|
130
69
|
export async function validateAccountOptions(argv) {
|
|
131
70
|
// Skip this when no command is provided
|
|
132
71
|
if (argv._.length && !argv.help) {
|
|
133
72
|
let validAccount = true;
|
|
134
|
-
if
|
|
73
|
+
// Only validate the account if the command requires it
|
|
74
|
+
if (shouldRunAccountValidationForCommand(argv._)) {
|
|
135
75
|
validAccount = await validateAccount(argv);
|
|
136
76
|
}
|
|
137
77
|
if (!validAccount) {
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { getConfigPath } from '@hubspot/local-dev-lib/config';
|
|
1
|
+
import { getConfigPath, configFileExists } from '@hubspot/local-dev-lib/config';
|
|
2
2
|
import { checkAndWarnGitInclusion } from '../ui/git.js';
|
|
3
3
|
export function checkAndWarnGitInclusionMiddleware(argv) {
|
|
4
4
|
// Skip this when no command is provided
|
|
5
5
|
if (argv._.length) {
|
|
6
|
+
// Skip if using global config
|
|
7
|
+
if (configFileExists(true)) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
6
10
|
const configPath = getConfigPath();
|
|
7
11
|
if (configPath) {
|
|
8
12
|
checkAndWarnGitInclusion(configPath);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import updateNotifier from 'update-notifier';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
2
|
import pkg from '../../package.json' with { type: 'json' };
|
|
4
|
-
import { UI_COLORS
|
|
5
|
-
import {
|
|
3
|
+
import { UI_COLORS } from '../ui/index.js';
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
6
5
|
const notifier = updateNotifier({
|
|
7
6
|
pkg: { ...pkg, name: '@hubspot/cli' },
|
|
8
7
|
distTag: 'latest',
|
|
@@ -12,13 +11,8 @@ const CMS_CLI_PACKAGE_NAME = '@hubspot/cms-cli';
|
|
|
12
11
|
export function notifyAboutUpdates() {
|
|
13
12
|
notifier.notify({
|
|
14
13
|
message: pkg.name === CMS_CLI_PACKAGE_NAME
|
|
15
|
-
?
|
|
16
|
-
|
|
17
|
-
updateCommand: uiCommandReference('{updateCommand}'),
|
|
18
|
-
})
|
|
19
|
-
: i18n(`commands.generalErrors.updateNotify.cliUpdateNotification`, {
|
|
20
|
-
updateCommand: uiCommandReference('{updateCommand}'),
|
|
21
|
-
}),
|
|
14
|
+
? lib.middleware.updateNotification.cmsUpdateNotification(CMS_CLI_PACKAGE_NAME)
|
|
15
|
+
: lib.middleware.updateNotification.cliUpdateNotification,
|
|
22
16
|
defer: false,
|
|
23
17
|
boxenOptions: {
|
|
24
18
|
borderColor: UI_COLORS.MARIGOLD_DARK,
|
|
@@ -28,7 +22,7 @@ export function notifyAboutUpdates() {
|
|
|
28
22
|
borderStyle: 'round',
|
|
29
23
|
title: pkg.name === CMS_CLI_PACKAGE_NAME
|
|
30
24
|
? undefined
|
|
31
|
-
:
|
|
25
|
+
: lib.middleware.updateNotification.notifyTitle,
|
|
32
26
|
},
|
|
33
27
|
});
|
|
34
28
|
}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../ui/logger.js';
|
|
2
2
|
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
3
|
-
import {
|
|
3
|
+
import { commands } from '../../lang/en.js';
|
|
4
4
|
import { getIsInProject } from '../projects/config.js';
|
|
5
|
-
import { isTargetedCommand } from './
|
|
5
|
+
import { isTargetedCommand } from './commandTargetingUtils.js';
|
|
6
6
|
const UPLOAD_AND_WATCH_COMMANDS = {
|
|
7
|
-
upload:
|
|
8
|
-
watch:
|
|
7
|
+
upload: true,
|
|
8
|
+
watch: true,
|
|
9
9
|
};
|
|
10
10
|
export function performChecks(argv) {
|
|
11
11
|
// Require "project" command when running upload/watch inside of a project
|
|
12
12
|
if (isTargetedCommand(argv._, UPLOAD_AND_WATCH_COMMANDS) &&
|
|
13
13
|
getIsInProject(argv.src)) {
|
|
14
|
-
|
|
15
|
-
src: argv.src || './',
|
|
16
|
-
command: argv._.join(' '),
|
|
17
|
-
}));
|
|
14
|
+
uiLogger.error(commands.generalErrors.srcIsProject(argv.src || './', argv._.join(' ')));
|
|
18
15
|
process.exit(EXIT_CODES.ERROR);
|
|
19
16
|
}
|
|
20
17
|
return true;
|
package/lib/npm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { exec as execAsync } from 'node:child_process';
|
|
2
2
|
import util from 'util';
|
|
3
|
-
import {
|
|
3
|
+
import { uiLogger } from './ui/logger.js';
|
|
4
4
|
import pkg from '../package.json' with { type: 'json' };
|
|
5
5
|
export const DEFAULT_PACKAGE_MANAGER = 'npm';
|
|
6
6
|
export async function isGloballyInstalled(packageName) {
|
|
@@ -21,7 +21,7 @@ export async function getLatestCliVersion() {
|
|
|
21
21
|
}
|
|
22
22
|
export async function executeInstall(packages = [], flags, options) {
|
|
23
23
|
const installCommand = `${DEFAULT_PACKAGE_MANAGER} install${flags ? ` ${flags}` : ''} ${packages.join(' ')}`;
|
|
24
|
-
|
|
24
|
+
uiLogger.debug('Running', installCommand);
|
|
25
25
|
const exec = util.promisify(execAsync);
|
|
26
26
|
await exec(installCommand, options);
|
|
27
27
|
}
|
package/lib/oauth.js
CHANGED
|
@@ -5,11 +5,11 @@ import { getAccountConfig } from '@hubspot/local-dev-lib/config';
|
|
|
5
5
|
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
6
6
|
import { addOauthToAccountConfig } from '@hubspot/local-dev-lib/oauth';
|
|
7
7
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
8
|
-
import {
|
|
8
|
+
import { uiLogger } from './ui/logger.js';
|
|
9
9
|
import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
|
|
10
10
|
import { DEFAULT_OAUTH_SCOPES } from '@hubspot/local-dev-lib/constants/auth';
|
|
11
11
|
import { handleExit } from './process.js';
|
|
12
|
-
import {
|
|
12
|
+
import { lib } from '../lang/en.js';
|
|
13
13
|
import { EXIT_CODES } from './enums/exitCodes.js';
|
|
14
14
|
const PORT = 3000;
|
|
15
15
|
const redirectUri = `http://localhost:${PORT}/oauth-callback`;
|
|
@@ -18,7 +18,7 @@ function buildAuthUrl(oauthManager) {
|
|
|
18
18
|
const env = accountEnv || ENVIRONMENTS.PROD;
|
|
19
19
|
const scopes = accountScopes || DEFAULT_OAUTH_SCOPES;
|
|
20
20
|
if (!clientId) {
|
|
21
|
-
|
|
21
|
+
uiLogger.error(lib.oauth.missingClientId);
|
|
22
22
|
process.exit(EXIT_CODES.ERROR);
|
|
23
23
|
}
|
|
24
24
|
return (`${getHubSpotWebsiteOrigin(env)}/oauth/${oauthManager.account.accountId}/authorize` +
|
|
@@ -77,7 +77,7 @@ async function authorize(oauthManager) {
|
|
|
77
77
|
reject();
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
|
-
server = app.listen(PORT, () =>
|
|
80
|
+
server = app.listen(PORT, () => uiLogger.log(`Waiting for authorization...`));
|
|
81
81
|
handleServerOnProcessEnd(server);
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -91,7 +91,7 @@ function setupOauth(accountConfig) {
|
|
|
91
91
|
}
|
|
92
92
|
export async function authenticateWithOauth(accountConfig) {
|
|
93
93
|
const oauthManager = setupOauth(accountConfig);
|
|
94
|
-
|
|
94
|
+
uiLogger.log('Authorizing');
|
|
95
95
|
await authorize(oauthManager);
|
|
96
96
|
addOauthToAccountConfig(oauthManager);
|
|
97
97
|
}
|
package/lib/process.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import readline from 'readline';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { setLogLevel, LOG_LEVEL } from '@hubspot/local-dev-lib/logger';
|
|
3
|
+
import { uiLogger } from './ui/logger.js';
|
|
4
|
+
import { lib } from '../lang/en.js';
|
|
4
5
|
import { logError } from './errorHandlers/index.js';
|
|
5
6
|
const SIGHUP = 'SIGHUP';
|
|
6
7
|
const uncaughtException = 'uncaughtException';
|
|
@@ -26,13 +27,13 @@ export function handleExit(callback) {
|
|
|
26
27
|
if (isSIGHUP) {
|
|
27
28
|
setLogLevel(LOG_LEVEL.NONE);
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
+
uiLogger.debug(lib.process.exitDebug(signal));
|
|
30
31
|
if (signal === uncaughtException && args && args.length > 0) {
|
|
31
32
|
try {
|
|
32
33
|
logError(args[0]);
|
|
33
34
|
}
|
|
34
35
|
catch (e) {
|
|
35
|
-
|
|
36
|
+
uiLogger.error(String(args[0]));
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
await callback({ isSIGHUP });
|
package/lib/projectProfiles.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export declare function logProfileHeader(profileName: string): void;
|
|
|
4
4
|
export declare function logProfileFooter(profile: HsProfileFile, includeVariables?: boolean): void;
|
|
5
5
|
export declare function loadProfile(projectConfig: ProjectConfig | null, projectDir: string | null, profileName: string): HsProfileFile | undefined;
|
|
6
6
|
export declare function exitIfUsingProfiles(projectConfig: ProjectConfig | null, projectDir: string | null): Promise<void>;
|
|
7
|
-
export declare function loadAndValidateProfile(projectConfig: ProjectConfig | null, projectDir: string | null, argsProfile: string | undefined
|
|
7
|
+
export declare function loadAndValidateProfile(projectConfig: ProjectConfig | null, projectDir: string | null, argsProfile: string | undefined): Promise<number | undefined>;
|
package/lib/projectProfiles.js
CHANGED
|
@@ -38,12 +38,7 @@ export function loadProfile(projectConfig, projectDir, profileName) {
|
|
|
38
38
|
uiLogger.error(lib.projectProfiles.loadProfile.errors.missingAccountId(profileFilename));
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
return
|
|
42
|
-
...profile,
|
|
43
|
-
accountId: process.env.HUBSPOT_ACCOUNT_ID
|
|
44
|
-
? Number(process.env.HUBSPOT_ACCOUNT_ID)
|
|
45
|
-
: profile.accountId,
|
|
46
|
-
};
|
|
41
|
+
return profile;
|
|
47
42
|
}
|
|
48
43
|
catch (e) {
|
|
49
44
|
uiLogger.error(lib.projectProfiles.loadProfile.errors.failedToLoadProfile(profileFilename));
|
|
@@ -59,7 +54,7 @@ export async function exitIfUsingProfiles(projectConfig, projectDir) {
|
|
|
59
54
|
}
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
|
-
export async function loadAndValidateProfile(projectConfig, projectDir, argsProfile
|
|
57
|
+
export async function loadAndValidateProfile(projectConfig, projectDir, argsProfile) {
|
|
63
58
|
if (argsProfile) {
|
|
64
59
|
logProfileHeader(argsProfile);
|
|
65
60
|
const profile = loadProfile(projectConfig, projectDir, argsProfile);
|
|
@@ -68,9 +63,6 @@ export async function loadAndValidateProfile(projectConfig, projectDir, argsProf
|
|
|
68
63
|
process.exit(EXIT_CODES.ERROR);
|
|
69
64
|
}
|
|
70
65
|
logProfileFooter(profile, true);
|
|
71
|
-
if (useEnv) {
|
|
72
|
-
return Number(process.env.HUBSPOT_ACCOUNT_ID);
|
|
73
|
-
}
|
|
74
66
|
return profile.accountId;
|
|
75
67
|
}
|
|
76
68
|
else {
|