@hubspot/cli 8.1.0 → 8.1.2-experimental.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/api/migrate.js +8 -4
- package/api/releases.d.ts +36 -0
- package/api/releases.js +41 -0
- package/bin/cli.js +12 -6
- package/commands/account/auth.js +7 -7
- package/commands/account/clean.js +7 -6
- package/commands/account/createOverride.js +10 -7
- package/commands/account/info.js +36 -17
- package/commands/account/link.d.ts +4 -0
- package/commands/account/link.js +89 -0
- package/commands/account/list.js +32 -76
- package/commands/account/remove.js +4 -3
- package/commands/account/removeOverride.js +11 -10
- package/commands/account/rename.js +5 -6
- package/commands/account/unlink.d.ts +4 -0
- package/commands/account/unlink.js +70 -0
- package/commands/account/use.js +75 -6
- package/commands/account.js +4 -0
- package/commands/api.d.ts +10 -0
- package/commands/api.js +164 -0
- package/commands/app/migrate.js +13 -13
- package/commands/app/secret/add.js +6 -7
- package/commands/app/secret/delete.js +9 -10
- package/commands/app/secret/list.js +6 -7
- package/commands/app/secret/update.js +8 -9
- package/commands/auth.js +19 -15
- package/commands/cms/app/create.js +9 -5
- package/commands/cms/convertFields.js +8 -8
- package/commands/cms/delete.js +2 -3
- package/commands/cms/fetch.js +7 -7
- package/commands/cms/function/create.js +9 -5
- package/commands/cms/function/deploy.js +2 -3
- package/commands/cms/function/list.js +11 -7
- package/commands/cms/function/logs.js +17 -22
- package/commands/cms/function/server.js +2 -3
- package/commands/cms/getReactModule.js +7 -8
- package/commands/cms/lighthouseScore.js +25 -24
- package/commands/cms/lint.js +4 -5
- package/commands/cms/list.js +5 -6
- package/commands/cms/module/create.js +14 -5
- package/commands/cms/module/marketplace-validate.js +7 -8
- package/commands/cms/mv.js +2 -3
- package/commands/cms/template/create.js +10 -6
- package/commands/cms/theme/create.js +5 -5
- package/commands/cms/theme/generate-selectors.js +5 -4
- package/commands/cms/theme/marketplace-validate.js +8 -9
- package/commands/cms/theme/preview.js +23 -70
- package/commands/cms/upload.js +15 -12
- package/commands/cms/watch.d.ts +0 -1
- package/commands/cms/watch.js +6 -12
- package/commands/cms/webpack/create.js +5 -5
- package/commands/completion.js +3 -5
- package/commands/config/migrate.js +6 -7
- package/commands/config/set.js +5 -6
- package/commands/customObject/create.js +4 -5
- package/commands/customObject/createSchema.js +4 -5
- package/commands/customObject/deleteSchema.js +4 -5
- package/commands/customObject/fetchAllSchemas.js +2 -3
- package/commands/customObject/fetchSchema.js +2 -3
- package/commands/customObject/listSchemas.js +2 -3
- package/commands/customObject/updateSchema.js +4 -5
- package/commands/doctor.js +8 -8
- package/commands/feedback.js +7 -5
- package/commands/filemanager/fetch.js +5 -6
- package/commands/filemanager/upload.js +5 -5
- package/commands/getStarted.js +17 -19
- package/commands/hubdb/clear.js +6 -3
- package/commands/hubdb/create.js +4 -5
- package/commands/hubdb/delete.js +9 -6
- package/commands/hubdb/fetch.js +6 -3
- package/commands/hubdb/list.js +16 -14
- package/commands/init.js +15 -14
- package/commands/mcp/setup.js +5 -14
- package/commands/mcp/start.js +2 -4
- package/commands/open.js +4 -5
- package/commands/project/add.js +13 -8
- package/commands/project/appInstallStatus.d.ts +4 -0
- package/commands/project/appInstallStatus.js +132 -0
- package/commands/project/create.js +28 -17
- package/commands/project/delete.d.ts +7 -0
- package/commands/project/delete.js +74 -0
- package/commands/project/deploy.js +39 -36
- package/commands/project/dev/deprecatedFlow.js +62 -17
- package/commands/project/dev/index.d.ts +3 -3
- package/commands/project/dev/index.js +59 -48
- package/commands/project/dev/unifiedFlow.js +70 -21
- package/commands/project/download.js +12 -9
- package/commands/project/info.d.ts +4 -0
- package/commands/project/info.js +67 -0
- package/commands/project/installDeps.js +9 -6
- package/commands/project/lint.js +33 -10
- package/commands/project/list.d.ts +2 -2
- package/commands/project/list.js +15 -14
- package/commands/project/listBuilds.js +8 -6
- package/commands/project/logs.js +5 -6
- package/commands/project/migrate.js +18 -18
- package/commands/project/open.js +5 -6
- package/commands/project/profile/add.js +12 -8
- package/commands/project/profile/delete.js +15 -11
- package/commands/project/updateDeps.js +9 -6
- package/commands/project/upload.d.ts +3 -0
- package/commands/project/upload.js +98 -25
- package/commands/project/validate.js +12 -12
- package/commands/project/watch.js +32 -19
- package/commands/project.js +12 -3
- package/commands/sandbox/create.js +18 -45
- package/commands/sandbox/delete.js +13 -14
- package/commands/secret/addSecret.js +6 -7
- package/commands/secret/deleteSecret.js +5 -6
- package/commands/secret/listSecret.js +2 -3
- package/commands/secret/updateSecret.js +4 -5
- package/commands/testAccount/create.d.ts +1 -1
- package/commands/testAccount/create.js +25 -17
- package/commands/testAccount/createConfig.js +7 -8
- package/commands/testAccount/delete.js +27 -18
- package/commands/testAccount/importData.js +6 -7
- package/commands/upgrade.js +9 -10
- package/lang/en.d.ts +276 -14
- package/lang/en.js +293 -28
- package/lib/accountAuth.js +4 -0
- package/lib/api/usageTracking.d.ts +29 -0
- package/lib/api/usageTracking.js +28 -0
- package/lib/app/migrate.js +18 -5
- package/lib/buildAccount.d.ts +1 -6
- package/lib/buildAccount.js +9 -42
- package/lib/commandSuggestion.js +1 -7
- package/lib/constants.d.ts +3 -4
- package/lib/constants.js +5 -4
- package/lib/doctor/Diagnosis.js +5 -5
- package/lib/doctor/Doctor.js +7 -7
- package/lib/errorHandlers/index.js +4 -3
- package/lib/errorHandlers/suppressError.js +4 -0
- package/lib/errors/PromptExitError.d.ts +6 -0
- package/lib/errors/PromptExitError.js +11 -0
- package/lib/generateSelectors.js +1 -2
- package/lib/getStartedV2Actions.d.ts +13 -0
- package/lib/getStartedV2Actions.js +56 -3
- package/lib/hasFeature.js +1 -2
- package/lib/link/accountTableUtils.d.ts +10 -0
- package/lib/link/accountTableUtils.js +39 -0
- package/lib/link/index.d.ts +18 -0
- package/lib/link/index.js +185 -0
- package/lib/link/linkUtils.d.ts +5 -0
- package/lib/link/linkUtils.js +49 -0
- package/lib/link/prompts.d.ts +7 -0
- package/lib/link/prompts.js +126 -0
- package/lib/link/renderLinkedAccountsTable.d.ts +2 -0
- package/lib/link/renderLinkedAccountsTable.js +14 -0
- package/lib/link/warnIfLinkedDirectory.d.ts +1 -0
- package/lib/link/warnIfLinkedDirectory.js +9 -0
- package/lib/mcp/setup.d.ts +1 -0
- package/lib/mcp/setup.js +77 -30
- package/lib/middleware/autoUpdateMiddleware.js +6 -3
- package/lib/process.d.ts +1 -1
- package/lib/process.js +10 -3
- package/lib/projects/ProjectLogsManager.js +6 -3
- package/lib/projects/components.js +15 -4
- package/lib/projects/create/index.js +3 -6
- package/lib/projects/create/legacy.js +5 -10
- package/lib/projects/create/v2.js +5 -14
- package/lib/projects/delete.d.ts +13 -0
- package/lib/projects/delete.js +193 -0
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/ensureProjectExists.js +1 -2
- package/lib/projects/localDev/AppDevModeInterface.js +13 -9
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +4 -1
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +3 -3
- package/lib/projects/localDev/DevSessionManager.d.ts +6 -3
- package/lib/projects/localDev/DevSessionManager.js +31 -19
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.d.ts +5 -0
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +21 -10
- package/lib/projects/localDev/LocalDevProcess.js +6 -5
- package/lib/projects/localDev/LocalDevState.d.ts +3 -2
- package/lib/projects/localDev/LocalDevState.js +3 -1
- package/lib/projects/localDev/helpers/account.d.ts +4 -3
- package/lib/projects/localDev/helpers/account.js +21 -30
- package/lib/projects/localDev/helpers/process.d.ts +1 -1
- package/lib/projects/localDev/helpers/process.js +4 -10
- package/lib/projects/localDev/helpers/project.d.ts +4 -3
- package/lib/projects/localDev/helpers/project.js +32 -16
- package/lib/projects/npmAuditOnUpload.d.ts +10 -0
- package/lib/projects/npmAuditOnUpload.js +73 -0
- package/lib/projects/pollProjectBuildAndDeploy.d.ts +5 -1
- package/lib/projects/pollProjectBuildAndDeploy.js +93 -87
- package/lib/projects/preview.d.ts +7 -0
- package/lib/projects/preview.js +48 -0
- package/lib/projects/projectInfo.d.ts +5 -0
- package/lib/projects/projectInfo.js +82 -0
- package/lib/projects/projectProfiles.d.ts +1 -2
- package/lib/projects/projectProfiles.js +5 -17
- package/lib/projects/uieLinting.d.ts +17 -3
- package/lib/projects/uieLinting.js +93 -28
- package/lib/projects/upload.d.ts +4 -1
- package/lib/projects/upload.js +71 -50
- package/lib/projects/watch.d.ts +2 -1
- package/lib/projects/watch.js +32 -24
- package/lib/projects/workspaces.d.ts +52 -0
- package/lib/projects/workspaces.js +365 -0
- package/lib/prompts/createApiSamplePrompt.js +4 -0
- package/lib/prompts/downloadProjectPrompt.js +11 -10
- package/lib/prompts/installAppPrompt.js +3 -2
- package/lib/prompts/personalAccessKeyPrompt.js +3 -2
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +1 -0
- package/lib/prompts/projectDevTargetAccountPrompt.js +23 -16
- package/lib/prompts/projectProfilePrompt.d.ts +2 -0
- package/lib/prompts/projectProfilePrompt.js +46 -0
- package/lib/prompts/projectsLogsPrompt.js +3 -0
- package/lib/prompts/promptUtils.js +4 -2
- package/lib/prompts/selectHubDBTablePrompt.js +8 -4
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +12 -6
- package/lib/sandboxes.d.ts +1 -9
- package/lib/sandboxes.js +0 -21
- package/lib/serverlessLogs.js +50 -44
- package/lib/theme/cmsDevServerProcess.d.ts +14 -0
- package/lib/theme/cmsDevServerProcess.js +149 -0
- package/lib/theme/cmsDevServerRunner.d.ts +14 -0
- package/lib/theme/cmsDevServerRunner.js +90 -0
- package/lib/theme/migrate.d.ts +1 -1
- package/lib/theme/migrate.js +1 -5
- package/lib/ui/SpinniesManager.d.ts +1 -0
- package/lib/ui/SpinniesManager.js +22 -6
- package/lib/ui/accountTable.d.ts +8 -0
- package/lib/ui/accountTable.js +67 -0
- package/lib/ui/spinniesUtils.d.ts +0 -1
- package/lib/ui/spinniesUtils.js +6 -16
- package/lib/usageTracking.d.ts +9 -20
- package/lib/usageTracking.js +51 -34
- package/lib/yargs/makeWrappedYargsHandler.d.ts +3 -0
- package/lib/yargs/makeWrappedYargsHandler.js +121 -0
- package/lib/yargs/makeYargsBuilder.d.ts +13 -0
- package/lib/yargs/makeYargsBuilder.js +33 -0
- package/lib/yargs/parseYargsOrExit.d.ts +4 -0
- package/lib/yargs/parseYargsOrExit.js +25 -0
- package/lib/yargs/strictEnforceBoolean.d.ts +1 -0
- package/lib/yargs/strictEnforceBoolean.js +13 -0
- package/lib/yargsUtils.d.ts +3 -16
- package/lib/yargsUtils.js +3 -48
- package/mcp-server/Tool.d.ts +15 -0
- package/mcp-server/Tool.js +53 -0
- package/mcp-server/server.js +43 -3
- package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +11 -9
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.js +12 -11
- package/mcp-server/tools/cms/HsCreateTemplateTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +11 -9
- package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +10 -9
- package/mcp-server/tools/cms/HsListFunctionsTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +10 -9
- package/mcp-server/tools/cms/HsListTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsListTool.js +11 -9
- package/mcp-server/tools/index.d.ts +3 -2
- package/mcp-server/tools/index.js +24 -22
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +25 -5
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +16 -18
- package/mcp-server/tools/project/CreateProjectTool.d.ts +29 -6
- package/mcp-server/tools/project/CreateProjectTool.js +16 -18
- package/mcp-server/tools/project/CreateTestAccountTool.d.ts +4 -2
- package/mcp-server/tools/project/CreateTestAccountTool.js +22 -10
- package/mcp-server/tools/project/DeployProjectTool.d.ts +4 -2
- package/mcp-server/tools/project/DeployProjectTool.js +6 -8
- package/mcp-server/tools/project/DocFetchTool.d.ts +4 -2
- package/mcp-server/tools/project/DocFetchTool.js +8 -6
- package/mcp-server/tools/project/DocsSearchTool.d.ts +9 -3
- package/mcp-server/tools/project/DocsSearchTool.js +32 -9
- package/mcp-server/tools/project/FindProjectsTool.d.ts +15 -0
- package/mcp-server/tools/project/FindProjectsTool.js +60 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +4 -2
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +13 -14
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +4 -2
- package/mcp-server/tools/project/GetApplicationInfoTool.js +8 -6
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +6 -4
- package/mcp-server/tools/project/GetBuildLogsTool.js +15 -14
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +5 -3
- package/mcp-server/tools/project/GetBuildStatusTool.js +12 -11
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +4 -2
- package/mcp-server/tools/project/GetConfigValuesTool.js +12 -7
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +10 -3
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +5 -12
- package/mcp-server/tools/project/UploadProjectTools.d.ts +4 -2
- package/mcp-server/tools/project/UploadProjectTools.js +11 -9
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +4 -2
- package/mcp-server/tools/project/ValidateProjectTool.js +10 -8
- package/mcp-server/tools/project/constants.d.ts +13 -1
- package/mcp-server/tools/project/constants.js +13 -16
- package/mcp-server/types.d.ts +0 -7
- package/mcp-server/types.js +1 -13
- package/mcp-server/utils/command.d.ts +5 -0
- package/mcp-server/utils/command.js +24 -0
- package/mcp-server/utils/feedbackTracking.js +2 -17
- package/mcp-server/utils/logger.d.ts +10 -0
- package/mcp-server/utils/logger.js +29 -0
- package/mcp-server/utils/toolUsageTracking.js +10 -8
- package/package.json +15 -11
- package/types/Link.d.ts +32 -0
- package/types/Link.js +5 -0
- package/types/LocalDev.d.ts +5 -0
- package/types/PackageJson.d.ts +1 -0
- package/types/Projects.d.ts +19 -0
- package/types/Prompts.d.ts +1 -0
- package/types/Yargs.d.ts +19 -1
- package/ui/components/getStarted/GetStartedFlow.js +79 -2
- package/ui/components/getStarted/reducer.d.ts +20 -0
- package/ui/components/getStarted/reducer.js +36 -0
- package/ui/components/getStarted/screens/InstallationScreen.d.ts +7 -0
- package/ui/components/getStarted/screens/InstallationScreen.js +16 -0
- package/ui/components/getStarted/screens/ProjectSetupScreen.js +2 -1
- package/ui/lib/constants.d.ts +1 -0
- package/ui/lib/constants.js +1 -0
- package/api/__tests__/migrate.test.d.ts +0 -1
- package/api/__tests__/migrate.test.js +0 -199
- package/commands/__tests__/account.test.d.ts +0 -1
- package/commands/__tests__/account.test.js +0 -69
- package/commands/__tests__/auth.test.d.ts +0 -1
- package/commands/__tests__/auth.test.js +0 -43
- package/commands/__tests__/cms.test.d.ts +0 -1
- package/commands/__tests__/cms.test.js +0 -87
- package/commands/__tests__/config.test.d.ts +0 -1
- package/commands/__tests__/config.test.js +0 -44
- package/commands/__tests__/customObject.test.d.ts +0 -1
- package/commands/__tests__/customObject.test.js +0 -68
- package/commands/__tests__/doctor.test.d.ts +0 -1
- package/commands/__tests__/doctor.test.js +0 -132
- package/commands/__tests__/feedback.test.d.ts +0 -1
- package/commands/__tests__/feedback.test.js +0 -24
- package/commands/__tests__/filemanager.test.d.ts +0 -1
- package/commands/__tests__/filemanager.test.js +0 -45
- package/commands/__tests__/getStarted.test.d.ts +0 -1
- package/commands/__tests__/getStarted.test.js +0 -173
- package/commands/__tests__/hubdb.test.d.ts +0 -1
- package/commands/__tests__/hubdb.test.js +0 -50
- package/commands/__tests__/init.test.d.ts +0 -1
- package/commands/__tests__/init.test.js +0 -42
- package/commands/__tests__/mcp.test.d.ts +0 -1
- package/commands/__tests__/mcp.test.js +0 -46
- package/commands/__tests__/open.test.d.ts +0 -1
- package/commands/__tests__/open.test.js +0 -58
- package/commands/__tests__/project.test.d.ts +0 -1
- package/commands/__tests__/project.test.js +0 -125
- package/commands/__tests__/sandbox.test.d.ts +0 -1
- package/commands/__tests__/sandbox.test.js +0 -44
- package/commands/__tests__/secret.test.d.ts +0 -1
- package/commands/__tests__/secret.test.js +0 -49
- package/commands/__tests__/testAccount.test.d.ts +0 -1
- package/commands/__tests__/testAccount.test.js +0 -57
- package/commands/__tests__/upgrade.test.d.ts +0 -1
- package/commands/__tests__/upgrade.test.js +0 -309
- package/commands/account/__tests__/auth.test.d.ts +0 -1
- package/commands/account/__tests__/auth.test.js +0 -206
- package/commands/account/__tests__/clean.test.d.ts +0 -1
- package/commands/account/__tests__/clean.test.js +0 -28
- package/commands/account/__tests__/createOverride.test.d.ts +0 -1
- package/commands/account/__tests__/createOverride.test.js +0 -32
- package/commands/account/__tests__/info.test.d.ts +0 -1
- package/commands/account/__tests__/info.test.js +0 -28
- package/commands/account/__tests__/list.test.d.ts +0 -1
- package/commands/account/__tests__/list.test.js +0 -153
- package/commands/account/__tests__/remove.test.d.ts +0 -1
- package/commands/account/__tests__/remove.test.js +0 -36
- package/commands/account/__tests__/removeOverride.d.ts +0 -1
- package/commands/account/__tests__/removeOverride.js +0 -25
- package/commands/account/__tests__/rename.test.d.ts +0 -1
- package/commands/account/__tests__/rename.test.js +0 -82
- package/commands/account/__tests__/use.test.d.ts +0 -1
- package/commands/account/__tests__/use.test.js +0 -170
- package/commands/app/__tests__/migrate.test.d.ts +0 -1
- package/commands/app/__tests__/migrate.test.js +0 -111
- package/commands/app/secret/__tests__/add.test.d.ts +0 -1
- package/commands/app/secret/__tests__/add.test.js +0 -140
- package/commands/app/secret/__tests__/delete.test.d.ts +0 -1
- package/commands/app/secret/__tests__/delete.test.js +0 -28
- package/commands/app/secret/__tests__/list.test.d.ts +0 -1
- package/commands/app/secret/__tests__/list.test.js +0 -25
- package/commands/app/secret/__tests__/update.test.d.ts +0 -1
- package/commands/app/secret/__tests__/update.test.js +0 -28
- package/commands/cms/__tests__/delete.test.d.ts +0 -1
- package/commands/cms/__tests__/delete.test.js +0 -39
- package/commands/cms/__tests__/fetch.test.d.ts +0 -1
- package/commands/cms/__tests__/fetch.test.js +0 -156
- package/commands/cms/__tests__/function.test.d.ts +0 -1
- package/commands/cms/__tests__/function.test.js +0 -50
- package/commands/cms/__tests__/lint.test.d.ts +0 -1
- package/commands/cms/__tests__/lint.test.js +0 -33
- package/commands/cms/__tests__/list.test.d.ts +0 -1
- package/commands/cms/__tests__/list.test.js +0 -42
- package/commands/cms/__tests__/module.test.d.ts +0 -1
- package/commands/cms/__tests__/module.test.js +0 -45
- package/commands/cms/__tests__/mv.test.d.ts +0 -1
- package/commands/cms/__tests__/mv.test.js +0 -46
- package/commands/cms/__tests__/theme.test.d.ts +0 -1
- package/commands/cms/__tests__/theme.test.js +0 -54
- package/commands/cms/__tests__/upload.test.d.ts +0 -1
- package/commands/cms/__tests__/upload.test.js +0 -308
- package/commands/cms/__tests__/watch.test.d.ts +0 -1
- package/commands/cms/__tests__/watch.test.js +0 -212
- package/commands/cms/function/__tests__/logs.test.d.ts +0 -1
- package/commands/cms/function/__tests__/logs.test.js +0 -70
- package/commands/cms/theme/__tests__/generate-selectors.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/generate-selectors.test.js +0 -28
- package/commands/cms/theme/__tests__/marketplace-validate.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/marketplace-validate.test.js +0 -36
- package/commands/cms/theme/__tests__/preview.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/preview.test.js +0 -54
- package/commands/customObject/__tests__/create.test.d.ts +0 -1
- package/commands/customObject/__tests__/create.test.js +0 -40
- package/commands/customObject/__tests__/createSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/createSchema.test.js +0 -28
- package/commands/customObject/__tests__/deleteSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/deleteSchema.test.js +0 -42
- package/commands/customObject/__tests__/fetch-all-schemas.test.d.ts +0 -1
- package/commands/customObject/__tests__/fetch-all-schemas.test.js +0 -41
- package/commands/customObject/__tests__/fetchSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/fetchSchema.test.js +0 -45
- package/commands/customObject/__tests__/listSchemas.test.d.ts +0 -1
- package/commands/customObject/__tests__/listSchemas.test.js +0 -29
- package/commands/customObject/__tests__/updateSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/updateSchema.test.js +0 -40
- package/commands/filemanager/__tests__/fetch.test.d.ts +0 -1
- package/commands/filemanager/__tests__/fetch.test.js +0 -32
- package/commands/filemanager/__tests__/upload.test.d.ts +0 -1
- package/commands/filemanager/__tests__/upload.test.js +0 -191
- package/commands/hubdb/__tests__/clear.test.d.ts +0 -1
- package/commands/hubdb/__tests__/clear.test.js +0 -28
- package/commands/hubdb/__tests__/create.test.d.ts +0 -1
- package/commands/hubdb/__tests__/create.test.js +0 -28
- package/commands/hubdb/__tests__/delete.test.d.ts +0 -1
- package/commands/hubdb/__tests__/delete.test.js +0 -28
- package/commands/hubdb/__tests__/fetch.test.d.ts +0 -1
- package/commands/hubdb/__tests__/fetch.test.js +0 -28
- package/commands/hubdb/__tests__/list.test.d.ts +0 -1
- package/commands/hubdb/__tests__/list.test.js +0 -88
- package/commands/mcp/__tests__/setup.test.d.ts +0 -1
- package/commands/mcp/__tests__/setup.test.js +0 -26
- package/commands/mcp/__tests__/start.test.d.ts +0 -1
- package/commands/mcp/__tests__/start.test.js +0 -137
- package/commands/project/__tests__/add.test.d.ts +0 -1
- package/commands/project/__tests__/add.test.js +0 -107
- package/commands/project/__tests__/create.test.d.ts +0 -1
- package/commands/project/__tests__/create.test.js +0 -97
- package/commands/project/__tests__/deploy.test.d.ts +0 -1
- package/commands/project/__tests__/deploy.test.js +0 -307
- package/commands/project/__tests__/dev.test.d.ts +0 -1
- package/commands/project/__tests__/dev.test.js +0 -273
- package/commands/project/__tests__/devUnifiedFlow.test.d.ts +0 -1
- package/commands/project/__tests__/devUnifiedFlow.test.js +0 -434
- package/commands/project/__tests__/download.test.d.ts +0 -1
- package/commands/project/__tests__/download.test.js +0 -39
- package/commands/project/__tests__/installDeps.test.d.ts +0 -1
- package/commands/project/__tests__/installDeps.test.js +0 -140
- package/commands/project/__tests__/lint.test.d.ts +0 -1
- package/commands/project/__tests__/lint.test.js +0 -704
- package/commands/project/__tests__/list.test.d.ts +0 -1
- package/commands/project/__tests__/list.test.js +0 -31
- package/commands/project/__tests__/listBuilds.test.d.ts +0 -1
- package/commands/project/__tests__/listBuilds.test.js +0 -38
- package/commands/project/__tests__/logs.test.d.ts +0 -1
- package/commands/project/__tests__/logs.test.js +0 -202
- package/commands/project/__tests__/migrate.test.d.ts +0 -1
- package/commands/project/__tests__/migrate.test.js +0 -106
- package/commands/project/__tests__/open.test.d.ts +0 -1
- package/commands/project/__tests__/open.test.js +0 -39
- package/commands/project/__tests__/profile.test.d.ts +0 -1
- package/commands/project/__tests__/profile.test.js +0 -42
- package/commands/project/__tests__/updateDeps.test.d.ts +0 -1
- package/commands/project/__tests__/updateDeps.test.js +0 -140
- package/commands/project/__tests__/upload.test.d.ts +0 -1
- package/commands/project/__tests__/upload.test.js +0 -234
- package/commands/project/__tests__/validate.test.d.ts +0 -1
- package/commands/project/__tests__/validate.test.js +0 -381
- package/commands/project/__tests__/watch.test.d.ts +0 -1
- package/commands/project/__tests__/watch.test.js +0 -35
- package/commands/sandbox/__tests__/create.test.d.ts +0 -1
- package/commands/sandbox/__tests__/create.test.js +0 -245
- package/commands/sandbox/__tests__/delete.test.d.ts +0 -1
- package/commands/sandbox/__tests__/delete.test.js +0 -31
- package/commands/secret/__tests__/addSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/addSecret.test.js +0 -162
- package/commands/secret/__tests__/deleteSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/deleteSecret.test.js +0 -41
- package/commands/secret/__tests__/listSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/listSecret.test.js +0 -29
- package/commands/secret/__tests__/updateSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/updateSecret.test.js +0 -29
- package/commands/testAccount/__tests__/create.test.d.ts +0 -1
- package/commands/testAccount/__tests__/create.test.js +0 -106
- package/commands/testAccount/__tests__/createConfig.test.d.ts +0 -1
- package/commands/testAccount/__tests__/createConfig.test.js +0 -32
- package/commands/testAccount/__tests__/delete.test.d.ts +0 -1
- package/commands/testAccount/__tests__/delete.test.js +0 -29
- package/commands/testAccount/__tests__/importData.test.d.ts +0 -1
- package/commands/testAccount/__tests__/importData.test.js +0 -92
- package/lib/__tests__/CLIWebSocketServer.test.d.ts +0 -1
- package/lib/__tests__/CLIWebSocketServer.test.js +0 -252
- package/lib/__tests__/accountAuth.test.d.ts +0 -1
- package/lib/__tests__/accountAuth.test.js +0 -258
- package/lib/__tests__/accountTypes.test.d.ts +0 -1
- package/lib/__tests__/accountTypes.test.js +0 -98
- package/lib/__tests__/buildAccount.test.d.ts +0 -1
- package/lib/__tests__/buildAccount.test.js +0 -262
- package/lib/__tests__/cliUpgradeUtils.test.d.ts +0 -1
- package/lib/__tests__/cliUpgradeUtils.test.js +0 -131
- package/lib/__tests__/commandSuggestion.test.d.ts +0 -1
- package/lib/__tests__/commandSuggestion.test.js +0 -119
- package/lib/__tests__/commonOpts.test.d.ts +0 -1
- package/lib/__tests__/commonOpts.test.js +0 -80
- package/lib/__tests__/dependencyManagement.test.d.ts +0 -1
- package/lib/__tests__/dependencyManagement.test.js +0 -1067
- package/lib/__tests__/developerTestAccounts.test.d.ts +0 -1
- package/lib/__tests__/developerTestAccounts.test.js +0 -156
- package/lib/__tests__/hasFeature.test.d.ts +0 -1
- package/lib/__tests__/hasFeature.test.js +0 -167
- package/lib/__tests__/http.test.d.ts +0 -1
- package/lib/__tests__/http.test.js +0 -40
- package/lib/__tests__/importData.test.d.ts +0 -1
- package/lib/__tests__/importData.test.js +0 -98
- package/lib/__tests__/npmCli.test.d.ts +0 -1
- package/lib/__tests__/npmCli.test.js +0 -84
- package/lib/__tests__/oauth.test.d.ts +0 -1
- package/lib/__tests__/oauth.test.js +0 -109
- package/lib/__tests__/parsing.test.d.ts +0 -1
- package/lib/__tests__/parsing.test.js +0 -34
- package/lib/__tests__/polling.test.d.ts +0 -1
- package/lib/__tests__/polling.test.js +0 -76
- package/lib/__tests__/process.test.d.ts +0 -1
- package/lib/__tests__/process.test.js +0 -89
- package/lib/__tests__/sandboxSync.test.d.ts +0 -1
- package/lib/__tests__/sandboxSync.test.js +0 -147
- package/lib/__tests__/sandboxes.test.d.ts +0 -1
- package/lib/__tests__/sandboxes.test.js +0 -156
- package/lib/__tests__/serverlessLogs.test.d.ts +0 -1
- package/lib/__tests__/serverlessLogs.test.js +0 -148
- package/lib/__tests__/usageTracking.test.d.ts +0 -1
- package/lib/__tests__/usageTracking.test.js +0 -197
- package/lib/__tests__/validation.test.d.ts +0 -1
- package/lib/__tests__/validation.test.js +0 -143
- package/lib/__tests__/yargsUtils.test.d.ts +0 -1
- package/lib/__tests__/yargsUtils.test.js +0 -124
- package/lib/app/__tests__/migrate.test.d.ts +0 -1
- package/lib/app/__tests__/migrate.test.js +0 -638
- package/lib/doctor/__tests__/Diagnosis.test.d.ts +0 -1
- package/lib/doctor/__tests__/Diagnosis.test.js +0 -84
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.d.ts +0 -1
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +0 -177
- package/lib/doctor/__tests__/Doctor.test.d.ts +0 -1
- package/lib/doctor/__tests__/Doctor.test.js +0 -560
- package/lib/errorHandlers/__tests__/index.test.d.ts +0 -1
- package/lib/errorHandlers/__tests__/index.test.js +0 -278
- package/lib/mcp/__tests__/setup.test.d.ts +0 -1
- package/lib/mcp/__tests__/setup.test.js +0 -194
- package/lib/middleware/__tests__/commandTargetingUtils.test.d.ts +0 -1
- package/lib/middleware/__tests__/commandTargetingUtils.test.js +0 -99
- package/lib/middleware/__tests__/configMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/configMiddleware.test.js +0 -118
- package/lib/middleware/__tests__/gitMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/gitMiddleware.test.js +0 -43
- package/lib/middleware/__tests__/requestMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/requestMiddleware.test.js +0 -15
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.js +0 -44
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.js +0 -39
- package/lib/projects/__tests__/AppDevModeInterface.test.d.ts +0 -1
- package/lib/projects/__tests__/AppDevModeInterface.test.js +0 -541
- package/lib/projects/__tests__/DevServerManager.test.d.ts +0 -1
- package/lib/projects/__tests__/DevServerManager.test.js +0 -185
- package/lib/projects/__tests__/DevSessionManager.test.d.ts +0 -1
- package/lib/projects/__tests__/DevSessionManager.test.js +0 -250
- package/lib/projects/__tests__/LocalDevProcess.test.d.ts +0 -1
- package/lib/projects/__tests__/LocalDevProcess.test.js +0 -481
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.d.ts +0 -1
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +0 -231
- package/lib/projects/__tests__/ProjectLogsManager.test.d.ts +0 -1
- package/lib/projects/__tests__/ProjectLogsManager.test.js +0 -302
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +0 -1
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +0 -160
- package/lib/projects/__tests__/components.test.d.ts +0 -1
- package/lib/projects/__tests__/components.test.js +0 -426
- package/lib/projects/__tests__/deploy.test.d.ts +0 -1
- package/lib/projects/__tests__/deploy.test.js +0 -231
- package/lib/projects/__tests__/localDevProjectHelpers.test.d.ts +0 -1
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +0 -120
- package/lib/projects/__tests__/platformVersion.test.d.ts +0 -1
- package/lib/projects/__tests__/platformVersion.test.js +0 -63
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.d.ts +0 -1
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.js +0 -328
- package/lib/projects/__tests__/projectProfiles.test.d.ts +0 -1
- package/lib/projects/__tests__/projectProfiles.test.js +0 -441
- package/lib/projects/__tests__/projects.test.d.ts +0 -1
- package/lib/projects/__tests__/projects.test.js +0 -58
- package/lib/projects/__tests__/structure.test.d.ts +0 -1
- package/lib/projects/__tests__/structure.test.js +0 -210
- package/lib/projects/__tests__/uieLinting.test.d.ts +0 -1
- package/lib/projects/__tests__/uieLinting.test.js +0 -631
- package/lib/projects/__tests__/upload.test.d.ts +0 -1
- package/lib/projects/__tests__/upload.test.js +0 -183
- package/lib/projects/add/__tests__/legacyAddComponent.test.d.ts +0 -1
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +0 -245
- package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +0 -1
- package/lib/projects/add/__tests__/v2AddComponent.test.js +0 -343
- package/lib/projects/create/__tests__/legacy.test.d.ts +0 -1
- package/lib/projects/create/__tests__/legacy.test.js +0 -90
- package/lib/projects/create/__tests__/v2.test.d.ts +0 -1
- package/lib/projects/create/__tests__/v2.test.js +0 -257
- package/lib/projects/platformVersion.d.ts +0 -9
- package/lib/projects/platformVersion.js +0 -39
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.js +0 -157
- package/lib/prompts/__tests__/createFunctionPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createFunctionPrompt.test.js +0 -129
- package/lib/prompts/__tests__/createModulePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createModulePrompt.test.js +0 -187
- package/lib/prompts/__tests__/createTemplatePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createTemplatePrompt.test.js +0 -102
- package/lib/prompts/__tests__/downloadProjectPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +0 -31
- package/lib/prompts/__tests__/projectAddPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/projectAddPrompt.test.js +0 -143
- package/lib/prompts/__tests__/projectsLogsPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/projectsLogsPrompt.test.js +0 -37
- package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.js +0 -160
- package/lib/sandboxSync.d.ts +0 -4
- package/lib/sandboxSync.js +0 -102
- package/lib/theme/__tests__/migrate.test.d.ts +0 -1
- package/lib/theme/__tests__/migrate.test.js +0 -256
- package/lib/ui/__tests__/SpinniesManager.test.d.ts +0 -1
- package/lib/ui/__tests__/SpinniesManager.test.js +0 -488
- package/lib/ui/__tests__/removeAnsiCodes.test.d.ts +0 -1
- package/lib/ui/__tests__/removeAnsiCodes.test.js +0 -84
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +0 -255
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +0 -228
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +0 -209
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +0 -187
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +0 -125
- package/mcp-server/tools/cms/__tests__/HsListTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +0 -125
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +0 -158
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +0 -133
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +0 -462
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +0 -126
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +0 -125
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +0 -210
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +0 -178
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +0 -124
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +0 -307
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +0 -242
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +0 -209
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +0 -158
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +0 -179
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +0 -118
- package/mcp-server/utils/__tests__/command.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/command.test.js +0 -45
- package/mcp-server/utils/__tests__/content.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/content.test.js +0 -164
- package/mcp-server/utils/__tests__/feedbackTracking.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +0 -124
- package/mcp-server/utils/__tests__/project.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/project.test.js +0 -140
- package/mcp-server/utils/project.d.ts +0 -5
- package/mcp-server/utils/project.js +0 -18
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { loadHsProfileFile, getHsProfileFilename,
|
|
2
|
+
import { loadHsProfileFile, getHsProfileFilename, validateProfileVariables, } from '@hubspot/project-parsing-lib/profiles';
|
|
3
3
|
import { commands, lib } from '../../lang/en.js';
|
|
4
|
-
import { indent,
|
|
4
|
+
import { indent, uiLine } from '../ui/index.js';
|
|
5
5
|
import { uiLogger } from '../ui/logger.js';
|
|
6
6
|
import { getConfigAccountById } from '@hubspot/local-dev-lib/config';
|
|
7
7
|
import SpinniesManager from '../ui/SpinniesManager.js';
|
|
@@ -9,7 +9,7 @@ import { handleTranslate } from './upload.js';
|
|
|
9
9
|
import { getErrorMessage } from '../errorHandlers/index.js';
|
|
10
10
|
export function logProfileHeader(profileName) {
|
|
11
11
|
uiLine();
|
|
12
|
-
|
|
12
|
+
uiLogger.log(lib.projectProfiles.logs.usingProfile(getHsProfileFilename(profileName)));
|
|
13
13
|
uiLogger.log('');
|
|
14
14
|
}
|
|
15
15
|
export function logProfileFooter(profile, includeVariables = false) {
|
|
@@ -51,19 +51,7 @@ export function loadProfile(projectConfig, projectDir, profileName) {
|
|
|
51
51
|
}
|
|
52
52
|
return profile;
|
|
53
53
|
}
|
|
54
|
-
export async function enforceProfileUsage(projectConfig, projectDir) {
|
|
55
|
-
if (projectConfig && projectDir) {
|
|
56
|
-
const existingProfiles = await getAllHsProfiles(path.join(projectDir, projectConfig.srcDir));
|
|
57
|
-
if (existingProfiles.length > 0) {
|
|
58
|
-
throw new Error(lib.projectProfiles.exitIfUsingProfiles.errors.noProfileSpecified);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
54
|
export async function loadAndValidateProfile(projectConfig, projectDir, profileName, silent = false) {
|
|
63
|
-
if (!profileName) {
|
|
64
|
-
await enforceProfileUsage(projectConfig, projectDir);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
55
|
if (!silent) {
|
|
68
56
|
logProfileHeader(profileName);
|
|
69
57
|
}
|
|
@@ -77,7 +65,7 @@ export async function loadAndValidateProfile(projectConfig, projectDir, profileN
|
|
|
77
65
|
throw new Error(lib.projectProfiles.loadProfile.errors.profileNotValid(profileName, validationResult.errors));
|
|
78
66
|
}
|
|
79
67
|
}
|
|
80
|
-
return profile
|
|
68
|
+
return profile;
|
|
81
69
|
}
|
|
82
70
|
function formatProfileValidationError(error, leadingIndentationLevel = 0) {
|
|
83
71
|
// Trim leading whitespace and replace tabs with spaces to reducing indentations
|
|
@@ -97,7 +85,7 @@ export async function validateProjectForProfile({ projectConfig, projectDir, pro
|
|
|
97
85
|
});
|
|
98
86
|
}
|
|
99
87
|
try {
|
|
100
|
-
const accountId = await loadAndValidateProfile(projectConfig, projectDir, profileName, true);
|
|
88
|
+
const { accountId } = await loadAndValidateProfile(projectConfig, projectDir, profileName, true);
|
|
101
89
|
targetAccountId = accountId || derivedAccountId;
|
|
102
90
|
}
|
|
103
91
|
catch (error) {
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
export declare const REQUIRED_PACKAGES_AND_MIN_VERSIONS: {
|
|
2
2
|
readonly eslint: "9.0.0";
|
|
3
|
-
readonly '@
|
|
4
|
-
readonly '@typescript-eslint/parser': "8.46.4";
|
|
3
|
+
readonly '@eslint/js': "9.0.0";
|
|
5
4
|
readonly 'typescript-eslint': "8.46.4";
|
|
5
|
+
readonly '@hubspot/eslint-config-ui-extensions': "1.0.0";
|
|
6
|
+
readonly 'eslint-config-prettier': "10.0.0";
|
|
7
|
+
readonly 'eslint-plugin-react': "7.0.0";
|
|
8
|
+
readonly 'eslint-plugin-react-hooks': "7.0.0";
|
|
9
|
+
readonly 'eslint-plugin-unused-imports': "4.0.0";
|
|
10
|
+
readonly prettier: "3.0.0";
|
|
6
11
|
readonly jiti: "2.6.1";
|
|
7
12
|
};
|
|
13
|
+
export declare const LINT_SCRIPTS: {
|
|
14
|
+
readonly lint: "eslint .";
|
|
15
|
+
readonly 'lint:fix': "eslint . --fix";
|
|
16
|
+
};
|
|
8
17
|
export declare function isEslintInstalled(directory: string): boolean;
|
|
9
18
|
export declare function areAllLintPackagesInstalled(directory: string): boolean;
|
|
10
19
|
export declare function getMissingLintPackages(directory: string): {
|
|
@@ -13,7 +22,7 @@ export declare function getMissingLintPackages(directory: string): {
|
|
|
13
22
|
export declare function hasEslintConfig(directory: string): boolean;
|
|
14
23
|
export declare function hasDeprecatedEslintConfig(directory: string): boolean;
|
|
15
24
|
export declare function getDeprecatedEslintConfigFiles(directory: string): string[];
|
|
16
|
-
export declare function createEslintConfig(directory: string): string
|
|
25
|
+
export declare function createEslintConfig(directory: string, platformVersion?: string | null): Promise<string>;
|
|
17
26
|
export declare function lintPackagesInDirectory(directory: string, projectDir?: string): Promise<{
|
|
18
27
|
success: boolean;
|
|
19
28
|
output: string;
|
|
@@ -31,3 +40,8 @@ export declare function displayLintResults(results: Array<{
|
|
|
31
40
|
success: boolean;
|
|
32
41
|
output: string;
|
|
33
42
|
}>): void;
|
|
43
|
+
export declare function getMissingLintScripts(directory: string): string[];
|
|
44
|
+
export declare function addLintScriptsToPackageJson(directory: string): {
|
|
45
|
+
added: string[];
|
|
46
|
+
relativePath: string;
|
|
47
|
+
};
|
|
@@ -3,17 +3,27 @@ import path from 'path';
|
|
|
3
3
|
import util from 'util';
|
|
4
4
|
import semver from 'semver';
|
|
5
5
|
import { exec as execAsync } from 'node:child_process';
|
|
6
|
+
import { fetchRepoFile } from '@hubspot/local-dev-lib/api/github';
|
|
6
7
|
import { getProjectPackageJsonLocations, isPackageInstalled, } from '../dependencyManagement.js';
|
|
7
8
|
import { commands } from '../../lang/en.js';
|
|
8
9
|
import { uiLogger } from '../ui/logger.js';
|
|
9
|
-
import { safeGetPackageJsonCached } from '../npm/packageJson.js';
|
|
10
|
+
import { clearPackageJsonCache, safeGetPackageJsonCached, } from '../npm/packageJson.js';
|
|
11
|
+
import { debugError } from '../errorHandlers/index.js';
|
|
12
|
+
import { isLegacyProject } from '@hubspot/project-parsing-lib/projects';
|
|
13
|
+
import { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, DEFAULT_PROJECT_TEMPLATE_BRANCH, } from '../constants.js';
|
|
10
14
|
export const REQUIRED_PACKAGES_AND_MIN_VERSIONS = {
|
|
11
15
|
eslint: '9.0.0',
|
|
12
|
-
'@
|
|
13
|
-
'@typescript-eslint/parser': '8.46.4',
|
|
16
|
+
'@eslint/js': '9.0.0',
|
|
14
17
|
'typescript-eslint': '8.46.4',
|
|
18
|
+
'@hubspot/eslint-config-ui-extensions': '1.0.0',
|
|
19
|
+
'eslint-config-prettier': '10.0.0',
|
|
20
|
+
'eslint-plugin-react': '7.0.0',
|
|
21
|
+
'eslint-plugin-react-hooks': '7.0.0',
|
|
22
|
+
'eslint-plugin-unused-imports': '4.0.0',
|
|
23
|
+
prettier: '3.0.0',
|
|
15
24
|
jiti: '2.6.1',
|
|
16
25
|
};
|
|
26
|
+
const UIE_ESLINT_CONFIG_PATH_IN_REPO = 'components/cards/src/app/cards/eslint.config.js';
|
|
17
27
|
const ESLINT_CONFIG_FILES = [
|
|
18
28
|
'eslint.config.mts',
|
|
19
29
|
'eslint.config.ts',
|
|
@@ -30,28 +40,10 @@ const DEPRECATED_ESLINT_CONFIG_FILES = [
|
|
|
30
40
|
'.eslintrc.json',
|
|
31
41
|
'.eslintrc',
|
|
32
42
|
];
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
39
|
-
languageOptions: {
|
|
40
|
-
parser: tsParser,
|
|
41
|
-
parserOptions: {
|
|
42
|
-
ecmaVersion: "latest",
|
|
43
|
-
sourceType: "module",
|
|
44
|
-
ecmaFeatures: {
|
|
45
|
-
jsx: true
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
rules: {
|
|
50
|
-
"no-console": ["warn", { allow: ["warn", "error"] }]
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
]);
|
|
54
|
-
`;
|
|
43
|
+
export const LINT_SCRIPTS = {
|
|
44
|
+
lint: 'eslint .',
|
|
45
|
+
'lint:fix': 'eslint . --fix',
|
|
46
|
+
};
|
|
55
47
|
function getPackageVersionFromPackageJson(directory, packageName) {
|
|
56
48
|
const packageJsonPath = path.join(directory, 'package.json');
|
|
57
49
|
const packageJson = safeGetPackageJsonCached(packageJsonPath);
|
|
@@ -127,10 +119,43 @@ export function getDeprecatedEslintConfigFiles(directory) {
|
|
|
127
119
|
return fs.existsSync(configPath);
|
|
128
120
|
});
|
|
129
121
|
}
|
|
130
|
-
|
|
131
|
-
|
|
122
|
+
function repoFileDataToString(data) {
|
|
123
|
+
if (typeof data === 'string') {
|
|
124
|
+
return data;
|
|
125
|
+
}
|
|
126
|
+
if (Buffer.isBuffer(data)) {
|
|
127
|
+
return data.toString('utf-8');
|
|
128
|
+
}
|
|
129
|
+
return String(data);
|
|
130
|
+
}
|
|
131
|
+
export async function createEslintConfig(directory, platformVersion) {
|
|
132
|
+
const versionForRemote = platformVersion && !isLegacyProject(platformVersion)
|
|
133
|
+
? platformVersion
|
|
134
|
+
: null;
|
|
135
|
+
if (versionForRemote === null) {
|
|
136
|
+
const message = commands.project.lint.createEslintConfigRequiresV2Platform(platformVersion);
|
|
137
|
+
uiLogger.error(message);
|
|
138
|
+
throw new Error(message);
|
|
139
|
+
}
|
|
140
|
+
let fetchedContent = null;
|
|
132
141
|
try {
|
|
133
|
-
|
|
142
|
+
const { data } = await fetchRepoFile(HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, `${versionForRemote}/${UIE_ESLINT_CONFIG_PATH_IN_REPO}`, DEFAULT_PROJECT_TEMPLATE_BRANCH);
|
|
143
|
+
const content = repoFileDataToString(data);
|
|
144
|
+
if (content.trim().length > 0) {
|
|
145
|
+
fetchedContent = content;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
debugError(error);
|
|
150
|
+
}
|
|
151
|
+
if (fetchedContent === null) {
|
|
152
|
+
const message = commands.project.lint.failedToFetchRemoteEslintConfig(versionForRemote);
|
|
153
|
+
uiLogger.error(message);
|
|
154
|
+
throw new Error(message);
|
|
155
|
+
}
|
|
156
|
+
const configPath = path.join(directory, 'eslint.config.js');
|
|
157
|
+
try {
|
|
158
|
+
fs.writeFileSync(configPath, fetchedContent, 'utf-8');
|
|
134
159
|
return path.relative(process.cwd(), configPath);
|
|
135
160
|
}
|
|
136
161
|
catch (error) {
|
|
@@ -218,3 +243,43 @@ export function displayLintResults(results) {
|
|
|
218
243
|
});
|
|
219
244
|
}
|
|
220
245
|
}
|
|
246
|
+
export function getMissingLintScripts(directory) {
|
|
247
|
+
const packageJsonPath = path.join(directory, 'package.json');
|
|
248
|
+
const packageJson = safeGetPackageJsonCached(packageJsonPath);
|
|
249
|
+
if (!packageJson) {
|
|
250
|
+
return [];
|
|
251
|
+
}
|
|
252
|
+
return Object.keys(LINT_SCRIPTS).filter(scriptName => !packageJson.scripts?.[scriptName]);
|
|
253
|
+
}
|
|
254
|
+
export function addLintScriptsToPackageJson(directory) {
|
|
255
|
+
const packageJsonPath = path.join(directory, 'package.json');
|
|
256
|
+
try {
|
|
257
|
+
const rawContent = fs.readFileSync(packageJsonPath, 'utf-8');
|
|
258
|
+
const packageJson = JSON.parse(rawContent);
|
|
259
|
+
if (!packageJson.scripts) {
|
|
260
|
+
packageJson.scripts = {};
|
|
261
|
+
}
|
|
262
|
+
const added = [];
|
|
263
|
+
for (const [scriptName, scriptValue] of Object.entries(LINT_SCRIPTS)) {
|
|
264
|
+
if (!packageJson.scripts[scriptName]) {
|
|
265
|
+
packageJson.scripts[scriptName] = scriptValue;
|
|
266
|
+
added.push(scriptName);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (added.length > 0) {
|
|
270
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
|
|
271
|
+
clearPackageJsonCache();
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
added,
|
|
275
|
+
relativePath: path.relative(process.cwd(), packageJsonPath),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
catch {
|
|
279
|
+
uiLogger.warn(commands.project.lint.failedToAddLintScripts(packageJsonPath));
|
|
280
|
+
return {
|
|
281
|
+
added: [],
|
|
282
|
+
relativePath: path.relative(process.cwd(), packageJsonPath),
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
}
|
package/lib/projects/upload.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ type ProjectUploadCallbackFunction<T> = (accountId: number, projectConfig: Proje
|
|
|
4
4
|
type ProjectUploadResult<T> = {
|
|
5
5
|
result?: T;
|
|
6
6
|
uploadError?: unknown;
|
|
7
|
+
projectNotFound?: boolean;
|
|
8
|
+
projectId?: number;
|
|
7
9
|
};
|
|
8
10
|
type HandleProjectUploadArg<T> = {
|
|
9
11
|
accountId: number;
|
|
@@ -15,9 +17,10 @@ type HandleProjectUploadArg<T> = {
|
|
|
15
17
|
isUploadCommand?: boolean;
|
|
16
18
|
sendIR?: boolean;
|
|
17
19
|
skipValidation?: boolean;
|
|
20
|
+
skipNpmAudit?: boolean;
|
|
18
21
|
profile?: string;
|
|
19
22
|
};
|
|
20
|
-
export declare function handleProjectUpload<T>({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage, forceCreate, isUploadCommand, sendIR, skipValidation, }: HandleProjectUploadArg<T>): Promise<ProjectUploadResult<T>>;
|
|
23
|
+
export declare function handleProjectUpload<T>({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage, forceCreate, isUploadCommand, sendIR, skipValidation, skipNpmAudit, }: HandleProjectUploadArg<T>): Promise<ProjectUploadResult<T>>;
|
|
21
24
|
export declare function validateSourceDirectory(srcDir: string, projectConfig: ProjectConfig, projectDir: string): Promise<void>;
|
|
22
25
|
export declare function validateNoHSMetaMismatch(srcDir: string, projectConfig: ProjectConfig): Promise<void>;
|
|
23
26
|
type HandleTranslateArg = {
|
package/lib/projects/upload.js
CHANGED
|
@@ -6,18 +6,19 @@ import { uploadProject } from '@hubspot/local-dev-lib/api/projects';
|
|
|
6
6
|
import { shouldIgnoreFile } from '@hubspot/local-dev-lib/ignoreRules';
|
|
7
7
|
import { isTranslationError, translate, } from '@hubspot/project-parsing-lib/translate';
|
|
8
8
|
import { projectContainsHsMetaFiles } from '@hubspot/project-parsing-lib/projects';
|
|
9
|
+
import { findAndParsePackageJsonFiles, collectWorkspaceDirectories, collectFileDependencies, } from '@hubspot/project-parsing-lib/workspaces';
|
|
9
10
|
import SpinniesManager from '../ui/SpinniesManager.js';
|
|
10
11
|
import { uiAccountDescription } from '../ui/index.js';
|
|
11
|
-
import { logError } from '../errorHandlers/index.js';
|
|
12
12
|
import util from 'node:util';
|
|
13
13
|
import { lib } from '../../lang/en.js';
|
|
14
14
|
import { ensureProjectExists } from './ensureProjectExists.js';
|
|
15
15
|
import { uiLogger } from '../ui/logger.js';
|
|
16
|
-
import { isV2Project } from './platformVersion.js';
|
|
17
|
-
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
18
16
|
import ProjectValidationError from '../errors/ProjectValidationError.js';
|
|
19
17
|
import { walk } from '@hubspot/local-dev-lib/fs';
|
|
20
18
|
import { LEGACY_CONFIG_FILES } from '../constants.js';
|
|
19
|
+
import { archiveWorkspacesAndDependencies, getPackageJsonPathsToUpdate, getLockfilePathsToUpdate, } from './workspaces.js';
|
|
20
|
+
import { isLegacyProject } from '@hubspot/project-parsing-lib/projects';
|
|
21
|
+
import { runNpmAuditsBeforeProjectUpload } from './npmAuditOnUpload.js';
|
|
21
22
|
async function uploadProjectFiles(accountId, projectName, filePath, uploadMessage, platformVersion, intermediateRepresentation) {
|
|
22
23
|
const accountIdentifier = uiAccountDescription(accountId) || `${accountId}`;
|
|
23
24
|
SpinniesManager.add('upload', {
|
|
@@ -44,64 +45,82 @@ async function uploadProjectFiles(accountId, projectName, filePath, uploadMessag
|
|
|
44
45
|
}
|
|
45
46
|
return { buildId, error };
|
|
46
47
|
}
|
|
47
|
-
export async function handleProjectUpload({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage = '', forceCreate = false, isUploadCommand = false, sendIR = false, skipValidation = false, }) {
|
|
48
|
+
export async function handleProjectUpload({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage = '', forceCreate = false, isUploadCommand = false, sendIR = false, skipValidation = false, skipNpmAudit = false, }) {
|
|
48
49
|
const srcDir = path.resolve(projectDir, projectConfig.srcDir);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
logError(e);
|
|
54
|
-
process.exit(EXIT_CODES.ERROR);
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
await validateNoHSMetaMismatch(srcDir, projectConfig);
|
|
58
|
-
}
|
|
59
|
-
catch (e) {
|
|
60
|
-
logError(e);
|
|
61
|
-
process.exit(EXIT_CODES.ERROR);
|
|
62
|
-
}
|
|
50
|
+
await validateSourceDirectory(srcDir, projectConfig, projectDir);
|
|
51
|
+
await validateNoHSMetaMismatch(srcDir, projectConfig);
|
|
63
52
|
const tempFile = tmp.fileSync({ postfix: '.zip' });
|
|
64
53
|
uiLogger.debug(lib.projectUpload.handleProjectUpload.compressing(tempFile.name));
|
|
54
|
+
// Collect workspace directories and file: dependencies for v2+ projects only.
|
|
55
|
+
// Versions <= 2025.1 do not support the new npm workspaces bundling behavior.
|
|
56
|
+
let workspaceMappings = [];
|
|
57
|
+
let fileDependencyMappings = [];
|
|
58
|
+
let parsedPackageJsons = [];
|
|
59
|
+
if (!isLegacyProject(projectConfig.platformVersion)) {
|
|
60
|
+
parsedPackageJsons = await findAndParsePackageJsonFiles(srcDir);
|
|
61
|
+
workspaceMappings = await collectWorkspaceDirectories(parsedPackageJsons);
|
|
62
|
+
fileDependencyMappings = await collectFileDependencies(parsedPackageJsons);
|
|
63
|
+
}
|
|
64
|
+
if (isUploadCommand && !skipNpmAudit) {
|
|
65
|
+
await runNpmAuditsBeforeProjectUpload({
|
|
66
|
+
srcDir,
|
|
67
|
+
projectDir,
|
|
68
|
+
parsedPackageJsons,
|
|
69
|
+
isLegacyPlatform: isLegacyProject(projectConfig.platformVersion),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
65
72
|
const output = fs.createWriteStream(tempFile.name);
|
|
66
73
|
const archive = archiver('zip');
|
|
67
|
-
const result = new Promise(resolve => output.on('close', async function () {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
const result = new Promise((resolve, reject) => output.on('close', async function () {
|
|
75
|
+
try {
|
|
76
|
+
uiLogger.debug(lib.projectUpload.handleProjectUpload.compressed(archive.pointer()));
|
|
77
|
+
let intermediateRepresentation;
|
|
78
|
+
if (sendIR) {
|
|
79
|
+
try {
|
|
80
|
+
intermediateRepresentation = await handleTranslate({
|
|
81
|
+
projectDir,
|
|
82
|
+
projectConfig,
|
|
83
|
+
accountId,
|
|
84
|
+
skipValidation,
|
|
85
|
+
profile,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
return resolve({ uploadError: e });
|
|
90
|
+
}
|
|
79
91
|
}
|
|
80
|
-
|
|
81
|
-
|
|
92
|
+
const { projectExists, project } = await ensureProjectExists(accountId, projectConfig.name, {
|
|
93
|
+
forceCreate,
|
|
94
|
+
uploadCommand: isUploadCommand,
|
|
95
|
+
noLogs: true,
|
|
96
|
+
});
|
|
97
|
+
if (!projectExists) {
|
|
98
|
+
uiLogger.log(lib.projectUpload.handleProjectUpload.projectDoesNotExist(accountId));
|
|
99
|
+
return resolve({ projectNotFound: true });
|
|
100
|
+
}
|
|
101
|
+
const projectId = project?.id;
|
|
102
|
+
const { buildId, error } = await uploadProjectFiles(accountId, projectConfig.name, tempFile.name, uploadMessage, projectConfig.platformVersion, intermediateRepresentation);
|
|
103
|
+
if (error) {
|
|
104
|
+
resolve({ uploadError: error, projectId });
|
|
105
|
+
}
|
|
106
|
+
else if (callbackFunc) {
|
|
107
|
+
const uploadResult = await callbackFunc(accountId, projectConfig, tempFile, buildId);
|
|
108
|
+
resolve({ result: uploadResult, projectId });
|
|
82
109
|
}
|
|
83
110
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
uploadCommand: isUploadCommand,
|
|
87
|
-
noLogs: true,
|
|
88
|
-
});
|
|
89
|
-
if (!projectExists) {
|
|
90
|
-
uiLogger.log(lib.projectUpload.handleProjectUpload.projectDoesNotExist(accountId));
|
|
91
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
92
|
-
}
|
|
93
|
-
const { buildId, error } = await uploadProjectFiles(accountId, projectConfig.name, tempFile.name, uploadMessage, projectConfig.platformVersion, intermediateRepresentation);
|
|
94
|
-
if (error) {
|
|
95
|
-
resolve({ uploadError: error });
|
|
96
|
-
}
|
|
97
|
-
else if (callbackFunc) {
|
|
98
|
-
const uploadResult = await callbackFunc(accountId, projectConfig, tempFile, buildId);
|
|
99
|
-
resolve({ result: uploadResult });
|
|
111
|
+
catch (e) {
|
|
112
|
+
reject(e);
|
|
100
113
|
}
|
|
101
114
|
}));
|
|
102
115
|
archive.pipe(output);
|
|
116
|
+
const modifiedPackageJsonPaths = getPackageJsonPathsToUpdate(srcDir, workspaceMappings, fileDependencyMappings);
|
|
117
|
+
const lockfilePathsToUpdate = getLockfilePathsToUpdate(srcDir, workspaceMappings, fileDependencyMappings);
|
|
103
118
|
let loggedIgnoredNodeModule = false;
|
|
104
119
|
archive.directory(srcDir, false, file => {
|
|
120
|
+
if (modifiedPackageJsonPaths.has(file.name) ||
|
|
121
|
+
lockfilePathsToUpdate.has(file.name)) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
105
124
|
const ignored = shouldIgnoreFile(file.name, true);
|
|
106
125
|
if (ignored) {
|
|
107
126
|
const isNodeModule = file.name.includes('node_modules');
|
|
@@ -114,6 +133,8 @@ export async function handleProjectUpload({ accountId, projectConfig, projectDir
|
|
|
114
133
|
}
|
|
115
134
|
return ignored ? false : file;
|
|
116
135
|
});
|
|
136
|
+
// Archive workspaces and file: dependencies
|
|
137
|
+
await archiveWorkspacesAndDependencies(archive, srcDir, workspaceMappings, fileDependencyMappings);
|
|
117
138
|
archive.finalize();
|
|
118
139
|
return result;
|
|
119
140
|
}
|
|
@@ -122,7 +143,7 @@ export async function validateSourceDirectory(srcDir, projectConfig, projectDir)
|
|
|
122
143
|
if (!projectFilePaths || projectFilePaths.length === 0) {
|
|
123
144
|
throw new ProjectValidationError(lib.projectUpload.handleProjectUpload.emptySource(projectConfig.srcDir));
|
|
124
145
|
}
|
|
125
|
-
if (
|
|
146
|
+
if (!isLegacyProject(projectConfig.platformVersion)) {
|
|
126
147
|
projectFilePaths.forEach(filePath => {
|
|
127
148
|
const filename = path.basename(filePath);
|
|
128
149
|
if (LEGACY_CONFIG_FILES.includes(filename)) {
|
|
@@ -133,7 +154,7 @@ export async function validateSourceDirectory(srcDir, projectConfig, projectDir)
|
|
|
133
154
|
}
|
|
134
155
|
export async function validateNoHSMetaMismatch(srcDir, projectConfig) {
|
|
135
156
|
const hasHsMetaFiles = await projectContainsHsMetaFiles(srcDir);
|
|
136
|
-
if (
|
|
157
|
+
if (isLegacyProject(projectConfig.platformVersion) && hasHsMetaFiles) {
|
|
137
158
|
throw new ProjectValidationError(lib.projectUpload.wrongPlatformVersionMetaFiles);
|
|
138
159
|
}
|
|
139
160
|
}
|
package/lib/projects/watch.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProjectConfig } from '../../types/Projects.js';
|
|
2
2
|
type ProjectWatchHandlerFunction = (accountId: number, projectName: string, currentBuildId: number) => Promise<void> | void;
|
|
3
|
-
|
|
3
|
+
type WatchTerminationHandler = (error?: unknown) => void;
|
|
4
|
+
export declare function createWatcher(accountId: number, projectConfig: ProjectConfig, projectDir: string, handleBuildStatusFn: ProjectWatchHandlerFunction, handleUserInputFn: ProjectWatchHandlerFunction, handleWatchTerminationFn: WatchTerminationHandler): Promise<void>;
|
|
4
5
|
export {};
|
package/lib/projects/watch.js
CHANGED
|
@@ -18,6 +18,7 @@ const standbyQueue = [];
|
|
|
18
18
|
let currentBuildId;
|
|
19
19
|
let handleBuildStatus;
|
|
20
20
|
let handleUserInput;
|
|
21
|
+
let handleWatchTermination = () => { };
|
|
21
22
|
let timer;
|
|
22
23
|
async function processStandByQueue(accountId, projectName, platformVersion) {
|
|
23
24
|
queue.addAll(standbyQueue.map(({ filePath, remotePath, action }) => {
|
|
@@ -37,33 +38,39 @@ function debounceQueueBuild(accountId, projectName, platformVersion) {
|
|
|
37
38
|
clearTimeout(timer);
|
|
38
39
|
}
|
|
39
40
|
timer = setTimeout(async () => {
|
|
40
|
-
uiLogger.debug(commands.project.watch.debug.pause);
|
|
41
|
-
queue.pause();
|
|
42
|
-
await queue.onIdle();
|
|
43
41
|
try {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
uiLogger.debug(commands.project.watch.debug.pause);
|
|
43
|
+
queue.pause();
|
|
44
|
+
await queue.onIdle();
|
|
45
|
+
try {
|
|
46
|
+
await queueBuild(accountId, projectName, platformVersion);
|
|
47
|
+
uiLogger.debug(commands.project.watch.debug.buildStarted);
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
if (isSpecifiedError(err, {
|
|
51
|
+
subCategory: PROJECT_ERROR_TYPES.MISSING_PROJECT_PROVISION,
|
|
52
|
+
})) {
|
|
53
|
+
uiLogger.log(commands.project.watch.logs.watchCancelledFromUi);
|
|
54
|
+
handleWatchTermination();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
logError(err, new ApiErrorContext({ accountId }));
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
53
61
|
}
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
await handleBuildStatus(accountId, projectName, currentBuildId);
|
|
63
|
+
await createNewStagingBuild(accountId, projectName, platformVersion);
|
|
64
|
+
if (standbyQueue.length > 0) {
|
|
65
|
+
await processStandByQueue(accountId, projectName, platformVersion);
|
|
56
66
|
}
|
|
57
|
-
|
|
67
|
+
queue.start();
|
|
68
|
+
uiLogger.log(commands.project.watch.logs.resuming);
|
|
69
|
+
uiLogger.log(`\n> Press ${chalk.bold('q')} to quit watching\n`);
|
|
58
70
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (standbyQueue.length > 0) {
|
|
62
|
-
await processStandByQueue(accountId, projectName, platformVersion);
|
|
71
|
+
catch (err) {
|
|
72
|
+
handleWatchTermination(err);
|
|
63
73
|
}
|
|
64
|
-
queue.start();
|
|
65
|
-
uiLogger.log(commands.project.watch.logs.resuming);
|
|
66
|
-
uiLogger.log(`\n> Press ${chalk.bold('q')} to quit watching\n`);
|
|
67
74
|
}, 2000);
|
|
68
75
|
}
|
|
69
76
|
async function queueFileOrFolder(accountId, projectName, platformVersion, filePath, remotePath, action) {
|
|
@@ -111,7 +118,7 @@ async function createNewBuild(accountId, projectName, platformVersion) {
|
|
|
111
118
|
await cancelStagedBuild(accountId, projectName);
|
|
112
119
|
uiLogger.log(commands.project.watch.logs.previousStagingBuildCancelled);
|
|
113
120
|
}
|
|
114
|
-
|
|
121
|
+
throw err;
|
|
115
122
|
}
|
|
116
123
|
}
|
|
117
124
|
async function handleWatchEvent(accountId, projectName, platformVersion, projectSourceDir, filePath, action = 'upload') {
|
|
@@ -132,10 +139,11 @@ async function handleWatchEvent(accountId, projectName, platformVersion, project
|
|
|
132
139
|
await queueFileOrFolder(accountId, projectName, platformVersion, filePath, remotePath, action);
|
|
133
140
|
}
|
|
134
141
|
}
|
|
135
|
-
export async function createWatcher(accountId, projectConfig, projectDir, handleBuildStatusFn, handleUserInputFn) {
|
|
142
|
+
export async function createWatcher(accountId, projectConfig, projectDir, handleBuildStatusFn, handleUserInputFn, handleWatchTerminationFn) {
|
|
136
143
|
const projectSourceDir = path.join(projectDir, projectConfig.srcDir);
|
|
137
144
|
handleBuildStatus = handleBuildStatusFn;
|
|
138
145
|
handleUserInput = handleUserInputFn;
|
|
146
|
+
handleWatchTermination = handleWatchTerminationFn;
|
|
139
147
|
await createNewStagingBuild(accountId, projectConfig.name, projectConfig.platformVersion);
|
|
140
148
|
const watcher = chokidar.watch(projectSourceDir, {
|
|
141
149
|
ignoreInitial: true,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import archiver from 'archiver';
|
|
2
|
+
import { WorkspaceMapping, FileDependencyMapping } from '@hubspot/project-parsing-lib/workspaces';
|
|
3
|
+
/**
|
|
4
|
+
* Result of archiving workspaces and file dependencies
|
|
5
|
+
*/
|
|
6
|
+
export type WorkspaceArchiveResult = {
|
|
7
|
+
packageWorkspaces: Map<string, string[]>;
|
|
8
|
+
packageFileDeps: Map<string, Map<string, string>>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Generates a short hash of the input string for use in workspace paths.
|
|
12
|
+
* Uses SHA256 truncated to 8 hex characters (4 billion possibilities).
|
|
13
|
+
*/
|
|
14
|
+
export declare function shortHash(input: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Converts native path separators to POSIX forward slashes.
|
|
17
|
+
*
|
|
18
|
+
* Zip entry names and npm workspace globs are POSIX-only. On Windows,
|
|
19
|
+
* `path.relative` returns backslash-separated paths; archiver normalizes
|
|
20
|
+
* its appended entry names to forward slashes but its filter callback
|
|
21
|
+
* receives forward-slashed names too. Without this normalization, lookups
|
|
22
|
+
* in our exclusion Sets miss on Windows and a file gets archived twice.
|
|
23
|
+
*/
|
|
24
|
+
export declare function toPosixPath(p: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Determines the archive path for an external workspace or file: dependency.
|
|
27
|
+
* Produces `_workspaces/<basename>-<hash>` with no subdirectory.
|
|
28
|
+
* The hash prevents collisions between different directories with the same basename.
|
|
29
|
+
*/
|
|
30
|
+
export declare function computeExternalArchivePath(absolutePath: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Updates package.json files in the archive to reflect new workspace and file: dependency paths.
|
|
33
|
+
*
|
|
34
|
+
* Workspace entries in packageWorkspaces are already in final form:
|
|
35
|
+
* - Internal workspaces: relative paths (e.g. "../packages/utils")
|
|
36
|
+
* - External workspaces: relative paths (e.g. "../_workspaces/logger-abc")
|
|
37
|
+
*
|
|
38
|
+
* Only external file: dependencies appear in packageFileDeps; internal ones
|
|
39
|
+
* keep their original file: references and are left untouched.
|
|
40
|
+
*/
|
|
41
|
+
export declare function updatePackageJsonInArchive(archive: archiver.Archiver, srcDir: string, packageWorkspaces: Map<string, string[]>, packageFileDeps: Map<string, Map<string, string>>): Promise<void>;
|
|
42
|
+
export declare function rewriteLockfileForExternalDeps(lockfileContent: Record<string, unknown>, pathMappings: Array<{
|
|
43
|
+
oldPath: string;
|
|
44
|
+
newPath: string;
|
|
45
|
+
}>): Record<string, unknown>;
|
|
46
|
+
export declare function getPackageJsonPathsToUpdate(srcDir: string, workspaceMappings: WorkspaceMapping[], fileDependencyMappings: FileDependencyMapping[]): Set<string>;
|
|
47
|
+
export declare function getLockfilePathsToUpdate(srcDir: string, workspaceMappings: WorkspaceMapping[], fileDependencyMappings: FileDependencyMapping[]): Set<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Main orchestration function that handles archiving of workspaces and file dependencies.
|
|
50
|
+
* This is the clean integration point for upload.ts.
|
|
51
|
+
*/
|
|
52
|
+
export declare function archiveWorkspacesAndDependencies(archive: archiver.Archiver, srcDir: string, workspaceMappings: WorkspaceMapping[], fileDependencyMappings: FileDependencyMapping[]): Promise<WorkspaceArchiveResult>;
|