@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
|
@@ -3,6 +3,7 @@ import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
|
|
|
3
3
|
import { translateForLocalDev } from '@hubspot/project-parsing-lib';
|
|
4
4
|
import { getConfigAccounts, getAccountConfig, } from '@hubspot/local-dev-lib/config';
|
|
5
5
|
import { getValidEnv } from '@hubspot/local-dev-lib/environment';
|
|
6
|
+
import { getServerPortByInstanceId } from '@hubspot/local-dev-lib/portManager';
|
|
6
7
|
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
7
8
|
import { ensureProjectExists } from '../../../lib/projects/ensureProjectExists.js';
|
|
8
9
|
import { createInitialBuildForNewProject, createNewProjectForLocalDev, } from '../../../lib/projects/localDev/helpers/project.js';
|
|
@@ -33,6 +34,7 @@ vi.mock('@hubspot/ui-extensions-dev-server', () => ({
|
|
|
33
34
|
vi.mock('@hubspot/project-parsing-lib');
|
|
34
35
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
35
36
|
vi.mock('@hubspot/local-dev-lib/environment');
|
|
37
|
+
vi.mock('@hubspot/local-dev-lib/portManager');
|
|
36
38
|
vi.mock('../../../lib/errorHandlers');
|
|
37
39
|
vi.mock('../../../lib/projects/ensureProjectExists');
|
|
38
40
|
vi.mock('../../../lib/projects/localDev/helpers/project');
|
|
@@ -135,6 +137,7 @@ describe('unifiedProjectDevFlow', () => {
|
|
|
135
137
|
uiLogger.error.mockImplementation(() => { });
|
|
136
138
|
uiLogger.log.mockImplementation(() => { });
|
|
137
139
|
uiLine.mockImplementation(() => { });
|
|
140
|
+
getServerPortByInstanceId.mockRejectedValue(new Error('No server running'));
|
|
138
141
|
});
|
|
139
142
|
describe('successful flow', () => {
|
|
140
143
|
it('should complete successfully with existing project and provided testing account', async () => {
|
|
@@ -400,4 +403,33 @@ describe('unifiedProjectDevFlow', () => {
|
|
|
400
403
|
expect(uiLogger.log).toHaveBeenCalledWith(commands.project.dev.logs.testingAccountFlagExplanation(providedTestingAccountId));
|
|
401
404
|
});
|
|
402
405
|
});
|
|
406
|
+
describe('confirmLocalDevIsNotRunning', () => {
|
|
407
|
+
it('should exit with error when local dev is already running', async () => {
|
|
408
|
+
getServerPortByInstanceId.mockResolvedValue(3000);
|
|
409
|
+
const mockExit = vi.spyOn(process, 'exit').mockImplementation(() => {
|
|
410
|
+
throw new Error('Process.exit called');
|
|
411
|
+
});
|
|
412
|
+
await unifiedProjectDevFlow({
|
|
413
|
+
args: mockArgs,
|
|
414
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
415
|
+
providedTargetTestingAccountId: mockProvidedTargetTestingAccountId,
|
|
416
|
+
projectConfig: mockProjectConfig,
|
|
417
|
+
projectDir: mockProjectDir,
|
|
418
|
+
});
|
|
419
|
+
expect(uiLogger.error).toHaveBeenCalledWith(commands.project.dev.errors.localDevAlreadyRunning);
|
|
420
|
+
expect(mockExit).toHaveBeenCalledWith(1);
|
|
421
|
+
mockExit.mockRestore();
|
|
422
|
+
});
|
|
423
|
+
it('should continue when local dev is not running', async () => {
|
|
424
|
+
getServerPortByInstanceId.mockRejectedValue(new Error('No server running'));
|
|
425
|
+
await unifiedProjectDevFlow({
|
|
426
|
+
args: mockArgs,
|
|
427
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
428
|
+
providedTargetTestingAccountId: mockProvidedTargetTestingAccountId,
|
|
429
|
+
projectConfig: mockProjectConfig,
|
|
430
|
+
projectDir: mockProjectDir,
|
|
431
|
+
});
|
|
432
|
+
expect(mockLocalDevProcess.start).toHaveBeenCalled();
|
|
433
|
+
});
|
|
434
|
+
});
|
|
403
435
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import {
|
|
3
|
+
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
4
4
|
import * as projectUtils from '../../../lib/projects/config.js';
|
|
5
5
|
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
6
6
|
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
7
7
|
import * as dependencyManagement from '../../../lib/dependencyManagement.js';
|
|
8
8
|
import * as promptUtils from '../../../lib/prompts/promptUtils.js';
|
|
9
9
|
import projectInstallDepsCommand from '../installDeps.js';
|
|
10
|
-
vi.mock('
|
|
10
|
+
vi.mock('../../../lib/ui/logger.js');
|
|
11
11
|
vi.mock('../../../lib/projects/config');
|
|
12
12
|
vi.mock('../../../lib/dependencyManagement');
|
|
13
13
|
vi.mock('../../../lib/prompts/promptUtils');
|
|
@@ -56,8 +56,8 @@ describe('commands/project/installDeps', () => {
|
|
|
56
56
|
throw error;
|
|
57
57
|
});
|
|
58
58
|
await projectInstallDepsCommand.handler(args);
|
|
59
|
-
expect(
|
|
60
|
-
expect(
|
|
59
|
+
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
60
|
+
expect(uiLogger.error).toHaveBeenCalledWith(error.message);
|
|
61
61
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
62
62
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
63
63
|
});
|
|
@@ -67,8 +67,8 @@ describe('commands/project/installDeps', () => {
|
|
|
67
67
|
projectConfig: null,
|
|
68
68
|
});
|
|
69
69
|
await projectInstallDepsCommand.handler(args);
|
|
70
|
-
expect(
|
|
71
|
-
expect(
|
|
70
|
+
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
71
|
+
expect(uiLogger.error).toHaveBeenCalledWith('No project detected. Run this command from a project directory.');
|
|
72
72
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
73
73
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
74
74
|
});
|
|
@@ -78,8 +78,8 @@ describe('commands/project/installDeps', () => {
|
|
|
78
78
|
projectConfig: null,
|
|
79
79
|
});
|
|
80
80
|
await projectInstallDepsCommand.handler(args);
|
|
81
|
-
expect(
|
|
82
|
-
expect(
|
|
81
|
+
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
82
|
+
expect(uiLogger.error).toHaveBeenCalledWith('No project detected. Run this command from a project directory.');
|
|
83
83
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
84
84
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
85
85
|
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import yargs from 'yargs';
|
|
2
|
+
import { addAccountOptions, addConfigOptions, } from '../../../lib/commonOpts.js';
|
|
3
|
+
import projectListCommand from '../list.js';
|
|
4
|
+
vi.mock('../../../lib/commonOpts');
|
|
5
|
+
describe('commands/project/list', () => {
|
|
6
|
+
const yargsMock = yargs;
|
|
7
|
+
describe('command', () => {
|
|
8
|
+
it('should have the correct command structure', () => {
|
|
9
|
+
expect(projectListCommand.command).toEqual(['list', 'ls']);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
describe('describe', () => {
|
|
13
|
+
it('should provide a description', () => {
|
|
14
|
+
expect(projectListCommand.describe).toBeDefined();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
describe('builder', () => {
|
|
18
|
+
it('should support the correct options', () => {
|
|
19
|
+
projectListCommand.builder(yargsMock);
|
|
20
|
+
expect(addAccountOptions).toHaveBeenCalledTimes(1);
|
|
21
|
+
expect(addAccountOptions).toHaveBeenCalledWith(yargsMock);
|
|
22
|
+
expect(addConfigOptions).toHaveBeenCalledTimes(1);
|
|
23
|
+
expect(addConfigOptions).toHaveBeenCalledWith(yargsMock);
|
|
24
|
+
});
|
|
25
|
+
it('should define examples', () => {
|
|
26
|
+
const exampleSpy = vi.spyOn(yargsMock, 'example');
|
|
27
|
+
projectListCommand.builder(yargsMock);
|
|
28
|
+
expect(exampleSpy).toHaveBeenCalled();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -8,7 +8,7 @@ import * as ui from '../../../lib/ui/index.js';
|
|
|
8
8
|
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
9
9
|
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
10
10
|
import projectLogsCommand from '../logs.js';
|
|
11
|
-
vi.mock('
|
|
11
|
+
vi.mock('../../ui/logger.js');
|
|
12
12
|
vi.mock('../../../lib/commonOpts');
|
|
13
13
|
vi.mock('../../../lib/usageTracking');
|
|
14
14
|
vi.mock('../../../lib/validation');
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
-
import {
|
|
2
|
+
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
3
3
|
import { PLATFORM_VERSIONS } from '@hubspot/local-dev-lib/constants/projects';
|
|
4
4
|
import migrateCommand from '../migrate.js';
|
|
5
5
|
import { migrateApp2025_2 } from '../../../lib/app/migrate.js';
|
|
6
6
|
import { getProjectConfig } from '../../../lib/projects/config.js';
|
|
7
7
|
import { commands } from '../../../lang/en.js';
|
|
8
8
|
import { uiBetaTag, uiCommandReference } from '../../../lib/ui/index.js';
|
|
9
|
-
vi.mock('
|
|
9
|
+
vi.mock('../../../lib/ui/logger.js');
|
|
10
10
|
vi.mock('../../../lib/app/migrate');
|
|
11
11
|
vi.mock('../../../lib/projects/config');
|
|
12
12
|
vi.mock('../../../lib/ui');
|
|
13
|
+
vi.mock('../../../lib/usageTracking.js');
|
|
13
14
|
const { v2025_2 } = PLATFORM_VERSIONS;
|
|
14
15
|
describe('commands/project/migrate', () => {
|
|
15
16
|
const yargsMock = yargs;
|
|
@@ -24,8 +25,8 @@ describe('commands/project/migrate', () => {
|
|
|
24
25
|
.mockImplementation(() => undefined);
|
|
25
26
|
beforeEach(() => {
|
|
26
27
|
// Mock logger methods
|
|
27
|
-
vi.spyOn(
|
|
28
|
-
vi.spyOn(
|
|
28
|
+
vi.spyOn(uiLogger, 'log').mockImplementation(() => { });
|
|
29
|
+
vi.spyOn(uiLogger, 'error').mockImplementation(() => { });
|
|
29
30
|
migrateApp2025_2Mock.mockResolvedValue(undefined);
|
|
30
31
|
getProjectConfigMock.mockResolvedValue({
|
|
31
32
|
projectConfig: { name: 'test-project' },
|
|
@@ -74,7 +75,7 @@ describe('commands/project/migrate', () => {
|
|
|
74
75
|
it('should exit with error if no project config exists', async () => {
|
|
75
76
|
getProjectConfigMock.mockResolvedValue({ projectConfig: null });
|
|
76
77
|
await migrateCommand.handler(options);
|
|
77
|
-
expect(
|
|
78
|
+
expect(uiLogger.error).toHaveBeenCalledWith(commands.project.migrate.errors.noProjectConfig('command reference'));
|
|
78
79
|
expect(mockExit).toHaveBeenCalledWith(1);
|
|
79
80
|
expect(mockExit).toHaveBeenCalledTimes(1);
|
|
80
81
|
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
-
import { i18n } from '../../../lib/lang.js';
|
|
3
2
|
import { uiCommandReference, uiDeprecatedTag } from '../../../lib/ui/index.js';
|
|
4
3
|
import { handlerGenerator } from '../../app/migrate.js';
|
|
5
4
|
import { PLATFORM_VERSIONS } from '@hubspot/local-dev-lib/constants/projects';
|
|
6
5
|
import migrateAppCommand from '../migrateApp.js';
|
|
7
|
-
vi.mock('
|
|
8
|
-
vi.mock('../../../
|
|
6
|
+
vi.mock('../../ui/logger.js');
|
|
7
|
+
vi.mock('../../../lang/en.js');
|
|
9
8
|
vi.mock('../../../lib/ui');
|
|
10
9
|
vi.mock('../../app/migrate');
|
|
11
10
|
const { v2023_2, v2025_2 } = PLATFORM_VERSIONS;
|
|
@@ -14,13 +13,11 @@ describe('commands/project/migrateApp', () => {
|
|
|
14
13
|
const optionsSpy = vi.spyOn(yargsMock, 'options').mockReturnValue(yargsMock);
|
|
15
14
|
const exampleSpy = vi.spyOn(yargsMock, 'example').mockReturnValue(yargsMock);
|
|
16
15
|
// Mock the imported functions
|
|
17
|
-
const i18nMock = i18n;
|
|
18
16
|
const uiDeprecatedTagMock = uiDeprecatedTag;
|
|
19
17
|
const uiCommandReferenceMock = uiCommandReference;
|
|
20
18
|
const handlerGeneratorMock = handlerGenerator;
|
|
21
19
|
beforeEach(() => {
|
|
22
20
|
vi.clearAllMocks();
|
|
23
|
-
i18nMock.mockReturnValue('test description');
|
|
24
21
|
uiDeprecatedTagMock.mockReturnValue('deprecated test description');
|
|
25
22
|
uiCommandReferenceMock.mockReturnValue('command reference');
|
|
26
23
|
handlerGeneratorMock.mockReturnValue(vi.fn().mockResolvedValue(undefined));
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { vi } from 'vitest';
|
|
3
|
+
import { validateSourceDirectory } from '../../../lib/projects/upload.js';
|
|
4
|
+
import { getProjectConfig, validateProjectConfig, } from '../../../lib/projects/config.js';
|
|
5
|
+
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
6
|
+
import { commands } from '../../../lang/en.js';
|
|
7
|
+
import { isV2Project } from '../../../lib/projects/platformVersion.js';
|
|
8
|
+
import { loadAndValidateProfile } from '../../../lib/projectProfiles.js';
|
|
9
|
+
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
10
|
+
import { getAccountConfig } from '@hubspot/local-dev-lib/config';
|
|
11
|
+
import { handleTranslate } from '../../../lib/projects/upload.js';
|
|
12
|
+
import projectValidateCommand from '../validate.js';
|
|
13
|
+
// Mock dependencies
|
|
14
|
+
vi.mock('../../../lib/projects/upload.js');
|
|
15
|
+
vi.mock('../../../lib/projects/config.js');
|
|
16
|
+
vi.mock('../../../lib/ui/logger.js');
|
|
17
|
+
vi.mock('../../../lib/usageTracking.js');
|
|
18
|
+
vi.mock('../../../lib/projectProfiles.js');
|
|
19
|
+
vi.mock('../../../lib/errorHandlers/index.js');
|
|
20
|
+
vi.mock('@hubspot/local-dev-lib/config');
|
|
21
|
+
vi.mock('../../../lib/projects/platformVersion.js');
|
|
22
|
+
describe('commands/project/validate', () => {
|
|
23
|
+
const projectDir = '/test/project';
|
|
24
|
+
let exitSpy;
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
// Mock process.exit to throw to stop execution
|
|
27
|
+
exitSpy = vi.spyOn(process, 'exit').mockImplementation(code => {
|
|
28
|
+
throw new Error(`Process exited with code ${code}`);
|
|
29
|
+
});
|
|
30
|
+
vi.clearAllMocks();
|
|
31
|
+
});
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
exitSpy.mockRestore();
|
|
34
|
+
});
|
|
35
|
+
describe('project configuration validation', () => {
|
|
36
|
+
it('should exit with error when project config is null', async () => {
|
|
37
|
+
vi.mocked(getProjectConfig).mockResolvedValue({
|
|
38
|
+
projectConfig: null,
|
|
39
|
+
projectDir: null,
|
|
40
|
+
});
|
|
41
|
+
await expect(
|
|
42
|
+
// @ts-expect-error partial mock
|
|
43
|
+
projectValidateCommand.handler({
|
|
44
|
+
derivedAccountId: 123,
|
|
45
|
+
d: false,
|
|
46
|
+
debug: false,
|
|
47
|
+
})).rejects.toThrow('Process exited with code 1');
|
|
48
|
+
expect(uiLogger.error).toHaveBeenCalledWith(commands.project.validate.mustBeRanWithinAProject);
|
|
49
|
+
});
|
|
50
|
+
it('should exit with error when project directory is null', async () => {
|
|
51
|
+
vi.mocked(getProjectConfig).mockResolvedValue({
|
|
52
|
+
projectConfig: {
|
|
53
|
+
name: 'test',
|
|
54
|
+
srcDir: 'src',
|
|
55
|
+
platformVersion: '2025.2',
|
|
56
|
+
},
|
|
57
|
+
projectDir: null,
|
|
58
|
+
});
|
|
59
|
+
await expect(
|
|
60
|
+
// @ts-expect-error partial mock
|
|
61
|
+
projectValidateCommand.handler({
|
|
62
|
+
derivedAccountId: 123,
|
|
63
|
+
d: false,
|
|
64
|
+
debug: false,
|
|
65
|
+
})).rejects.toThrow('Process exited with code 1');
|
|
66
|
+
expect(uiLogger.error).toHaveBeenCalledWith(commands.project.validate.mustBeRanWithinAProject);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
it('should call validateSourceDirectory with correct parameters', async () => {
|
|
70
|
+
const mockProjectConfig = {
|
|
71
|
+
name: 'test-project',
|
|
72
|
+
srcDir: 'src',
|
|
73
|
+
platformVersion: '2025.2',
|
|
74
|
+
};
|
|
75
|
+
vi.mocked(getProjectConfig).mockResolvedValue({
|
|
76
|
+
projectConfig: mockProjectConfig,
|
|
77
|
+
projectDir,
|
|
78
|
+
});
|
|
79
|
+
vi.mocked(isV2Project).mockReturnValue(true);
|
|
80
|
+
vi.mocked(validateProjectConfig).mockReturnValue(undefined);
|
|
81
|
+
vi.mocked(loadAndValidateProfile).mockResolvedValue(123);
|
|
82
|
+
vi.mocked(getAccountConfig).mockReturnValue({
|
|
83
|
+
accountType: 'STANDARD',
|
|
84
|
+
accountId: 123,
|
|
85
|
+
env: 'prod',
|
|
86
|
+
});
|
|
87
|
+
vi.mocked(trackCommandUsage);
|
|
88
|
+
vi.mocked(validateSourceDirectory).mockResolvedValue(undefined);
|
|
89
|
+
vi.mocked(handleTranslate).mockResolvedValue(undefined);
|
|
90
|
+
await expect(projectValidateCommand.handler({
|
|
91
|
+
derivedAccountId: 123,
|
|
92
|
+
d: false,
|
|
93
|
+
debug: false,
|
|
94
|
+
})).rejects.toThrow('Process exited with code 0');
|
|
95
|
+
const expectedSrcDir = path.resolve(projectDir, mockProjectConfig.srcDir);
|
|
96
|
+
expect(validateSourceDirectory).toHaveBeenCalledWith(expectedSrcDir, mockProjectConfig, projectDir);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { YargsCommandModule, CommonArgs } from '../../types/Yargs.js';
|
|
2
|
-
export type ProjectAddArgs = CommonArgs & {
|
|
1
|
+
import { YargsCommandModule, CommonArgs, ConfigArgs } from '../../types/Yargs.js';
|
|
2
|
+
export type ProjectAddArgs = CommonArgs & ConfigArgs & {
|
|
3
3
|
type?: string;
|
|
4
4
|
name?: string;
|
|
5
5
|
features?: string[];
|
package/commands/project/add.js
CHANGED
|
@@ -3,9 +3,9 @@ import { getProjectConfig } from '../../lib/projects/config.js';
|
|
|
3
3
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
4
4
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
5
5
|
import { commands } from '../../lang/en.js';
|
|
6
|
-
import {
|
|
6
|
+
import { isV2Project } from '../../lib/projects/platformVersion.js';
|
|
7
7
|
import { legacyAddComponent } from '../../lib/projects/add/legacyAddComponent.js';
|
|
8
|
-
import {
|
|
8
|
+
import { v2AddComponent } from '../../lib/projects/add/v2AddComponent.js';
|
|
9
9
|
import { marketplaceDistribution, oAuth, privateDistribution, staticAuth, } from '../../lib/constants.js';
|
|
10
10
|
import { uiLogger } from '../../lib/ui/logger.js';
|
|
11
11
|
const command = 'add';
|
|
@@ -18,9 +18,9 @@ async function handler(args) {
|
|
|
18
18
|
uiLogger.error(commands.project.add.error.locationInProject);
|
|
19
19
|
process.exit(EXIT_CODES.ERROR);
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
await
|
|
21
|
+
const isV2ProjectCreate = isV2Project(projectConfig.platformVersion);
|
|
22
|
+
if (isV2ProjectCreate) {
|
|
23
|
+
await v2AddComponent(args, projectDir, projectConfig, derivedAccountId);
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
26
|
await legacyAddComponent(args, projectDir, projectConfig, derivedAccountId);
|
|
@@ -68,6 +68,7 @@ function projectAddBuilder(yargs) {
|
|
|
68
68
|
}
|
|
69
69
|
const builder = makeYargsBuilder(projectAddBuilder, command, describe, {
|
|
70
70
|
useGlobalOptions: true,
|
|
71
|
+
useConfigOptions: true,
|
|
71
72
|
});
|
|
72
73
|
const projectAddCommand = {
|
|
73
74
|
command,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import { trackCommandUsage, trackCommandMetadataUsage, } from '../../lib/usageTracking.js';
|
|
4
|
-
import {
|
|
4
|
+
import { commands } from '../../lang/en.js';
|
|
5
5
|
import { selectPublicAppForMigrationPrompt } from '../../lib/prompts/selectPublicAppForMigrationPrompt.js';
|
|
6
6
|
import { projectNameAndDestPrompt } from '../../lib/prompts/projectNameAndDestPrompt.js';
|
|
7
7
|
import { poll } from '../../lib/polling.js';
|
|
@@ -12,7 +12,7 @@ import { writeProjectConfig } from '../../lib/projects/config.js';
|
|
|
12
12
|
import { PROJECT_CONFIG_FILE } from '../../lib/constants.js';
|
|
13
13
|
import { cloneApp, checkCloneStatus, downloadClonedProject, } from '@hubspot/local-dev-lib/api/projects';
|
|
14
14
|
import { getCwd, sanitizeFileName } from '@hubspot/local-dev-lib/path';
|
|
15
|
-
import {
|
|
15
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
16
16
|
import { extractZipArchive } from '@hubspot/local-dev-lib/archive';
|
|
17
17
|
import { getAccountConfig } from '@hubspot/local-dev-lib/config';
|
|
18
18
|
import SpinniesManager from '../../lib/ui/SpinniesManager.js';
|
|
@@ -20,7 +20,7 @@ import { logInvalidAccountError } from '../../lib/app/migrate.js';
|
|
|
20
20
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
21
21
|
import { uiDeprecatedTag, uiLine, uiAccountDescription, } from '../../lib/ui/index.js';
|
|
22
22
|
const command = 'clone-app';
|
|
23
|
-
const describe = uiDeprecatedTag(
|
|
23
|
+
const describe = uiDeprecatedTag(commands.project.cloneApp.describe, false);
|
|
24
24
|
const deprecated = true;
|
|
25
25
|
async function handler(args) {
|
|
26
26
|
const { derivedAccountId } = args;
|
|
@@ -28,7 +28,7 @@ async function handler(args) {
|
|
|
28
28
|
const accountConfig = getAccountConfig(derivedAccountId);
|
|
29
29
|
const accountName = uiAccountDescription(derivedAccountId);
|
|
30
30
|
if (!accountConfig) {
|
|
31
|
-
throw new Error(
|
|
31
|
+
throw new Error(commands.project.cloneApp.errors.noAccountConfig(derivedAccountId));
|
|
32
32
|
}
|
|
33
33
|
const defaultAccountIsUnified = await isUnifiedAccount(accountConfig);
|
|
34
34
|
if (!isAppDeveloperAccount(accountConfig) && !defaultAccountIsUnified) {
|
|
@@ -60,7 +60,7 @@ async function handler(args) {
|
|
|
60
60
|
try {
|
|
61
61
|
SpinniesManager.init();
|
|
62
62
|
SpinniesManager.add('cloneApp', {
|
|
63
|
-
text:
|
|
63
|
+
text: commands.project.cloneApp.cloneStatus.inProgress,
|
|
64
64
|
});
|
|
65
65
|
const { data: { exportId }, } = await cloneApp(derivedAccountId, appId);
|
|
66
66
|
const { status } = await poll(() => checkCloneStatus(derivedAccountId, exportId));
|
|
@@ -84,25 +84,23 @@ async function handler(args) {
|
|
|
84
84
|
};
|
|
85
85
|
const success = writeProjectConfig(configPath, configContent);
|
|
86
86
|
SpinniesManager.succeed('cloneApp', {
|
|
87
|
-
text:
|
|
87
|
+
text: commands.project.cloneApp.cloneStatus.done,
|
|
88
88
|
succeedColor: 'white',
|
|
89
89
|
});
|
|
90
90
|
if (!success) {
|
|
91
|
-
|
|
91
|
+
uiLogger.error(commands.project.cloneApp.errors.couldNotWriteConfigPath(configPath));
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
uiLogger.log('');
|
|
94
94
|
uiLine();
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}));
|
|
98
|
-
logger.log('');
|
|
95
|
+
uiLogger.success(commands.project.cloneApp.cloneStatus.success(projectDest));
|
|
96
|
+
uiLogger.log('');
|
|
99
97
|
process.exit(EXIT_CODES.SUCCESS);
|
|
100
98
|
}
|
|
101
99
|
}
|
|
102
100
|
catch (error) {
|
|
103
101
|
await trackCommandMetadataUsage('clone-app', { successful: false }, derivedAccountId);
|
|
104
102
|
SpinniesManager.fail('cloneApp', {
|
|
105
|
-
text:
|
|
103
|
+
text: commands.project.cloneApp.cloneStatus.failure,
|
|
106
104
|
failColor: 'white',
|
|
107
105
|
});
|
|
108
106
|
// Migrations endpoints return a response object with an errors property. The errors property contains an array of errors.
|
|
@@ -122,19 +120,16 @@ async function handler(args) {
|
|
|
122
120
|
function cloneAppBuilder(yargs) {
|
|
123
121
|
yargs.options({
|
|
124
122
|
dest: {
|
|
125
|
-
describe:
|
|
123
|
+
describe: commands.project.cloneApp.options.dest.describe,
|
|
126
124
|
type: 'string',
|
|
127
125
|
},
|
|
128
126
|
'app-id': {
|
|
129
|
-
describe:
|
|
127
|
+
describe: commands.project.cloneApp.options.appId.describe,
|
|
130
128
|
type: 'number',
|
|
131
129
|
},
|
|
132
130
|
});
|
|
133
131
|
yargs.example([
|
|
134
|
-
[
|
|
135
|
-
'$0 project clone-app',
|
|
136
|
-
i18n(`commands.project.subcommands.cloneApp.examples.default`),
|
|
137
|
-
],
|
|
132
|
+
['$0 project clone-app', commands.project.cloneApp.examples.default],
|
|
138
133
|
]);
|
|
139
134
|
return yargs;
|
|
140
135
|
}
|
|
@@ -5,7 +5,7 @@ import { getCwd } from '@hubspot/local-dev-lib/path';
|
|
|
5
5
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
6
6
|
import { writeProjectConfig, getProjectConfig, } from '../../lib/projects/config.js';
|
|
7
7
|
import { EMPTY_PROJECT_TEMPLATE_NAME } from '../../lib/projects/create/legacy.js';
|
|
8
|
-
import { generateComponentPaths } from '../../lib/projects/create/
|
|
8
|
+
import { generateComponentPaths } from '../../lib/projects/create/v2.js';
|
|
9
9
|
import { PROJECT_WITH_APP, EMPTY_PROJECT } from '../../lib/constants.js';
|
|
10
10
|
import { uiFeatureHighlight } from '../../lib/ui/index.js';
|
|
11
11
|
import { debugError, logError } from '../../lib/errorHandlers/index.js';
|
|
@@ -97,7 +97,6 @@ async function handler(args) {
|
|
|
97
97
|
'projectInstallDepsCommand',
|
|
98
98
|
'projectHelpCommand',
|
|
99
99
|
'feedbackCommand',
|
|
100
|
-
'sampleProjects',
|
|
101
100
|
]);
|
|
102
101
|
process.exit(EXIT_CODES.SUCCESS);
|
|
103
102
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fetchProject } from '@hubspot/local-dev-lib/api/projects';
|
|
2
2
|
import { getAccountConfig } from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
4
|
-
import {
|
|
4
|
+
import { isV2Project } from '../../lib/projects/platformVersion.js';
|
|
5
5
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
6
6
|
import { logError, ApiErrorContext } from '../../lib/errorHandlers/index.js';
|
|
7
7
|
import { getProjectConfig } from '../../lib/projects/config.js';
|
|
@@ -24,7 +24,7 @@ async function handler(args) {
|
|
|
24
24
|
let targetAccountId;
|
|
25
25
|
const jsonOutput = {};
|
|
26
26
|
const { projectConfig, projectDir } = await getProjectConfig();
|
|
27
|
-
if (
|
|
27
|
+
if (isV2Project(projectConfig?.platformVersion)) {
|
|
28
28
|
if (args.profile) {
|
|
29
29
|
logProfileHeader(args.profile);
|
|
30
30
|
const profile = loadProfile(projectConfig, projectDir, args.profile);
|
|
@@ -87,7 +87,7 @@ async function handler(args) {
|
|
|
87
87
|
uiLogger.error(commands.project.deploy.errors.noBuildId);
|
|
88
88
|
return process.exit(EXIT_CODES.ERROR);
|
|
89
89
|
}
|
|
90
|
-
const deployResult = await handleProjectDeploy(targetAccountId, projectName, buildIdToDeploy,
|
|
90
|
+
const deployResult = await handleProjectDeploy(targetAccountId, projectName, buildIdToDeploy, isV2Project(projectConfig?.platformVersion), forceOption);
|
|
91
91
|
if (!deployResult) {
|
|
92
92
|
return process.exit(EXIT_CODES.ERROR);
|
|
93
93
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
1
|
import { getAccountConfig, getConfigAccounts, getEnv, } from '@hubspot/local-dev-lib/config';
|
|
3
2
|
import { getValidEnv } from '@hubspot/local-dev-lib/environment';
|
|
4
3
|
import { findProjectComponents, getProjectComponentTypes, } from '../../../lib/projects/structure.js';
|
|
5
4
|
import { ComponentTypes } from '../../../types/Projects.js';
|
|
6
|
-
import {
|
|
5
|
+
import { commands } from '../../../lang/en.js';
|
|
6
|
+
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
7
7
|
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
8
|
-
import { uiCommandReference } from '../../../lib/ui/index.js';
|
|
9
8
|
import SpinniesManager from '../../../lib/ui/SpinniesManager.js';
|
|
10
|
-
import
|
|
9
|
+
import LocalDevManager_DEPRECATED from '../../../lib/projects/localDev/LocalDevManager_DEPRECATED.js';
|
|
11
10
|
import { confirmDefaultAccountIsTarget, suggestRecommendedNestedAccount, checkIfAccountFlagIsSupported, checkIfDefaultAccountIsSupported, createSandboxForLocalDev, createDeveloperTestAccountForLocalDev, useExistingDevTestAccount, checkIfParentAccountIsAuthed, hasSandboxes, } from '../../../lib/projects/localDev/helpers/account.js';
|
|
12
11
|
import { createInitialBuildForNewProject, createNewProjectForLocalDev, } from '../../../lib/projects/localDev/helpers/project.js';
|
|
13
12
|
import { handleExit } from '../../../lib/process.js';
|
|
@@ -23,28 +22,20 @@ export async function deprecatedProjectDevFlow({ args, accountId, projectConfig,
|
|
|
23
22
|
const hasPublicApps = !!componentTypes[ComponentTypes.PublicApp];
|
|
24
23
|
const accountConfig = getAccountConfig(accountId);
|
|
25
24
|
if (!accountConfig) {
|
|
26
|
-
|
|
27
|
-
accountId: accountId,
|
|
28
|
-
authCommand: uiCommandReference('hs auth'),
|
|
29
|
-
}));
|
|
25
|
+
uiLogger.error(commands.project.dev.errors.noAccount(accountId));
|
|
30
26
|
process.exit(EXIT_CODES.ERROR);
|
|
31
27
|
}
|
|
32
28
|
if (runnableComponents.length === 0) {
|
|
33
|
-
|
|
34
|
-
projectDir,
|
|
35
|
-
command: uiCommandReference('hs project add'),
|
|
36
|
-
}));
|
|
29
|
+
uiLogger.error(commands.project.dev.errors.noRunnableComponents);
|
|
37
30
|
process.exit(EXIT_CODES.SUCCESS);
|
|
38
31
|
}
|
|
39
32
|
else if (hasPrivateApps && hasPublicApps) {
|
|
40
|
-
|
|
33
|
+
uiLogger.error(commands.project.dev.errors.invalidProjectComponents);
|
|
41
34
|
process.exit(EXIT_CODES.SUCCESS);
|
|
42
35
|
}
|
|
43
36
|
const accounts = getConfigAccounts();
|
|
44
37
|
if (!accounts) {
|
|
45
|
-
|
|
46
|
-
authCommand: uiCommandReference('hs auth'),
|
|
47
|
-
}));
|
|
38
|
+
uiLogger.error(commands.project.dev.errors.noAccountsInConfig);
|
|
48
39
|
process.exit(EXIT_CODES.ERROR);
|
|
49
40
|
}
|
|
50
41
|
let bypassRecommendedAccountPrompt = false;
|
|
@@ -110,7 +101,7 @@ export async function deprecatedProjectDevFlow({ args, accountId, projectConfig,
|
|
|
110
101
|
targetProjectAccountId = derivedAccountId;
|
|
111
102
|
}
|
|
112
103
|
if (!targetProjectAccountId || !targetTestingAccountId) {
|
|
113
|
-
|
|
104
|
+
uiLogger.error(commands.project.dev.errors.noAccount(accountId));
|
|
114
105
|
process.exit(EXIT_CODES.ERROR);
|
|
115
106
|
}
|
|
116
107
|
// eslint-disable-next-line prefer-const
|
|
@@ -130,7 +121,7 @@ export async function deprecatedProjectDevFlow({ args, accountId, projectConfig,
|
|
|
130
121
|
project = await createNewProjectForLocalDev(projectConfig, targetProjectAccountId, createNewSandbox, hasPublicApps);
|
|
131
122
|
deployedBuild = await createInitialBuildForNewProject(projectConfig, projectDir, targetProjectAccountId);
|
|
132
123
|
}
|
|
133
|
-
const LocalDev = new
|
|
124
|
+
const LocalDev = new LocalDevManager_DEPRECATED({
|
|
134
125
|
runnableComponents,
|
|
135
126
|
debug: args.debug,
|
|
136
127
|
deployedBuild,
|