@hubspot/cli 7.11.8-experimental.0 → 8.0.0-beta.1
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/__tests__/migrate.test.js +19 -1
- package/api/migrate.d.ts +1 -1
- package/api/migrate.js +2 -1
- package/bin/cli.js +12 -27
- package/commands/__tests__/customObject.test.js +0 -2
- package/commands/__tests__/doctor.test.js +0 -2
- package/commands/__tests__/getStarted.test.js +0 -4
- package/commands/__tests__/project.test.js +0 -4
- package/commands/__tests__/upgrade.test.js +309 -0
- package/commands/account/__tests__/auth.test.js +180 -0
- package/commands/account/__tests__/list.test.js +128 -3
- package/commands/account/__tests__/rename.test.js +0 -2
- package/commands/account/__tests__/use.test.js +138 -0
- package/commands/account/auth.js +1 -1
- package/commands/account/clean.js +4 -3
- package/commands/account/createOverride.js +3 -2
- package/commands/account/info.js +2 -2
- package/commands/account/list.js +4 -4
- package/commands/account/remove.js +3 -2
- package/commands/account/removeOverride.js +3 -2
- package/commands/account/use.js +4 -3
- package/commands/app/__tests__/migrate.test.js +8 -25
- package/commands/app/migrate.js +10 -16
- package/commands/app/secret/__tests__/add.test.js +112 -0
- package/commands/app/secret/add.js +13 -13
- package/commands/auth.js +8 -2
- package/commands/cms/__tests__/fetch.test.js +114 -15
- package/commands/cms/__tests__/upload.test.js +308 -0
- package/commands/cms/__tests__/watch.test.js +212 -0
- package/commands/cms/app/create.js +2 -3
- package/commands/cms/convertFields.js +1 -1
- package/commands/cms/fetch.js +3 -2
- package/commands/cms/function/deploy.js +2 -2
- package/commands/cms/function/list.js +2 -3
- package/commands/cms/lighthouseScore.js +19 -27
- package/commands/cms/module/marketplace-validate.js +0 -1
- package/commands/cms/theme/__tests__/preview.test.js +2 -8
- package/commands/cms/theme/create.js +1 -1
- package/commands/cms/theme/marketplace-validate.js +0 -1
- package/commands/cms/theme/preview.d.ts +0 -1
- package/commands/cms/theme/preview.js +12 -52
- package/commands/cms/upload.js +3 -3
- package/commands/cms/watch.js +3 -3
- package/commands/customObject.js +0 -2
- package/commands/doctor.js +10 -2
- package/commands/filemanager/__tests__/upload.test.js +161 -0
- package/commands/getStarted.js +13 -3
- package/commands/hubdb/__tests__/list.test.js +0 -9
- package/commands/hubdb/list.js +6 -8
- package/commands/init.js +8 -2
- package/commands/mcp/__tests__/start.test.js +113 -3
- package/commands/mcp/setup.js +0 -7
- package/commands/mcp/start.d.ts +1 -1
- package/commands/mcp/start.js +0 -7
- package/commands/project/__tests__/add.test.js +0 -2
- package/commands/project/__tests__/create.test.js +2 -2
- package/commands/project/__tests__/deploy.test.js +0 -4
- package/commands/project/__tests__/dev.test.js +273 -0
- package/commands/project/__tests__/devUnifiedFlow.test.js +2 -5
- package/commands/project/__tests__/installDeps.test.js +0 -2
- package/commands/project/__tests__/lint.test.js +0 -5
- package/commands/project/__tests__/logs.test.js +24 -31
- package/commands/project/__tests__/migrate.test.js +7 -12
- package/commands/project/__tests__/updateDeps.test.js +0 -2
- package/commands/project/__tests__/upload.test.js +191 -0
- package/commands/project/__tests__/validate.test.js +314 -31
- package/commands/project/cloneApp.d.ts +1 -7
- package/commands/project/cloneApp.js +1 -149
- package/commands/project/create.js +3 -4
- package/commands/project/deploy.js +18 -7
- package/commands/project/dev/deprecatedFlow.js +0 -2
- package/commands/project/dev/index.js +23 -11
- package/commands/project/dev/unifiedFlow.d.ts +1 -1
- package/commands/project/dev/unifiedFlow.js +1 -4
- package/commands/project/list.js +4 -4
- package/commands/project/listBuilds.js +2 -7
- package/commands/project/logs.js +19 -12
- package/commands/project/migrate.js +3 -3
- package/commands/project/profile/add.js +1 -1
- package/commands/project/profile/delete.js +1 -1
- package/commands/project/upload.d.ts +1 -1
- package/commands/project/upload.js +13 -4
- package/commands/project/validate.js +85 -13
- package/commands/project/watch.js +7 -7
- package/commands/project.js +0 -4
- package/commands/sandbox/__tests__/create.test.js +0 -2
- package/commands/secret/__tests__/addSecret.test.js +140 -7
- package/commands/secret/addSecret.js +3 -1
- package/commands/testAccount/__tests__/create.test.js +6 -1
- package/commands/testAccount/__tests__/importData.test.js +0 -1
- package/commands/testAccount/create.d.ts +1 -0
- package/commands/testAccount/create.js +13 -5
- package/commands/upgrade.d.ts +8 -0
- package/commands/upgrade.js +119 -0
- package/lang/en.d.ts +88 -10
- package/lang/en.js +105 -26
- package/lib/__tests__/buildAccount.test.js +0 -13
- package/lib/__tests__/cliUpgradeUtils.test.js +131 -0
- package/lib/__tests__/commonOpts.test.js +0 -1
- package/lib/__tests__/dependencyManagement.test.js +633 -13
- package/lib/__tests__/developerTestAccounts.test.js +0 -1
- package/lib/__tests__/hasFeature.test.js +0 -6
- package/lib/__tests__/importData.test.js +0 -1
- package/lib/__tests__/npmCli.test.js +84 -0
- package/lib/__tests__/oauth.test.js +1 -11
- package/lib/__tests__/process.test.js +0 -1
- package/lib/__tests__/sandboxSync.test.js +0 -1
- package/lib/__tests__/sandboxes.test.js +0 -1
- package/lib/__tests__/serverlessLogs.test.js +0 -1
- package/lib/__tests__/usageTracking.test.js +39 -6
- package/lib/__tests__/validation.test.js +0 -1
- package/lib/app/__tests__/migrate.test.js +137 -12
- package/lib/app/migrate.d.ts +5 -2
- package/lib/app/migrate.js +30 -11
- package/lib/app/urls.d.ts +1 -1
- package/lib/buildAccount.d.ts +1 -1
- package/lib/cliUpgradeUtils.d.ts +22 -0
- package/lib/cliUpgradeUtils.js +62 -0
- package/lib/cmsAssets/api-sample.js +2 -5
- package/lib/cmsAssets/function.js +1 -9
- package/lib/cmsAssets/module.js +1 -9
- package/lib/cmsAssets/template.js +1 -9
- package/lib/configOptions.d.ts +0 -1
- package/lib/configOptions.js +1 -5
- package/lib/constants.d.ts +6 -0
- package/lib/constants.js +10 -4
- package/lib/dependencyManagement.d.ts +9 -0
- package/lib/dependencyManagement.js +127 -26
- package/lib/developerTestAccounts.d.ts +1 -1
- package/lib/doctor/Diagnosis.d.ts +1 -0
- package/lib/doctor/Diagnosis.js +7 -0
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +2 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +8 -4
- package/lib/doctor/Doctor.d.ts +12 -0
- package/lib/doctor/Doctor.js +283 -33
- package/lib/doctor/__tests__/Diagnosis.test.js +1 -0
- package/lib/doctor/__tests__/Doctor.test.js +201 -51
- package/lib/errorHandlers/__tests__/index.test.d.ts +1 -0
- package/lib/errorHandlers/__tests__/index.test.js +278 -0
- package/lib/errorHandlers/index.d.ts +1 -0
- package/lib/errorHandlers/index.js +14 -2
- package/lib/http.js +3 -1
- package/lib/links.js +2 -3
- package/lib/mcp/__tests__/setup.test.js +69 -2
- package/lib/mcp/setup.d.ts +1 -0
- package/lib/mcp/setup.js +37 -4
- package/lib/middleware/__tests__/configMiddleware.test.js +1 -43
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.d.ts +1 -0
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.js +44 -0
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.js +0 -5
- package/lib/middleware/autoUpdateMiddleware.js +58 -57
- package/lib/middleware/configMiddleware.d.ts +0 -3
- package/lib/middleware/configMiddleware.js +0 -11
- package/lib/middleware/fireAlarmMiddleware.js +1 -1
- package/lib/middleware/spinniesMiddleware.d.ts +1 -0
- package/lib/middleware/spinniesMiddleware.js +4 -0
- package/lib/middleware/usageTrackingMiddleware.d.ts +13 -0
- package/lib/middleware/usageTrackingMiddleware.js +16 -0
- package/lib/{npm.d.ts → npm/npmCli.d.ts} +8 -3
- package/lib/npm/npmCli.js +59 -0
- package/lib/npm/packageJson.d.ts +24 -0
- package/lib/npm/packageJson.js +102 -0
- package/lib/npm/workspaces.d.ts +12 -0
- package/lib/npm/workspaces.js +48 -0
- package/lib/oauth.js +1 -3
- package/lib/projects/__tests__/AppDevModeInterface.test.js +40 -18
- package/lib/projects/__tests__/DevServerManager.test.js +1 -0
- package/lib/projects/__tests__/DevSessionManager.test.d.ts +1 -0
- package/lib/projects/__tests__/DevSessionManager.test.js +250 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +19 -6
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +0 -2
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +0 -1
- package/lib/projects/__tests__/components.test.js +6 -22
- package/lib/projects/__tests__/deploy.test.js +0 -1
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +3 -5
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.d.ts +1 -0
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.js +328 -0
- package/lib/projects/__tests__/projectProfiles.test.d.ts +1 -0
- package/lib/projects/__tests__/projectProfiles.test.js +441 -0
- package/lib/projects/__tests__/projects.test.js +0 -1
- package/lib/projects/__tests__/structure.test.js +0 -1
- package/lib/projects/__tests__/uieLinting.test.js +2 -11
- package/lib/projects/__tests__/upload.test.js +104 -3
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +0 -2
- package/lib/projects/add/__tests__/v2AddComponent.test.js +2 -4
- package/lib/projects/add/v2AddComponent.js +2 -3
- package/lib/projects/components.d.ts +1 -1
- package/lib/projects/components.js +4 -4
- package/lib/projects/create/__tests__/legacy.test.js +0 -1
- package/lib/projects/create/__tests__/v2.test.js +0 -1
- package/lib/projects/create/v2.d.ts +1 -1
- package/lib/projects/create/v2.js +1 -1
- package/lib/projects/ensureProjectExists.js +0 -1
- package/lib/projects/localDev/AppDevModeInterface.js +9 -2
- package/lib/projects/localDev/DevSessionManager.d.ts +18 -0
- package/lib/projects/localDev/DevSessionManager.js +95 -0
- package/lib/projects/localDev/LocalDevLogger.d.ts +4 -0
- package/lib/projects/localDev/LocalDevLogger.js +18 -7
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.d.ts +4 -3
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +23 -12
- package/lib/projects/localDev/LocalDevProcess.d.ts +2 -1
- package/lib/projects/localDev/LocalDevProcess.js +18 -7
- package/lib/projects/localDev/LocalDevState.d.ts +3 -2
- package/lib/projects/localDev/helpers/account.d.ts +1 -1
- package/lib/projects/localDev/helpers/devSessionsApi.d.ts +9 -0
- package/lib/projects/localDev/helpers/devSessionsApi.js +19 -0
- package/lib/projects/localDev/helpers/project.d.ts +1 -1
- package/lib/projects/localDev/helpers/project.js +1 -2
- package/lib/projects/pollProjectBuildAndDeploy.js +4 -5
- package/lib/projects/projectProfiles.d.ts +17 -0
- package/lib/projects/projectProfiles.js +140 -0
- package/lib/projects/structure.d.ts +1 -1
- package/lib/projects/uieLinting.js +6 -8
- package/lib/projects/upload.d.ts +9 -1
- package/lib/projects/upload.js +11 -5
- package/lib/projects/urls.d.ts +1 -0
- package/lib/projects/urls.js +3 -3
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.js +8 -4
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +2 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +19 -13
- package/lib/sandboxSync.d.ts +1 -1
- package/lib/sandboxes.d.ts +1 -1
- package/lib/serverlessLogs.js +0 -1
- package/lib/theme/__tests__/migrate.test.js +12 -4
- package/lib/theme/migrate.js +2 -3
- package/lib/ui/__tests__/SpinniesManager.test.js +0 -1
- package/lib/usageTracking.js +18 -0
- package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +2 -2
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +2 -1
- package/mcp-server/tools/cms/HsCreateModuleTool.js +2 -1
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +2 -1
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +2 -2
- package/mcp-server/tools/cms/HsListTool.js +2 -2
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +4 -4
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +4 -4
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +4 -4
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +4 -4
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +4 -4
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +4 -4
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +4 -3
- package/mcp-server/tools/project/CreateProjectTool.js +4 -3
- package/mcp-server/tools/project/CreateTestAccountTool.d.ts +7 -2
- package/mcp-server/tools/project/CreateTestAccountTool.js +19 -9
- package/mcp-server/tools/project/DocFetchTool.js +2 -1
- package/mcp-server/tools/project/DocsSearchTool.js +2 -1
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +4 -4
- package/mcp-server/tools/project/GetApplicationInfoTool.js +5 -5
- package/mcp-server/tools/project/GetConfigValuesTool.js +2 -1
- package/mcp-server/tools/project/UploadProjectTools.js +6 -3
- package/mcp-server/tools/project/ValidateProjectTool.js +2 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +4 -2
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +4 -2
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +23 -4
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +3 -1
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +0 -1
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +3 -1
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +4 -2
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +8 -5
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +3 -1
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +3 -1
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +7 -3
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +3 -1
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +17 -3
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +3 -1
- package/mcp-server/utils/__tests__/content.test.js +0 -3
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +0 -3
- package/mcp-server/utils/__tests__/project.test.js +65 -4
- package/mcp-server/utils/project.js +6 -2
- package/package.json +15 -17
- package/types/Cms.d.ts +1 -1
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +3 -2
- package/types/PackageJson.d.ts +10 -0
- package/types/PackageJson.js +1 -0
- package/types/ProjectComponents.d.ts +1 -1
- package/ui/components/BoxWithTitle.js +1 -1
- package/ui/components/Table.d.ts +89 -0
- package/ui/components/Table.js +246 -0
- package/ui/lib/table.d.ts +2 -0
- package/ui/lib/table.js +11 -0
- package/ui/playground/Playground.d.ts +5 -0
- package/ui/{views/UiSandbox.js → playground/Playground.js} +4 -4
- package/ui/{lib/ui-testing-utils.d.ts → playground/fixtures.d.ts} +1 -1
- package/ui/{lib/ui-testing-utils.js → playground/fixtures.js} +33 -1
- package/ui/render.d.ts +19 -0
- package/ui/render.js +44 -0
- package/commands/__tests__/create.test.js +0 -53
- package/commands/create.d.ts +0 -4
- package/commands/create.js +0 -137
- package/commands/customObject/__tests__/schema.test.js +0 -53
- package/commands/customObject/schema/create.d.ts +0 -4
- package/commands/customObject/schema/create.js +0 -34
- package/commands/customObject/schema/delete.d.ts +0 -4
- package/commands/customObject/schema/delete.js +0 -37
- package/commands/customObject/schema/fetch-all.d.ts +0 -4
- package/commands/customObject/schema/fetch-all.js +0 -32
- package/commands/customObject/schema/fetch.d.ts +0 -4
- package/commands/customObject/schema/fetch.js +0 -36
- package/commands/customObject/schema/list.d.ts +0 -4
- package/commands/customObject/schema/list.js +0 -26
- package/commands/customObject/schema/update.d.ts +0 -4
- package/commands/customObject/schema/update.js +0 -39
- package/commands/customObject/schema.d.ts +0 -3
- package/commands/customObject/schema.js +0 -31
- package/commands/fetch.d.ts +0 -4
- package/commands/fetch.js +0 -52
- package/commands/function/deploy.d.ts +0 -4
- package/commands/function/deploy.js +0 -31
- package/commands/function/list.d.ts +0 -4
- package/commands/function/list.js +0 -33
- package/commands/function/server.d.ts +0 -4
- package/commands/function/server.js +0 -57
- package/commands/function.d.ts +0 -3
- package/commands/function.js +0 -32
- package/commands/lint.d.ts +0 -4
- package/commands/lint.js +0 -31
- package/commands/list.d.ts +0 -4
- package/commands/list.js +0 -31
- package/commands/logs.d.ts +0 -4
- package/commands/logs.js +0 -58
- package/commands/module/marketplace-validate.d.ts +0 -4
- package/commands/module/marketplace-validate.js +0 -31
- package/commands/module.d.ts +0 -3
- package/commands/module.js +0 -23
- package/commands/mv.d.ts +0 -4
- package/commands/mv.js +0 -35
- package/commands/project/__tests__/migrateApp.test.js +0 -78
- package/commands/project/migrateApp.d.ts +0 -4
- package/commands/project/migrateApp.js +0 -55
- package/commands/remove.d.ts +0 -4
- package/commands/remove.js +0 -31
- package/commands/theme/generate-selectors.d.ts +0 -4
- package/commands/theme/generate-selectors.js +0 -30
- package/commands/theme/marketplace-validate.d.ts +0 -4
- package/commands/theme/marketplace-validate.js +0 -33
- package/commands/theme/preview.d.ts +0 -4
- package/commands/theme/preview.js +0 -59
- package/commands/theme.d.ts +0 -3
- package/commands/theme.js +0 -29
- package/commands/upload.d.ts +0 -4
- package/commands/upload.js +0 -62
- package/commands/watch.d.ts +0 -4
- package/commands/watch.js +0 -73
- package/lib/__tests__/npm.test.js +0 -57
- package/lib/__tests__/projectProfiles.test.js +0 -129
- package/lib/app/__tests__/migrate_legacy.test.js +0 -143
- package/lib/app/migrate_legacy.d.ts +0 -4
- package/lib/app/migrate_legacy.js +0 -121
- package/lib/npm.js +0 -33
- package/lib/projectProfiles.d.ts +0 -7
- package/lib/projectProfiles.js +0 -73
- package/lib/ui/table.d.ts +0 -3
- package/lib/ui/table.js +0 -63
- package/ui/index.d.ts +0 -1
- package/ui/index.js +0 -6
- package/ui/views/UiSandbox.d.ts +0 -5
- /package/commands/__tests__/{create.test.d.ts → upgrade.test.d.ts} +0 -0
- /package/commands/{customObject/__tests__/schema.test.d.ts → cms/__tests__/upload.test.d.ts} +0 -0
- /package/commands/{project/__tests__/migrateApp.test.d.ts → cms/__tests__/watch.test.d.ts} +0 -0
- /package/{lib/__tests__/npm.test.d.ts → commands/project/__tests__/dev.test.d.ts} +0 -0
- /package/lib/__tests__/{projectProfiles.test.d.ts → cliUpgradeUtils.test.d.ts} +0 -0
- /package/lib/{app/__tests__/migrate_legacy.test.d.ts → __tests__/npmCli.test.d.ts} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
2
2
|
import { getConfigAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
3
|
+
import { getAllHsProfiles, } from '@hubspot/project-parsing-lib/profiles';
|
|
3
4
|
import { getProjectConfig, validateProjectConfig, } from '../../../lib/projects/config.js';
|
|
4
5
|
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
5
6
|
import { uiLine } from '../../../lib/ui/index.js';
|
|
@@ -7,10 +8,12 @@ import { deprecatedProjectDevFlow } from './deprecatedFlow.js';
|
|
|
7
8
|
import { unifiedProjectDevFlow } from './unifiedFlow.js';
|
|
8
9
|
import { isV2Project } from '../../../lib/projects/platformVersion.js';
|
|
9
10
|
import { makeYargsBuilder } from '../../../lib/yargsUtils.js';
|
|
10
|
-
import { loadProfile
|
|
11
|
+
import { loadProfile } from '../../../lib/projects/projectProfiles.js';
|
|
11
12
|
import { commands } from '../../../lang/en.js';
|
|
12
13
|
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
13
14
|
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
15
|
+
import path from 'path';
|
|
16
|
+
import { listPrompt } from '../../../lib/prompts/promptUtils.js';
|
|
14
17
|
const command = 'dev';
|
|
15
18
|
const describe = commands.project.dev.describe;
|
|
16
19
|
function validateAccountFlags(testingAccount, projectAccount, userProvidedAccount, useV2) {
|
|
@@ -62,20 +65,29 @@ async function handler(args) {
|
|
|
62
65
|
else if (userProvidedAccount && derivedAccountId) {
|
|
63
66
|
targetProjectAccountId = derivedAccountId;
|
|
64
67
|
}
|
|
68
|
+
// Determine profile name: from flag or prompt
|
|
65
69
|
if (!targetProjectAccountId && isV2Project(projectConfig.platformVersion)) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
let profileName = args.profile;
|
|
71
|
+
if (!profileName) {
|
|
72
|
+
const existingProfiles = await getAllHsProfiles(path.join(projectDir, projectConfig.srcDir));
|
|
73
|
+
if (existingProfiles.length !== 0) {
|
|
74
|
+
profileName = await listPrompt(commands.project.dev.prompts.selectProfile, {
|
|
75
|
+
choices: existingProfiles,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (profileName) {
|
|
80
|
+
try {
|
|
81
|
+
profile = loadProfile(projectConfig, projectDir, profileName);
|
|
82
|
+
targetProjectAccountId = profile.accountId;
|
|
83
|
+
uiLogger.log('');
|
|
84
|
+
uiLogger.log(commands.project.dev.logs.profileProjectAccountExplanation(targetProjectAccountId, profileName));
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
logError(error);
|
|
69
88
|
uiLine();
|
|
70
89
|
process.exit(EXIT_CODES.ERROR);
|
|
71
90
|
}
|
|
72
|
-
targetProjectAccountId = profile.accountId;
|
|
73
|
-
uiLogger.log('');
|
|
74
|
-
uiLogger.log(commands.project.dev.logs.profileProjectAccountExplanation(targetProjectAccountId, args.profile));
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
// A profile must be specified if this project has profiles configured
|
|
78
|
-
await exitIfUsingProfiles(projectConfig, projectDir);
|
|
79
91
|
}
|
|
80
92
|
}
|
|
81
93
|
if (!targetProjectAccountId) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ArgumentsCamelCase } from 'yargs';
|
|
2
|
-
import { HsProfileFile } from '@hubspot/project-parsing-lib/
|
|
2
|
+
import type { HsProfileFile } from '@hubspot/project-parsing-lib/profiles';
|
|
3
3
|
import { ProjectDevArgs } from '../../../types/Yargs.js';
|
|
4
4
|
import { ProjectConfig } from '../../../types/Projects.js';
|
|
5
5
|
type UnifiedProjectDevFlowArgs = {
|
|
@@ -2,8 +2,7 @@ import path from 'path';
|
|
|
2
2
|
import util from 'util';
|
|
3
3
|
import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
|
|
4
4
|
import { startPortManagerServer, stopPortManagerServer, } from '@hubspot/local-dev-lib/portManager';
|
|
5
|
-
import { isTranslationError } from '@hubspot/project-parsing-lib/
|
|
6
|
-
import { translateForLocalDev } from '@hubspot/project-parsing-lib';
|
|
5
|
+
import { isTranslationError, translateForLocalDev, } from '@hubspot/project-parsing-lib/translate';
|
|
7
6
|
import { getConfigAccountEnvironment, getAllConfigAccounts, getConfigAccountById, } from '@hubspot/local-dev-lib/config';
|
|
8
7
|
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
9
8
|
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
@@ -11,7 +10,6 @@ import { ensureProjectExists } from '../../../lib/projects/ensureProjectExists.j
|
|
|
11
10
|
import { createInitialBuildForNewProject, createNewProjectForLocalDev, compareLocalProjectToDeployed, checkAndInstallDependencies, } from '../../../lib/projects/localDev/helpers/project.js';
|
|
12
11
|
import { useExistingDevTestAccount, createDeveloperTestAccountForLocalDev, selectAccountTypePrompt, createSandboxForLocalDev, } from '../../../lib/projects/localDev/helpers/account.js';
|
|
13
12
|
import { selectDeveloperTestTargetAccountPrompt, selectSandboxTargetAccountPrompt, } from '../../../lib/prompts/projectDevTargetAccountPrompt.js';
|
|
14
|
-
import SpinniesManager from '../../../lib/ui/SpinniesManager.js';
|
|
15
13
|
import LocalDevProcess from '../../../lib/projects/localDev/LocalDevProcess.js';
|
|
16
14
|
import LocalDevWatcher from '../../../lib/projects/localDev/LocalDevWatcher.js';
|
|
17
15
|
import { handleExit, handleKeypress } from '../../../lib/process.js';
|
|
@@ -112,7 +110,6 @@ export async function unifiedProjectDevFlow({ args, targetProjectAccountId, prov
|
|
|
112
110
|
noLogs: true,
|
|
113
111
|
});
|
|
114
112
|
let project = uploadedProject;
|
|
115
|
-
SpinniesManager.init();
|
|
116
113
|
if (projectExists && project) {
|
|
117
114
|
await compareLocalProjectToDeployed(projectConfig, targetProjectAccountId, project.deployedBuild?.buildId, projectNodes, args.profile);
|
|
118
115
|
}
|
package/commands/project/list.js
CHANGED
|
@@ -3,9 +3,9 @@ import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
|
3
3
|
import { fetchProjects } from '@hubspot/local-dev-lib/api/projects';
|
|
4
4
|
import { logError } from '../../lib/errorHandlers/index.js';
|
|
5
5
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
6
|
-
import { getTableContents, getTableHeader } from '../../lib/ui/table.js';
|
|
7
6
|
import { uiLogger } from '../../lib/ui/logger.js';
|
|
8
7
|
import { commands } from '../../lang/en.js';
|
|
8
|
+
import { renderTable } from '../../ui/render.js';
|
|
9
9
|
const command = ['list', 'ls'];
|
|
10
10
|
const describe = commands.project.list.describe;
|
|
11
11
|
async function getProjectData(accountId) {
|
|
@@ -37,12 +37,12 @@ async function handler(args) {
|
|
|
37
37
|
process.exit(EXIT_CODES.ERROR);
|
|
38
38
|
}
|
|
39
39
|
const projectListData = formatProjectsAsTableRows(projectData);
|
|
40
|
-
|
|
40
|
+
const tableHeader = [
|
|
41
41
|
commands.project.list.labels.name,
|
|
42
42
|
commands.project.list.labels.platformVersion,
|
|
43
|
-
]
|
|
43
|
+
];
|
|
44
44
|
uiLogger.log(commands.project.list.projects);
|
|
45
|
-
|
|
45
|
+
renderTable(tableHeader, projectListData);
|
|
46
46
|
}
|
|
47
47
|
function projectListBuilder(yargs) {
|
|
48
48
|
yargs.example([['$0 project list']]);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
2
2
|
import { fetchProject, fetchProjectBuilds, } from '@hubspot/local-dev-lib/api/projects';
|
|
3
|
-
import { getTableContents, getTableHeader } from '../../lib/ui/table.js';
|
|
4
3
|
import { uiLink } from '../../lib/ui/index.js';
|
|
5
4
|
import { getProjectConfig, validateProjectConfig, } from '../../lib/projects/config.js';
|
|
6
5
|
import { getProjectDetailUrl } from '../../lib/projects/urls.js';
|
|
@@ -12,6 +11,7 @@ import { logError, ApiErrorContext } from '../../lib/errorHandlers/index.js';
|
|
|
12
11
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
13
12
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
14
13
|
import { commands } from '../../lang/en.js';
|
|
14
|
+
import { renderTable } from '../../ui/render.js';
|
|
15
15
|
const command = 'list-builds';
|
|
16
16
|
const describe = commands.project.listBuilds.describe;
|
|
17
17
|
async function fetchAndDisplayBuilds(accountId, project, options) {
|
|
@@ -44,12 +44,7 @@ async function fetchAndDisplayBuilds(accountId, project, options) {
|
|
|
44
44
|
.join(', '),
|
|
45
45
|
];
|
|
46
46
|
});
|
|
47
|
-
|
|
48
|
-
uiLogger.log(getTableContents(builds, {
|
|
49
|
-
columnDefault: {
|
|
50
|
-
paddingLeft: 3,
|
|
51
|
-
},
|
|
52
|
-
}));
|
|
47
|
+
renderTable(['Build ID', 'Status', 'Completed', 'Duration', 'Details'], builds);
|
|
53
48
|
}
|
|
54
49
|
if (paging && paging.next) {
|
|
55
50
|
await promptUser({
|
package/commands/project/logs.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getConfigAccountEnvironment } from '@hubspot/local-dev-lib/config';
|
|
2
2
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
3
3
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
4
|
-
import { getTableContents, getTableHeader } from '../../lib/ui/table.js';
|
|
5
4
|
import { logError } from '../../lib/errorHandlers/index.js';
|
|
6
5
|
import { uiLine } from '../../lib/ui/index.js';
|
|
7
6
|
import { projectLogsPrompt } from '../../lib/prompts/projectsLogsPrompt.js';
|
|
@@ -10,32 +9,40 @@ import { uiLogger } from '../../lib/ui/logger.js';
|
|
|
10
9
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
11
10
|
import { ProjectLogsManager } from '../../lib/projects/ProjectLogsManager.js';
|
|
12
11
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
12
|
+
import { renderTable } from '../../ui/render.js';
|
|
13
13
|
function getPrivateAppsUrl(accountId) {
|
|
14
14
|
const baseUrl = getHubSpotWebsiteOrigin(getConfigAccountEnvironment(accountId));
|
|
15
15
|
return `${baseUrl}/private-apps/${accountId}`;
|
|
16
16
|
}
|
|
17
|
-
function logTable(tableHeader, logsInfo) {
|
|
18
|
-
uiLogger.log(commands.project.logs.logs.showingLogs);
|
|
19
|
-
uiLogger.log(getTableContents([tableHeader, logsInfo], { border: { bodyLeft: ' ' } }));
|
|
20
|
-
}
|
|
21
17
|
function logPreamble() {
|
|
22
18
|
if (ProjectLogsManager.isPublicFunction) {
|
|
23
|
-
|
|
19
|
+
uiLogger.log(commands.project.logs.logs.showingLogs);
|
|
20
|
+
renderTable([
|
|
24
21
|
commands.project.logs.table.accountHeader,
|
|
25
22
|
commands.project.logs.table.functionHeader,
|
|
26
23
|
commands.project.logs.table.endpointHeader,
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
], [
|
|
25
|
+
[
|
|
26
|
+
String(ProjectLogsManager.accountId),
|
|
27
|
+
String(ProjectLogsManager.functionName),
|
|
28
|
+
String(ProjectLogsManager.endpointName),
|
|
29
|
+
],
|
|
31
30
|
]);
|
|
31
|
+
uiLogger.log('');
|
|
32
32
|
uiLogger.log(commands.project.logs.logs.hubspotLogsDirectLink(`${getPrivateAppsUrl(ProjectLogsManager.accountId)}/${ProjectLogsManager.appId}/logs/serverlessGatewayExecution?path=${ProjectLogsManager.endpointName}`));
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
|
|
35
|
+
uiLogger.log(commands.project.logs.logs.showingLogs);
|
|
36
|
+
renderTable([
|
|
36
37
|
commands.project.logs.table.accountHeader,
|
|
37
38
|
commands.project.logs.table.functionHeader,
|
|
38
|
-
]
|
|
39
|
+
], [
|
|
40
|
+
[
|
|
41
|
+
String(ProjectLogsManager.accountId),
|
|
42
|
+
String(ProjectLogsManager.functionName),
|
|
43
|
+
],
|
|
44
|
+
]);
|
|
45
|
+
uiLogger.log('');
|
|
39
46
|
uiLogger.log(commands.project.logs.logs.hubspotLogsDirectLink(`${getPrivateAppsUrl(ProjectLogsManager.accountId)}/${ProjectLogsManager.appId}/logs/crm?serverlessFunction=${ProjectLogsManager.functionName}`));
|
|
40
47
|
}
|
|
41
48
|
uiLogger.log('');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { migrateApp } from '../../lib/app/migrate.js';
|
|
2
2
|
import { getProjectConfig } from '../../lib/projects/config.js';
|
|
3
3
|
import { PLATFORM_VERSIONS } from '@hubspot/local-dev-lib/constants/projects';
|
|
4
4
|
import { logError } from '../../lib/errorHandlers/index.js';
|
|
@@ -7,7 +7,7 @@ import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
|
7
7
|
import { uiCommandReference } from '../../lib/ui/index.js';
|
|
8
8
|
import { commands, lib } from '../../lang/en.js';
|
|
9
9
|
import { uiLogger } from '../../lib/ui/logger.js';
|
|
10
|
-
import { renderInline } from '../../ui/
|
|
10
|
+
import { renderInline } from '../../ui/render.js';
|
|
11
11
|
import { getWarningBox } from '../../ui/components/StatusMessageBoxes.js';
|
|
12
12
|
import { getHasMigratableThemes, migrateThemes2025_2, } from '../../lib/theme/migrate.js';
|
|
13
13
|
import { hasFeature } from '../../lib/hasFeature.js';
|
|
@@ -46,7 +46,7 @@ async function handler(args) {
|
|
|
46
46
|
}, migratableThemesCount, projectConfig);
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
|
-
await
|
|
49
|
+
await migrateApp(derivedAccountId, {
|
|
50
50
|
...args,
|
|
51
51
|
name: projectConfig?.projectConfig?.name,
|
|
52
52
|
platformVersion: unstable
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import { getConfigAccountIfExists, getAllConfigAccounts, } from '@hubspot/local-dev-lib/config';
|
|
4
|
-
import { getAllHsProfiles, getHsProfileFilename, loadHsProfileFile, } from '@hubspot/project-parsing-lib';
|
|
4
|
+
import { getAllHsProfiles, getHsProfileFilename, loadHsProfileFile, } from '@hubspot/project-parsing-lib/profiles';
|
|
5
5
|
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
6
6
|
import { getProjectConfig } from '../../../lib/projects/config.js';
|
|
7
7
|
import { uiAccountDescription } from '../../../lib/ui/index.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { getAllHsProfiles, getHsProfileFilename, loadHsProfileFile, } from '@hubspot/project-parsing-lib';
|
|
3
|
+
import { getAllHsProfiles, getHsProfileFilename, loadHsProfileFile, } from '@hubspot/project-parsing-lib/profiles';
|
|
4
4
|
import { fetchProject, deleteProject, } from '@hubspot/local-dev-lib/api/projects';
|
|
5
5
|
import { getConfigAccountById } from '@hubspot/local-dev-lib/config';
|
|
6
6
|
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
@@ -7,7 +7,7 @@ import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
|
7
7
|
import { getProjectConfig, validateProjectConfig, } from '../../lib/projects/config.js';
|
|
8
8
|
import { logFeedbackMessage } from '../../lib/projects/ui.js';
|
|
9
9
|
import { handleProjectUpload } from '../../lib/projects/upload.js';
|
|
10
|
-
import { loadAndValidateProfile } from '../../lib/projectProfiles.js';
|
|
10
|
+
import { loadAndValidateProfile } from '../../lib/projects/projectProfiles.js';
|
|
11
11
|
import { displayWarnLogs, pollProjectBuildAndDeploy, } from '../../lib/projects/pollProjectBuildAndDeploy.js';
|
|
12
12
|
import { commands } from '../../lang/en.js';
|
|
13
13
|
import { PROJECT_ERROR_TYPES } from '../../lib/constants.js';
|
|
@@ -28,8 +28,14 @@ async function handler(args) {
|
|
|
28
28
|
process.exit(EXIT_CODES.ERROR);
|
|
29
29
|
}
|
|
30
30
|
let targetAccountId;
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
try {
|
|
32
|
+
if (isV2Project(projectConfig.platformVersion)) {
|
|
33
|
+
targetAccountId = await loadAndValidateProfile(projectConfig, projectDir, profile);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
logError(err);
|
|
38
|
+
process.exit(EXIT_CODES.ERROR);
|
|
33
39
|
}
|
|
34
40
|
targetAccountId = targetAccountId || derivedAccountId;
|
|
35
41
|
const accountConfig = getConfigAccountById(targetAccountId);
|
|
@@ -111,12 +117,15 @@ function projectUploadBuilder(yargs) {
|
|
|
111
117
|
type: 'string',
|
|
112
118
|
alias: 'p',
|
|
113
119
|
describe: commands.project.upload.options.profile.describe,
|
|
114
|
-
hidden: true,
|
|
115
120
|
},
|
|
116
121
|
});
|
|
117
122
|
yargs.conflicts('profile', 'account');
|
|
118
123
|
yargs.example([
|
|
119
124
|
['$0 project upload', commands.project.upload.examples.default],
|
|
125
|
+
[
|
|
126
|
+
'$0 project upload --profile=profileName',
|
|
127
|
+
commands.project.upload.examples.withProfile,
|
|
128
|
+
],
|
|
120
129
|
]);
|
|
121
130
|
return yargs;
|
|
122
131
|
}
|
|
@@ -8,13 +8,18 @@ import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
|
8
8
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
9
9
|
import { validateSourceDirectory, handleTranslate, } from '../../lib/projects/upload.js';
|
|
10
10
|
import { commands } from '../../lang/en.js';
|
|
11
|
-
import {
|
|
11
|
+
import { validateProjectForProfile } from '../../lib/projects/projectProfiles.js';
|
|
12
12
|
import { logError } from '../../lib/errorHandlers/index.js';
|
|
13
|
+
import { getAllHsProfiles } from '@hubspot/project-parsing-lib/profiles';
|
|
14
|
+
import SpinniesManager from '../../lib/ui/SpinniesManager.js';
|
|
13
15
|
const command = 'validate';
|
|
14
16
|
const describe = commands.project.validate.describe;
|
|
15
17
|
async function handler(args) {
|
|
16
18
|
const { derivedAccountId, profile } = args;
|
|
17
19
|
const { projectConfig, projectDir } = await getProjectConfig();
|
|
20
|
+
const accountConfig = getConfigAccountById(derivedAccountId);
|
|
21
|
+
const accountType = accountConfig && accountConfig.accountType;
|
|
22
|
+
trackCommandUsage('project-validate', { type: accountType }, derivedAccountId);
|
|
18
23
|
if (!projectConfig || !projectDir) {
|
|
19
24
|
uiLogger.error(commands.project.validate.mustBeRanWithinAProject);
|
|
20
25
|
process.exit(EXIT_CODES.ERROR);
|
|
@@ -30,25 +35,78 @@ async function handler(args) {
|
|
|
30
35
|
logError(error);
|
|
31
36
|
process.exit(EXIT_CODES.ERROR);
|
|
32
37
|
}
|
|
33
|
-
let
|
|
34
|
-
targetAccountId = targetAccountId || derivedAccountId;
|
|
35
|
-
const accountConfig = getConfigAccountById(targetAccountId);
|
|
36
|
-
const accountType = accountConfig && accountConfig.accountType;
|
|
37
|
-
trackCommandUsage('project-validate', { type: accountType }, targetAccountId);
|
|
38
|
+
let validationSucceeded = true;
|
|
38
39
|
const srcDir = path.resolve(projectDir, projectConfig.srcDir);
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const profiles = await getAllHsProfiles(path.join(projectDir, projectConfig.srcDir));
|
|
41
|
+
// If a profile is specified, only validate that profile
|
|
42
|
+
if (profile) {
|
|
43
|
+
const validationErrors = await validateProjectForProfile({
|
|
44
|
+
projectConfig,
|
|
45
|
+
projectDir,
|
|
46
|
+
profileName: profile,
|
|
47
|
+
derivedAccountId,
|
|
48
|
+
});
|
|
49
|
+
if (validationErrors.length) {
|
|
50
|
+
logValidationErrors(validationErrors);
|
|
51
|
+
validationSucceeded = false;
|
|
52
|
+
}
|
|
41
53
|
}
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
else if (profiles.length > 0) {
|
|
55
|
+
// If no profile was specified and the project has profiles, validate all of them
|
|
56
|
+
SpinniesManager.add('validatingAllProfiles', {
|
|
57
|
+
text: commands.project.validate.spinners.validatingAllProfiles,
|
|
58
|
+
});
|
|
59
|
+
const errors = [];
|
|
60
|
+
for (const profileName of profiles) {
|
|
61
|
+
const validationErrors = await validateProjectForProfile({
|
|
62
|
+
projectConfig,
|
|
63
|
+
projectDir,
|
|
64
|
+
profileName,
|
|
65
|
+
derivedAccountId,
|
|
66
|
+
indentSpinners: true,
|
|
67
|
+
});
|
|
68
|
+
if (validationErrors.length) {
|
|
69
|
+
errors.push(...validationErrors);
|
|
70
|
+
validationSucceeded = false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (validationSucceeded) {
|
|
74
|
+
SpinniesManager.succeed('validatingAllProfiles', {
|
|
75
|
+
text: commands.project.validate.spinners.allProfilesValidationSucceeded,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
SpinniesManager.fail('validatingAllProfiles', {
|
|
80
|
+
text: commands.project.validate.spinners.allProfilesValidationFailed,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
logValidationErrors(errors);
|
|
84
|
+
}
|
|
85
|
+
else if (profiles.length === 0) {
|
|
86
|
+
// If the project has no profiles, validate the project without a profile
|
|
87
|
+
try {
|
|
88
|
+
await handleTranslate({
|
|
89
|
+
projectDir: projectDir,
|
|
90
|
+
projectConfig,
|
|
91
|
+
accountId: derivedAccountId,
|
|
92
|
+
skipValidation: false,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
uiLogger.error(commands.project.validate.failure(projectConfig.name));
|
|
97
|
+
logError(e);
|
|
98
|
+
validationSucceeded = false;
|
|
99
|
+
uiLogger.log('');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (!validationSucceeded) {
|
|
44
103
|
process.exit(EXIT_CODES.ERROR);
|
|
45
104
|
}
|
|
46
105
|
try {
|
|
47
|
-
await
|
|
106
|
+
await validateSourceDirectory(srcDir, projectConfig, projectDir);
|
|
48
107
|
}
|
|
49
108
|
catch (e) {
|
|
50
109
|
logError(e);
|
|
51
|
-
uiLogger.error(commands.project.validate.failure(projectConfig.name));
|
|
52
110
|
process.exit(EXIT_CODES.ERROR);
|
|
53
111
|
}
|
|
54
112
|
uiLogger.success(commands.project.validate.success(projectConfig.name));
|
|
@@ -60,15 +118,29 @@ function projectValidateBuilder(yargs) {
|
|
|
60
118
|
type: 'string',
|
|
61
119
|
alias: 'p',
|
|
62
120
|
describe: commands.project.validate.options.profile.describe,
|
|
63
|
-
hidden: true,
|
|
64
121
|
},
|
|
65
122
|
});
|
|
66
123
|
yargs.conflicts('profile', 'account');
|
|
67
124
|
yargs.example([
|
|
68
125
|
['$0 project validate', commands.project.validate.examples.default],
|
|
126
|
+
[
|
|
127
|
+
'$0 project validate --profile=profileName',
|
|
128
|
+
commands.project.validate.examples.withProfile,
|
|
129
|
+
],
|
|
69
130
|
]);
|
|
70
131
|
return yargs;
|
|
71
132
|
}
|
|
133
|
+
function logValidationErrors(validationErrors) {
|
|
134
|
+
uiLogger.log('');
|
|
135
|
+
validationErrors.forEach(error => {
|
|
136
|
+
if (error instanceof Error) {
|
|
137
|
+
logError(error);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
uiLogger.log(error);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
72
144
|
const builder = makeYargsBuilder(projectValidateBuilder, command, describe, {
|
|
73
145
|
useGlobalOptions: true,
|
|
74
146
|
useConfigOptions: true,
|
|
@@ -58,13 +58,6 @@ async function handler(args) {
|
|
|
58
58
|
const { initialUpload, derivedAccountId } = args;
|
|
59
59
|
trackCommandUsage('project-watch', undefined, derivedAccountId);
|
|
60
60
|
const { projectConfig, projectDir } = await getProjectConfig();
|
|
61
|
-
try {
|
|
62
|
-
validateProjectConfig(projectConfig, projectDir);
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
logError(error);
|
|
66
|
-
process.exit(EXIT_CODES.ERROR);
|
|
67
|
-
}
|
|
68
61
|
if (!projectConfig || !projectDir) {
|
|
69
62
|
uiLogger.error(commands.project.watch.errors.projectConfigNotFound);
|
|
70
63
|
return process.exit(EXIT_CODES.ERROR);
|
|
@@ -73,6 +66,13 @@ async function handler(args) {
|
|
|
73
66
|
uiLogger.error(projectConfig.platformVersion);
|
|
74
67
|
return process.exit(EXIT_CODES.ERROR);
|
|
75
68
|
}
|
|
69
|
+
try {
|
|
70
|
+
validateProjectConfig(projectConfig, projectDir);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
logError(error);
|
|
74
|
+
process.exit(EXIT_CODES.ERROR);
|
|
75
|
+
}
|
|
76
76
|
try {
|
|
77
77
|
const { data: { results: builds }, } = await fetchProjectBuilds(derivedAccountId, projectConfig.name);
|
|
78
78
|
const hasNoBuilds = !builds || !builds.length;
|
package/commands/project.js
CHANGED
|
@@ -10,8 +10,6 @@ import open from './project/open.js';
|
|
|
10
10
|
import dev from './project/dev/index.js';
|
|
11
11
|
import add from './project/add.js';
|
|
12
12
|
import migrate from './project/migrate.js';
|
|
13
|
-
import migrateApp from './project/migrateApp.js';
|
|
14
|
-
import cloneApp from './project/cloneApp.js';
|
|
15
13
|
import installDeps from './project/installDeps.js';
|
|
16
14
|
import lint from './project/lint.js';
|
|
17
15
|
import updateDeps from './project/updateDeps.js';
|
|
@@ -34,9 +32,7 @@ function projectBuilder(yargs) {
|
|
|
34
32
|
.command(listBuilds)
|
|
35
33
|
.command(download)
|
|
36
34
|
.command(open)
|
|
37
|
-
.command(migrateApp)
|
|
38
35
|
.command(migrate)
|
|
39
|
-
.command(cloneApp)
|
|
40
36
|
.command(installDeps)
|
|
41
37
|
.command(lint)
|
|
42
38
|
.command(updateDeps)
|
|
@@ -15,7 +15,6 @@ import * as sandboxesLib from '../../../lib/sandboxes.js';
|
|
|
15
15
|
import * as sandboxSync from '../../../lib/sandboxSync.js';
|
|
16
16
|
import { vi } from 'vitest';
|
|
17
17
|
import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
|
|
18
|
-
vi.mock('../../../lib/ui/logger.js');
|
|
19
18
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
20
19
|
vi.mock('../../../lib/commonOpts');
|
|
21
20
|
vi.mock('../../../lib/hasFeature');
|
|
@@ -23,7 +22,6 @@ vi.mock('../../../lib/prompts/sandboxesPrompt');
|
|
|
23
22
|
vi.mock('../../../lib/prompts/promptUtils');
|
|
24
23
|
vi.mock('../../../lib/prompts/accountNamePrompt');
|
|
25
24
|
vi.mock('../../../lib/sandboxes');
|
|
26
|
-
vi.mock('../../../lib/usageTracking');
|
|
27
25
|
vi.mock('../../../lib/buildAccount');
|
|
28
26
|
vi.mock('../../../lib/sandboxes');
|
|
29
27
|
vi.mock('../../../lib/commonOpts');
|