@hubspot/cli 7.5.11-experimental.0 → 7.6.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/bin/cli.js +102 -95
- package/commands/account/auth.d.ts +5 -7
- package/commands/account/auth.js +74 -87
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +16 -9
- package/commands/account/createOverride.d.ts +3 -7
- package/commands/account/createOverride.js +23 -6
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +13 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +15 -8
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +21 -9
- package/commands/account/removeOverride.d.ts +3 -7
- package/commands/account/removeOverride.js +23 -6
- package/commands/account/rename.d.ts +3 -7
- package/commands/account/rename.js +16 -9
- package/commands/account/use.d.ts +5 -9
- package/commands/account/use.js +14 -6
- package/commands/account.d.ts +3 -4
- package/commands/account.js +33 -58
- package/commands/app/migrate.d.ts +1 -2
- package/commands/app/migrate.js +7 -8
- package/commands/app/secret/add.d.ts +7 -0
- package/commands/app/secret/add.js +64 -0
- package/commands/app/secret/delete.d.ts +8 -0
- package/commands/app/secret/delete.js +87 -0
- package/commands/app/secret/list.d.ts +6 -0
- package/commands/app/secret/list.js +64 -0
- package/commands/app/secret/update.d.ts +7 -0
- package/commands/app/secret/update.js +77 -0
- package/commands/app/secret.d.ts +3 -0
- package/commands/app/secret.js +30 -0
- package/commands/app.d.ts +2 -5
- package/commands/app.js +10 -8
- package/commands/auth.d.ts +5 -7
- package/commands/auth.js +29 -28
- package/commands/cms/convertFields.d.ts +7 -1
- package/commands/cms/convertFields.js +57 -41
- package/commands/cms/getReactModule.d.ts +7 -1
- package/commands/cms/getReactModule.js +52 -34
- package/commands/cms/lighthouseScore.d.ts +8 -1
- package/commands/cms/lighthouseScore.js +129 -100
- package/commands/cms.d.ts +3 -1
- package/commands/cms.js +22 -15
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +23 -12
- package/commands/config/migrate.d.ts +3 -7
- package/commands/config/migrate.js +37 -46
- package/commands/config/set.d.ts +5 -6
- package/commands/config/set.js +38 -14
- package/commands/config.d.ts +3 -4
- package/commands/config.js +18 -44
- package/commands/create/api-sample.d.ts +3 -1
- package/commands/create/api-sample.js +34 -38
- package/commands/create/app.d.ts +3 -1
- package/commands/create/app.js +9 -7
- package/commands/create/function.d.ts +3 -1
- package/commands/create/function.js +11 -10
- package/commands/create/index.d.ts +5 -1
- package/commands/create/index.js +23 -11
- package/commands/create/module.d.ts +3 -1
- package/commands/create/module.js +14 -13
- package/commands/create/react-app.d.ts +3 -1
- package/commands/create/react-app.js +10 -7
- package/commands/create/template.d.ts +3 -1
- package/commands/create/template.js +14 -14
- package/commands/create/vue-app.d.ts +3 -1
- package/commands/create/vue-app.js +10 -7
- package/commands/create/webpack-serverless.d.ts +3 -1
- package/commands/create/webpack-serverless.js +10 -7
- package/commands/create/website-theme.d.ts +3 -1
- package/commands/create/website-theme.js +10 -9
- package/commands/create.d.ts +4 -24
- package/commands/create.js +62 -74
- package/commands/customObject/create.d.ts +4 -9
- package/commands/customObject/create.js +17 -10
- package/commands/customObject/schema/create.d.ts +4 -9
- package/commands/customObject/schema/create.js +18 -11
- package/commands/customObject/schema/delete.d.ts +4 -9
- package/commands/customObject/schema/delete.js +17 -10
- package/commands/customObject/schema/fetch-all.d.ts +4 -9
- package/commands/customObject/schema/fetch-all.js +17 -10
- package/commands/customObject/schema/fetch.d.ts +4 -9
- package/commands/customObject/schema/fetch.js +17 -10
- package/commands/customObject/schema/list.d.ts +4 -8
- package/commands/customObject/schema/list.js +17 -10
- package/commands/customObject/schema/update.d.ts +4 -9
- package/commands/customObject/schema/update.js +18 -11
- package/commands/customObject/schema.d.ts +3 -5
- package/commands/customObject/schema.js +27 -54
- package/commands/customObject.d.ts +3 -4
- package/commands/customObject.js +18 -45
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +30 -21
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +38 -47
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -33
- package/commands/filemanager/fetch.d.ts +4 -9
- package/commands/filemanager/fetch.js +18 -11
- package/commands/filemanager/upload.d.ts +4 -9
- package/commands/filemanager/upload.js +17 -11
- package/commands/filemanager.d.ts +3 -4
- package/commands/filemanager.js +18 -41
- package/commands/function/deploy.d.ts +6 -1
- package/commands/function/deploy.js +70 -50
- package/commands/function/list.d.ts +6 -1
- package/commands/function/list.js +44 -32
- package/commands/function/server.d.ts +10 -1
- package/commands/function/server.js +49 -38
- package/commands/function.d.ts +5 -1
- package/commands/function.js +22 -10
- package/commands/getStarted.d.ts +9 -0
- package/commands/getStarted.js +227 -0
- package/commands/hubdb/clear.d.ts +4 -9
- package/commands/hubdb/clear.js +17 -10
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +17 -10
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +17 -10
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +17 -10
- package/commands/hubdb/list.d.ts +4 -0
- package/commands/hubdb/list.js +83 -0
- package/commands/hubdb.d.ts +3 -2
- package/commands/hubdb.js +23 -45
- package/commands/init.d.ts +3 -7
- package/commands/init.js +17 -8
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +42 -43
- package/commands/list.d.ts +3 -7
- package/commands/list.js +17 -11
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -44
- package/commands/mcp/setup.d.ts +7 -0
- package/commands/mcp/setup.js +52 -0
- package/commands/mcp/start.d.ts +3 -0
- package/commands/mcp/start.js +77 -0
- package/commands/mcp.d.ts +3 -0
- package/commands/mcp.js +26 -0
- package/commands/module/marketplace-validate.d.ts +6 -1
- package/commands/module/marketplace-validate.js +39 -29
- package/commands/module.d.ts +3 -1
- package/commands/module.js +23 -10
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +17 -11
- package/commands/open.d.ts +3 -7
- package/commands/open.js +17 -11
- package/commands/project/add.d.ts +5 -2
- package/commands/project/add.js +43 -80
- package/commands/project/cloneApp.d.ts +1 -1
- package/commands/project/cloneApp.js +2 -2
- package/commands/project/create.d.ts +2 -8
- package/commands/project/create.js +84 -55
- package/commands/project/deploy.d.ts +2 -0
- package/commands/project/deploy.js +67 -13
- package/commands/project/dev/deprecatedFlow.d.ts +8 -2
- package/commands/project/dev/deprecatedFlow.js +9 -1
- package/commands/project/dev/index.d.ts +1 -4
- package/commands/project/dev/index.js +88 -31
- package/commands/project/dev/unifiedFlow.d.ts +11 -2
- package/commands/project/dev/unifiedFlow.js +81 -41
- package/commands/project/listBuilds.js +2 -5
- package/commands/project/migrate.d.ts +1 -0
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +209 -0
- package/commands/project/profile/delete.d.ts +6 -0
- package/commands/project/profile/delete.js +123 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +25 -0
- package/commands/project/upload.d.ts +1 -0
- package/commands/project/upload.js +22 -8
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +82 -0
- package/commands/project.js +4 -2
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +22 -22
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +18 -11
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +18 -11
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +18 -43
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +17 -10
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +17 -10
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +17 -10
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +17 -10
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +23 -48
- package/commands/testAccount/create.d.ts +6 -0
- package/commands/testAccount/create.js +100 -0
- package/commands/testAccount/createConfig.d.ts +10 -0
- package/commands/testAccount/createConfig.js +98 -0
- package/commands/testAccount/delete.d.ts +6 -0
- package/commands/testAccount/delete.js +48 -0
- package/commands/testAccount.d.ts +3 -0
- package/commands/testAccount.js +28 -0
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +20 -15
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +22 -17
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +32 -26
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +22 -47
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +116 -134
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +74 -75
- package/lang/en.d.ts +1135 -660
- package/lang/en.js +935 -471
- package/lang/en.lyaml +30 -213
- package/lib/accountTypes.js +1 -2
- package/lib/app/migrate.d.ts +23 -0
- package/lib/app/migrate.js +29 -6
- package/lib/app/migrate_legacy.js +7 -7
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/commonOpts.d.ts +1 -3
- package/lib/commonOpts.js +1 -1
- package/lib/configMigrate.d.ts +2 -2
- package/lib/configMigrate.js +34 -55
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -46
- package/lib/constants.d.ts +29 -0
- package/lib/constants.js +30 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +13 -39
- package/lib/doctor/Doctor.js +3 -2
- package/lib/errorHandlers/index.js +7 -0
- package/lib/filesystem.d.ts +1 -1
- package/lib/generateSelectors.js +3 -5
- package/lib/interpolation.d.ts +2 -3
- package/lib/lang.d.ts +2 -3
- package/lib/marketplaceValidate.d.ts +12 -2
- package/lib/marketplaceValidate.js +22 -29
- package/lib/mcp/setup.d.ts +21 -0
- package/lib/mcp/setup.js +218 -0
- package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/middleware/configMiddleware.js +23 -0
- package/lib/middleware/fireAlarmMiddleware.d.ts +2 -2
- package/lib/middleware/fireAlarmMiddleware.js +5 -3
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/projectProfiles.d.ts +7 -0
- package/lib/projectProfiles.js +83 -0
- package/lib/projects/add/legacyAddComponent.d.ts +5 -0
- package/lib/projects/add/legacyAddComponent.js +48 -0
- package/lib/projects/add/v3AddComponent.d.ts +8 -0
- package/lib/projects/add/v3AddComponent.js +85 -0
- package/lib/projects/buildAndDeploy.js +18 -3
- package/lib/projects/components.d.ts +2 -0
- package/lib/projects/components.js +82 -0
- package/lib/projects/create/index.d.ts +23 -0
- package/lib/projects/create/index.js +33 -0
- package/lib/projects/create/legacy.d.ts +6 -0
- package/lib/projects/{create.js → create/legacy.js} +20 -11
- package/lib/projects/create/v3.d.ts +27 -0
- package/lib/projects/create/v3.js +158 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +30 -0
- package/lib/projects/localDev/AppDevModeInterface.js +215 -0
- package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
- package/lib/projects/localDev/DevServerManagerV2.js +19 -15
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +159 -0
- package/lib/projects/localDev/LocalDevManager.js +12 -5
- package/lib/projects/localDev/LocalDevProcess.d.ts +34 -0
- package/lib/projects/localDev/LocalDevProcess.js +201 -0
- package/lib/projects/localDev/LocalDevState.d.ts +50 -0
- package/lib/projects/localDev/LocalDevState.js +119 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +53 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +20 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +131 -0
- package/lib/projects/localDev/helpers.d.ts +3 -2
- package/lib/projects/localDev/helpers.js +32 -2
- package/lib/projects/upload.d.ts +5 -1
- package/lib/projects/upload.js +60 -20
- package/lib/projects/urls.d.ts +3 -0
- package/lib/projects/urls.js +17 -1
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +17 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +96 -0
- package/lib/prompts/createProjectPrompt.d.ts +14 -5
- package/lib/prompts/createProjectPrompt.js +38 -13
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/prompts/installAppPrompt.d.ts +2 -0
- package/lib/prompts/installAppPrompt.js +45 -0
- package/lib/prompts/personalAccessKeyPrompt.js +35 -24
- package/lib/prompts/projectAddPrompt.d.ts +5 -1
- package/lib/prompts/projectAddPrompt.js +35 -7
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +6 -6
- package/lib/prompts/promptUtils.d.ts +4 -1
- package/lib/prompts/promptUtils.js +5 -1
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +40 -0
- package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
- package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -8
- package/lib/prompts/setAsDefaultAccountPrompt.js +10 -0
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/ui/index.js +4 -1
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +4 -0
- package/lib/yargsUtils.js +6 -0
- package/mcp-server/server.d.ts +1 -0
- package/mcp-server/server.js +18 -0
- package/mcp-server/tools/index.d.ts +2 -0
- package/mcp-server/tools/index.js +19 -0
- package/mcp-server/tools/project/AddFeatureToProject.d.ts +29 -0
- package/mcp-server/tools/project/AddFeatureToProject.js +85 -0
- package/mcp-server/tools/project/CreateProjectTool.d.ts +35 -0
- package/mcp-server/tools/project/CreateProjectTool.js +104 -0
- package/mcp-server/tools/project/DeployProject.d.ts +20 -0
- package/mcp-server/tools/project/DeployProject.js +50 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +17 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +58 -0
- package/mcp-server/tools/project/UploadProjectTools.d.ts +17 -0
- package/mcp-server/tools/project/UploadProjectTools.js +35 -0
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +17 -0
- package/mcp-server/tools/project/ValidateProjectTool.js +35 -0
- package/mcp-server/tools/project/constants.d.ts +3 -0
- package/mcp-server/tools/project/constants.js +13 -0
- package/mcp-server/types.d.ts +14 -0
- package/mcp-server/types.js +17 -0
- package/mcp-server/utils/command.d.ts +3 -0
- package/mcp-server/utils/command.js +16 -0
- package/mcp-server/utils/content.d.ts +3 -0
- package/mcp-server/utils/content.js +21 -0
- package/mcp-server/utils/project.d.ts +5 -0
- package/mcp-server/utils/project.js +17 -0
- package/package.json +24 -16
- package/types/Cms.d.ts +30 -0
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +35 -0
- package/types/LocalDev.js +2 -0
- package/types/Projects.d.ts +19 -2
- package/types/Prompts.d.ts +0 -7
- package/types/Yargs.d.ts +10 -1
- package/lib/projects/create.d.ts +0 -5
- package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
- package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- package/lib/prompts/installPublicAppPrompt.js +0 -41
|
@@ -5,71 +5,75 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const path_1 = __importDefault(require("path"));
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
8
|
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
11
9
|
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
12
10
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
13
|
-
const createProjectPrompt_1 = require("../../lib/prompts/createProjectPrompt");
|
|
14
11
|
const config_1 = require("../../lib/projects/config");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
12
|
+
const legacy_1 = require("../../lib/projects/create/legacy");
|
|
13
|
+
const v3_1 = require("../../lib/projects/create/v3");
|
|
17
14
|
const ui_1 = require("../../lib/ui");
|
|
18
15
|
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
19
16
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
20
17
|
const constants_1 = require("../../lib/constants");
|
|
21
18
|
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
22
|
-
const
|
|
23
|
-
const
|
|
19
|
+
const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
20
|
+
const en_1 = require("../../lang/en");
|
|
21
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
22
|
+
const v3_2 = require("../../lib/projects/create/v3");
|
|
23
|
+
const create_1 = require("../../lib/projects/create");
|
|
24
|
+
const command = ['create', 'init'];
|
|
25
|
+
const describe = (0, ui_1.uiBetaTag)(en_1.commands.project.create.describe, false);
|
|
26
|
+
const { v2023_2, v2025_1, v2025_2 } = projects_1.PLATFORM_VERSIONS;
|
|
24
27
|
async function handler(args) {
|
|
25
|
-
const { derivedAccountId } = args;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (!templateSource) {
|
|
29
|
-
templateSource = constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH;
|
|
30
|
-
try {
|
|
31
|
-
const releaseData = await (0, github_1.fetchReleaseData)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH);
|
|
32
|
-
if (releaseData) {
|
|
33
|
-
latestRepoReleaseTag = releaseData.tag_name;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch (err) {
|
|
37
|
-
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.create.error.failedToFetchProjectList`));
|
|
38
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (!templateSource || !templateSource.includes('/')) {
|
|
42
|
-
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.create.error.invalidTemplateSource`));
|
|
28
|
+
const { derivedAccountId, platformVersion, templateSource } = args;
|
|
29
|
+
if (templateSource && !templateSource.includes('/')) {
|
|
30
|
+
logger_1.uiLogger.error(en_1.commands.project.create.errors.invalidTemplateSource);
|
|
43
31
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
44
32
|
}
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
const repo = templateSource || constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH;
|
|
34
|
+
let handleResult;
|
|
35
|
+
try {
|
|
36
|
+
handleResult = await (0, create_1.handleProjectCreationFlow)(args);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
(0, errorHandlers_1.logError)(error);
|
|
48
40
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
49
41
|
}
|
|
50
|
-
const
|
|
42
|
+
const { authType, distribution, repoConfig, projectContents, createProjectPromptResponse, } = handleResult;
|
|
43
|
+
(0, usageTracking_1.trackCommandUsage)('project-create', {
|
|
44
|
+
type: createProjectPromptResponse.projectTemplate?.name ||
|
|
45
|
+
(createProjectPromptResponse.componentTemplates || [])
|
|
46
|
+
// @ts-expect-error
|
|
47
|
+
.map((item) => item.label)
|
|
48
|
+
.join(','),
|
|
49
|
+
}, derivedAccountId);
|
|
51
50
|
const projectDest = path_1.default.resolve((0, path_2.getCwd)(), createProjectPromptResponse.dest);
|
|
52
|
-
(0, usageTracking_1.trackCommandUsage)('project-create', { type: createProjectPromptResponse.projectTemplate.name }, derivedAccountId);
|
|
53
51
|
const { projectConfig: existingProjectConfig, projectDir: existingProjectDir, } = await (0, config_1.getProjectConfig)(projectDest);
|
|
54
52
|
// Exit if the target destination is within an existing project
|
|
55
53
|
if (existingProjectConfig &&
|
|
56
54
|
existingProjectDir &&
|
|
57
55
|
projectDest.startsWith(existingProjectDir)) {
|
|
58
|
-
logger_1.
|
|
59
|
-
projectDir: existingProjectDir,
|
|
60
|
-
}));
|
|
56
|
+
logger_1.uiLogger.error(en_1.commands.project.create.errors.cannotNestProjects(existingProjectDir));
|
|
61
57
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
62
58
|
}
|
|
59
|
+
const components = (0, v3_2.generateComponentPaths)({
|
|
60
|
+
createProjectPromptResponse,
|
|
61
|
+
platformVersion,
|
|
62
|
+
repoConfig,
|
|
63
|
+
projectContents,
|
|
64
|
+
authType,
|
|
65
|
+
distribution,
|
|
66
|
+
});
|
|
63
67
|
try {
|
|
64
|
-
await (0, github_1.cloneGithubRepo)(
|
|
65
|
-
sourceDir: createProjectPromptResponse.projectTemplate
|
|
66
|
-
tag: latestRepoReleaseTag,
|
|
68
|
+
await (0, github_1.cloneGithubRepo)(repo, projectDest, {
|
|
69
|
+
sourceDir: createProjectPromptResponse.projectTemplate?.path || components,
|
|
67
70
|
hideLogs: true,
|
|
71
|
+
branch: 'main',
|
|
68
72
|
});
|
|
69
73
|
}
|
|
70
74
|
catch (err) {
|
|
71
75
|
(0, errorHandlers_1.debugError)(err);
|
|
72
|
-
logger_1.
|
|
76
|
+
logger_1.uiLogger.error(en_1.commands.project.create.errors.failedToDownloadProject);
|
|
73
77
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
74
78
|
}
|
|
75
79
|
const projectConfigPath = path_1.default.join(projectDest, constants_1.PROJECT_CONFIG_FILE);
|
|
@@ -79,17 +83,13 @@ async function handler(args) {
|
|
|
79
83
|
name: createProjectPromptResponse.name,
|
|
80
84
|
});
|
|
81
85
|
// If the template is 'no-template', we need to manually create a src directory
|
|
82
|
-
if (createProjectPromptResponse.projectTemplate
|
|
83
|
-
|
|
86
|
+
if (createProjectPromptResponse.projectTemplate?.name ===
|
|
87
|
+
legacy_1.EMPTY_PROJECT_TEMPLATE_NAME ||
|
|
88
|
+
projectContents === v3_1.EMPTY_PROJECT) {
|
|
84
89
|
fs_extra_1.default.ensureDirSync(path_1.default.join(projectDest, 'src'));
|
|
85
90
|
}
|
|
86
|
-
logger_1.
|
|
87
|
-
logger_1.
|
|
88
|
-
projectName: createProjectPromptResponse.name,
|
|
89
|
-
projectDest,
|
|
90
|
-
}));
|
|
91
|
-
logger_1.logger.log('');
|
|
92
|
-
logger_1.logger.log(chalk_1.default.bold((0, lang_1.i18n)(`commands.project.subcommands.create.logs.welcomeMessage`)));
|
|
91
|
+
logger_1.uiLogger.success(en_1.commands.project.create.logs.success(createProjectPromptResponse.name, projectDest));
|
|
92
|
+
logger_1.uiLogger.log(en_1.commands.project.create.logs.welcomeMessage);
|
|
93
93
|
(0, ui_1.uiFeatureHighlight)([
|
|
94
94
|
'projectCommandTip',
|
|
95
95
|
'projectUploadCommand',
|
|
@@ -104,32 +104,61 @@ async function handler(args) {
|
|
|
104
104
|
function projectCreateBuilder(yargs) {
|
|
105
105
|
yargs.options({
|
|
106
106
|
name: {
|
|
107
|
-
describe:
|
|
107
|
+
describe: en_1.commands.project.create.options.name.describe,
|
|
108
108
|
type: 'string',
|
|
109
109
|
},
|
|
110
110
|
dest: {
|
|
111
|
-
describe:
|
|
111
|
+
describe: en_1.commands.project.create.options.dest.describe,
|
|
112
112
|
type: 'string',
|
|
113
113
|
},
|
|
114
114
|
template: {
|
|
115
|
-
|
|
115
|
+
// TODO: When we release 2025.2 scaffolding, we need to point out this is only valid for 2025.1 prior
|
|
116
|
+
describe: en_1.commands.project.create.options.template.describe,
|
|
116
117
|
type: 'string',
|
|
117
118
|
},
|
|
118
119
|
'template-source': {
|
|
119
|
-
describe:
|
|
120
|
+
describe: en_1.commands.project.create.options.templateSource.describe,
|
|
121
|
+
type: 'string',
|
|
122
|
+
},
|
|
123
|
+
'platform-version': {
|
|
124
|
+
describe: en_1.commands.project.create.options.platformVersion.describe,
|
|
125
|
+
hidden: true,
|
|
120
126
|
type: 'string',
|
|
127
|
+
choices: [v2023_2, v2025_1, v2025_2],
|
|
128
|
+
default: v2023_2,
|
|
129
|
+
},
|
|
130
|
+
'project-base': {
|
|
131
|
+
describe: en_1.commands.project.create.options.projectBase.describe,
|
|
132
|
+
hidden: true,
|
|
133
|
+
type: 'string',
|
|
134
|
+
choices: [v3_1.EMPTY_PROJECT, v3_1.PROJECT_WITH_APP],
|
|
135
|
+
},
|
|
136
|
+
distribution: {
|
|
137
|
+
describe: en_1.commands.project.create.options.distribution.describe,
|
|
138
|
+
hidden: true,
|
|
139
|
+
type: 'string',
|
|
140
|
+
choices: [constants_1.privateDistribution, constants_1.marketplaceDistribution],
|
|
141
|
+
},
|
|
142
|
+
auth: {
|
|
143
|
+
describe: en_1.commands.project.create.options.auth.describe,
|
|
144
|
+
hidden: true,
|
|
145
|
+
type: 'string',
|
|
146
|
+
choices: [constants_1.oAuth, constants_1.staticAuth],
|
|
147
|
+
},
|
|
148
|
+
features: {
|
|
149
|
+
describe: en_1.commands.project.create.options.features.describe,
|
|
150
|
+
hidden: true,
|
|
151
|
+
type: 'array',
|
|
121
152
|
},
|
|
122
153
|
});
|
|
154
|
+
yargs.conflicts('template', 'features');
|
|
123
155
|
yargs.example([
|
|
124
|
-
[
|
|
125
|
-
'$0 project create',
|
|
126
|
-
(0, lang_1.i18n)(`commands.project.subcommands.create.examples.default`),
|
|
127
|
-
],
|
|
156
|
+
['$0 project create', en_1.commands.project.create.examples.default],
|
|
128
157
|
]);
|
|
129
158
|
yargs.example([
|
|
130
159
|
[
|
|
131
160
|
'$0 project create --template-source HubSpot/ui-extensions-examples',
|
|
132
|
-
|
|
161
|
+
en_1.commands.project.create.examples.templateSource,
|
|
133
162
|
],
|
|
134
163
|
]);
|
|
135
164
|
return yargs;
|
|
@@ -3,6 +3,8 @@ export type ProjectDeployArgs = CommonArgs & ConfigArgs & AccountArgs & Environm
|
|
|
3
3
|
project?: string;
|
|
4
4
|
build?: number;
|
|
5
5
|
buildId?: number;
|
|
6
|
+
profile?: string;
|
|
7
|
+
force: boolean;
|
|
6
8
|
};
|
|
7
9
|
declare const projectDeployCommand: YargsCommandModule<unknown, ProjectDeployArgs>;
|
|
8
10
|
export default projectDeployCommand;
|
|
@@ -21,6 +21,8 @@ const ui_1 = require("../../lib/ui");
|
|
|
21
21
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
22
22
|
const ui_2 = require("../../lib/ui");
|
|
23
23
|
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
24
|
+
const projectProfiles_1 = require("../../lib/projectProfiles");
|
|
25
|
+
const constants_1 = require("../../lib/constants");
|
|
24
26
|
const command = 'deploy';
|
|
25
27
|
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.deploy.describe`), false);
|
|
26
28
|
function validateBuildId(buildId, deployedBuildId, latestBuildId, projectName, accountId) {
|
|
@@ -39,30 +41,63 @@ function validateBuildId(buildId, deployedBuildId, latestBuildId, projectName, a
|
|
|
39
41
|
}
|
|
40
42
|
return true;
|
|
41
43
|
}
|
|
44
|
+
function logDeployErrors(errorData) {
|
|
45
|
+
logger_1.logger.error(errorData.message);
|
|
46
|
+
errorData.errors.forEach(err => {
|
|
47
|
+
if (err.subCategory === constants_1.PROJECT_ERROR_TYPES.DEPLOY_CONTAINS_REMOVALS) {
|
|
48
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.project.subcommands.deploy.errors.deployContainsRemovals`, {
|
|
49
|
+
componentName: err.context.COMPONENT_NAME,
|
|
50
|
+
forceFlag: (0, ui_2.uiCommandReference)('--force'),
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
logger_1.logger.log(err.message);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
42
58
|
async function handler(args) {
|
|
43
|
-
const { derivedAccountId } = args;
|
|
59
|
+
const { derivedAccountId, project: projectOption, buildId: buildIdOption, force: forceOption, } = args;
|
|
44
60
|
const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
|
|
45
|
-
const { project: projectOption, buildId: buildIdOption } = args;
|
|
46
61
|
const accountType = accountConfig && accountConfig.accountType;
|
|
47
|
-
|
|
48
|
-
const { projectConfig } = await (0, config_2.getProjectConfig)();
|
|
62
|
+
let targetAccountId;
|
|
63
|
+
const { projectConfig, projectDir } = await (0, config_2.getProjectConfig)();
|
|
64
|
+
if ((0, buildAndDeploy_1.useV3Api)(projectConfig?.platformVersion)) {
|
|
65
|
+
if (args.profile) {
|
|
66
|
+
(0, projectProfiles_1.logProfileHeader)(args.profile);
|
|
67
|
+
const profile = (0, projectProfiles_1.loadProfile)(projectConfig, projectDir, args.profile);
|
|
68
|
+
if (!profile) {
|
|
69
|
+
(0, ui_1.uiLine)();
|
|
70
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
71
|
+
}
|
|
72
|
+
targetAccountId = profile.accountId;
|
|
73
|
+
(0, projectProfiles_1.logProfileFooter)(profile);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// A profile must be specified if this project has profiles configured
|
|
77
|
+
await (0, projectProfiles_1.exitIfUsingProfiles)(projectConfig, projectDir);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (!targetAccountId) {
|
|
81
|
+
targetAccountId = derivedAccountId;
|
|
82
|
+
}
|
|
83
|
+
(0, usageTracking_1.trackCommandUsage)('project-deploy', accountType ? { type: accountType } : undefined, targetAccountId);
|
|
49
84
|
let projectName = projectOption;
|
|
50
85
|
if (!projectOption && projectConfig) {
|
|
51
86
|
projectName = projectConfig.name;
|
|
52
87
|
}
|
|
53
|
-
const namePromptResponse = await (0, projectNamePrompt_1.projectNamePrompt)(
|
|
88
|
+
const namePromptResponse = await (0, projectNamePrompt_1.projectNamePrompt)(targetAccountId, {
|
|
54
89
|
project: projectName,
|
|
55
90
|
});
|
|
56
91
|
projectName = namePromptResponse.projectName;
|
|
57
92
|
let buildIdToDeploy = buildIdOption;
|
|
58
93
|
try {
|
|
59
|
-
const { data: { latestBuild, deployedBuildId }, } = await (0, projects_1.fetchProject)(
|
|
94
|
+
const { data: { latestBuild, deployedBuildId }, } = await (0, projects_1.fetchProject)(targetAccountId, projectName);
|
|
60
95
|
if (!latestBuild || !latestBuild.buildId) {
|
|
61
96
|
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.deploy.errors.noBuilds`));
|
|
62
97
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
63
98
|
}
|
|
64
99
|
if (buildIdToDeploy) {
|
|
65
|
-
const validationResult = validateBuildId(buildIdToDeploy, deployedBuildId, latestBuild.buildId, projectName,
|
|
100
|
+
const validationResult = validateBuildId(buildIdToDeploy, deployedBuildId, latestBuild.buildId, projectName, targetAccountId);
|
|
66
101
|
if (validationResult !== true) {
|
|
67
102
|
logger_1.logger.error(validationResult);
|
|
68
103
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
@@ -75,7 +110,7 @@ async function handler(args) {
|
|
|
75
110
|
default: latestBuild.buildId === deployedBuildId
|
|
76
111
|
? undefined
|
|
77
112
|
: latestBuild.buildId,
|
|
78
|
-
validate: buildId => validateBuildId(buildId, deployedBuildId, latestBuild.buildId, projectName,
|
|
113
|
+
validate: buildId => validateBuildId(buildId, deployedBuildId, latestBuild.buildId, projectName, targetAccountId),
|
|
79
114
|
});
|
|
80
115
|
buildIdToDeploy = deployBuildIdPromptResponse.buildId;
|
|
81
116
|
}
|
|
@@ -83,27 +118,32 @@ async function handler(args) {
|
|
|
83
118
|
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.deploy.errors.noBuildId`));
|
|
84
119
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
85
120
|
}
|
|
86
|
-
const { data: deployResp } = await (0, projects_1.deployProject)(
|
|
121
|
+
const { data: deployResp } = await (0, projects_1.deployProject)(targetAccountId, projectName, buildIdToDeploy, (0, buildAndDeploy_1.useV3Api)(projectConfig?.platformVersion), forceOption);
|
|
87
122
|
if (!deployResp) {
|
|
88
123
|
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.deploy.errors.deploy`));
|
|
89
124
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
90
125
|
}
|
|
91
|
-
await (0, buildAndDeploy_2.pollDeployStatus)(
|
|
126
|
+
await (0, buildAndDeploy_2.pollDeployStatus)(targetAccountId, projectName, Number(deployResp.id), buildIdToDeploy);
|
|
92
127
|
}
|
|
93
128
|
catch (e) {
|
|
94
129
|
if ((0, index_1.isHubSpotHttpError)(e) && e.status === 404) {
|
|
95
130
|
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.deploy.errors.projectNotFound`, {
|
|
96
131
|
projectName: chalk_1.default.bold(projectName),
|
|
97
|
-
accountIdentifier: (0, ui_2.uiAccountDescription)(
|
|
132
|
+
accountIdentifier: (0, ui_2.uiAccountDescription)(targetAccountId),
|
|
98
133
|
command: (0, ui_2.uiCommandReference)('hs project upload'),
|
|
99
134
|
}));
|
|
100
135
|
}
|
|
101
136
|
else if ((0, index_1.isHubSpotHttpError)(e) && e.status === 400) {
|
|
102
|
-
|
|
137
|
+
if (e.data?.message && e.data?.errors) {
|
|
138
|
+
logDeployErrors(e.data);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
logger_1.logger.error(e.message);
|
|
142
|
+
}
|
|
103
143
|
}
|
|
104
144
|
else {
|
|
105
145
|
(0, index_2.logError)(e, new index_2.ApiErrorContext({
|
|
106
|
-
accountId:
|
|
146
|
+
accountId: targetAccountId,
|
|
107
147
|
request: 'project deploy',
|
|
108
148
|
}));
|
|
109
149
|
}
|
|
@@ -121,7 +161,21 @@ function projectDeployBuilder(yargs) {
|
|
|
121
161
|
describe: (0, lang_1.i18n)(`commands.project.subcommands.deploy.options.build.describe`),
|
|
122
162
|
type: 'number',
|
|
123
163
|
},
|
|
164
|
+
profile: {
|
|
165
|
+
alias: ['p'],
|
|
166
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.deploy.options.profile.describe`),
|
|
167
|
+
type: 'string',
|
|
168
|
+
hidden: true,
|
|
169
|
+
},
|
|
170
|
+
force: {
|
|
171
|
+
alias: ['f'],
|
|
172
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.deploy.options.force.describe`),
|
|
173
|
+
default: false,
|
|
174
|
+
type: 'boolean',
|
|
175
|
+
},
|
|
124
176
|
});
|
|
177
|
+
yargs.conflicts('profile', 'project');
|
|
178
|
+
yargs.conflicts('profile', 'account');
|
|
125
179
|
yargs.example([
|
|
126
180
|
[
|
|
127
181
|
'$0 project deploy',
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ArgumentsCamelCase } from 'yargs';
|
|
2
|
-
import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
3
2
|
import { ProjectConfig } from '../../../types/Projects';
|
|
4
3
|
import { ProjectDevArgs } from '../../../types/Yargs';
|
|
5
|
-
|
|
4
|
+
type DeprecatedProjectDevFlowArgs = {
|
|
5
|
+
args: ArgumentsCamelCase<ProjectDevArgs>;
|
|
6
|
+
accountId: number;
|
|
7
|
+
projectConfig: ProjectConfig;
|
|
8
|
+
projectDir: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function deprecatedProjectDevFlow({ args, accountId, projectConfig, projectDir, }: DeprecatedProjectDevFlowArgs): Promise<void>;
|
|
11
|
+
export {};
|
|
@@ -18,7 +18,7 @@ const helpers_1 = require("../../../lib/projects/localDev/helpers");
|
|
|
18
18
|
const process_1 = require("../../../lib/process");
|
|
19
19
|
const accountTypes_1 = require("../../../lib/accountTypes");
|
|
20
20
|
const ensureProjectExists_1 = require("../../../lib/projects/ensureProjectExists");
|
|
21
|
-
async function deprecatedProjectDevFlow(args,
|
|
21
|
+
async function deprecatedProjectDevFlow({ args, accountId, projectConfig, projectDir, }) {
|
|
22
22
|
const { providedAccountId, derivedAccountId } = args;
|
|
23
23
|
const env = (0, environment_1.getValidEnv)((0, config_1.getEnv)(derivedAccountId));
|
|
24
24
|
const components = await (0, structure_1.findProjectComponents)(projectDir);
|
|
@@ -26,6 +26,14 @@ async function deprecatedProjectDevFlow(args, accountConfig, projectConfig, proj
|
|
|
26
26
|
const componentTypes = (0, structure_1.getProjectComponentTypes)(runnableComponents);
|
|
27
27
|
const hasPrivateApps = !!componentTypes[Projects_1.ComponentTypes.PrivateApp];
|
|
28
28
|
const hasPublicApps = !!componentTypes[Projects_1.ComponentTypes.PublicApp];
|
|
29
|
+
const accountConfig = (0, config_1.getAccountConfig)(accountId);
|
|
30
|
+
if (!accountConfig) {
|
|
31
|
+
logger_1.logger.error((0, lang_1.i18n)('commands.project.subcommands.dev.errors.noAccount', {
|
|
32
|
+
accountId: accountId,
|
|
33
|
+
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
34
|
+
}));
|
|
35
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
36
|
+
}
|
|
29
37
|
if (runnableComponents.length === 0) {
|
|
30
38
|
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.dev.errors.noRunnableComponents`, {
|
|
31
39
|
projectDir,
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Argv, CommandModule } from 'yargs';
|
|
2
2
|
import { ProjectDevArgs } from '../../../types/Yargs';
|
|
3
|
-
export declare const command = "dev";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
export declare function handler(args: ArgumentsCamelCase<ProjectDevArgs>): Promise<void>;
|
|
6
3
|
export declare const builder: (yargs: Argv) => Promise<Argv<ProjectDevArgs>>;
|
|
7
4
|
declare const projectDevCommand: CommandModule<unknown, ProjectDevArgs>;
|
|
8
5
|
export default projectDevCommand;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.builder =
|
|
4
|
-
exports.handler = handler;
|
|
3
|
+
exports.builder = void 0;
|
|
5
4
|
const usageTracking_1 = require("../../../lib/usageTracking");
|
|
6
|
-
const lang_1 = require("../../../lib/lang");
|
|
7
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
5
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
9
6
|
const config_2 = require("../../../lib/projects/config");
|
|
10
7
|
const exitCodes_1 = require("../../../lib/enums/exitCodes");
|
|
@@ -13,52 +10,112 @@ const deprecatedFlow_1 = require("./deprecatedFlow");
|
|
|
13
10
|
const unifiedFlow_1 = require("./unifiedFlow");
|
|
14
11
|
const buildAndDeploy_1 = require("../../../lib/projects/buildAndDeploy");
|
|
15
12
|
const yargsUtils_1 = require("../../../lib/yargsUtils");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
(
|
|
24
|
-
|
|
25
|
-
if (!projectConfig || !projectDir) {
|
|
26
|
-
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.dev.errors.noProjectConfig`, {
|
|
27
|
-
accountId: derivedAccountId,
|
|
28
|
-
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
29
|
-
}));
|
|
13
|
+
const projectProfiles_1 = require("../../../lib/projectProfiles");
|
|
14
|
+
const en_1 = require("../../../lang/en");
|
|
15
|
+
const logger_1 = require("../../../lib/ui/logger");
|
|
16
|
+
const command = 'dev';
|
|
17
|
+
const describe = (0, ui_1.uiBetaTag)(en_1.commands.project.dev.describe, false);
|
|
18
|
+
function validateAccountFlags(testingAccount, projectAccount, providedAccountId, useV3) {
|
|
19
|
+
// Legacy projects do not support targetTestingAccount and targetProjectAccount
|
|
20
|
+
if (testingAccount && projectAccount && !useV3) {
|
|
21
|
+
logger_1.uiLogger.error(en_1.commands.project.dev.errors.unsupportedAccountFlagLegacy);
|
|
30
22
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
31
23
|
}
|
|
32
|
-
if (
|
|
33
|
-
logger_1.
|
|
24
|
+
if (providedAccountId && useV3) {
|
|
25
|
+
logger_1.uiLogger.error(en_1.commands.project.dev.errors.unsupportedAccountFlagV3);
|
|
34
26
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
35
27
|
}
|
|
28
|
+
}
|
|
29
|
+
async function handler(args) {
|
|
30
|
+
const { derivedAccountId, providedAccountId, testingAccount, projectAccount, } = args;
|
|
31
|
+
const { projectConfig, projectDir } = await (0, config_2.getProjectConfig)();
|
|
36
32
|
(0, config_2.validateProjectConfig)(projectConfig, projectDir);
|
|
33
|
+
const useV3 = (0, buildAndDeploy_1.useV3Api)(projectConfig.platformVersion);
|
|
34
|
+
if (!projectDir) {
|
|
35
|
+
logger_1.uiLogger.error(en_1.commands.project.dev.errors.noProjectConfig);
|
|
36
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
37
|
+
}
|
|
38
|
+
validateAccountFlags(testingAccount, projectAccount, providedAccountId, useV3);
|
|
39
|
+
let targetProjectAccountId = (projectAccount && (0, config_1.getAccountId)(projectAccount)) ||
|
|
40
|
+
(providedAccountId && derivedAccountId);
|
|
41
|
+
let profile;
|
|
42
|
+
if (!targetProjectAccountId && (0, buildAndDeploy_1.useV3Api)(projectConfig.platformVersion)) {
|
|
43
|
+
if (args.profile) {
|
|
44
|
+
(0, projectProfiles_1.logProfileHeader)(args.profile);
|
|
45
|
+
profile = (0, projectProfiles_1.loadProfile)(projectConfig, projectDir, args.profile);
|
|
46
|
+
if (!profile) {
|
|
47
|
+
(0, ui_1.uiLine)();
|
|
48
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
49
|
+
}
|
|
50
|
+
targetProjectAccountId = profile.accountId;
|
|
51
|
+
(0, projectProfiles_1.logProfileFooter)(profile);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
// A profile must be specified if this project has profiles configured
|
|
55
|
+
await (0, projectProfiles_1.exitIfUsingProfiles)(projectConfig, projectDir);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (!targetProjectAccountId) {
|
|
59
|
+
// The user is not using profile or account flags, so we can use the derived accountId
|
|
60
|
+
targetProjectAccountId = derivedAccountId;
|
|
61
|
+
}
|
|
62
|
+
(0, usageTracking_1.trackCommandUsage)('project-dev', {}, targetProjectAccountId);
|
|
63
|
+
(0, ui_1.uiBetaTag)(en_1.commands.project.dev.logs.betaMessage);
|
|
64
|
+
logger_1.uiLogger.log(en_1.commands.project.dev.logs.learnMoreLocalDevServer);
|
|
37
65
|
if ((0, buildAndDeploy_1.useV3Api)(projectConfig.platformVersion)) {
|
|
38
|
-
|
|
66
|
+
const targetTestingAccountId = (testingAccount && (0, config_1.getAccountId)(testingAccount)) || undefined;
|
|
67
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
68
|
+
args,
|
|
69
|
+
targetProjectAccountId,
|
|
70
|
+
providedTargetTestingAccountId: targetTestingAccountId,
|
|
71
|
+
projectConfig,
|
|
72
|
+
projectDir,
|
|
73
|
+
profileConfig: profile,
|
|
74
|
+
});
|
|
39
75
|
}
|
|
40
76
|
else {
|
|
41
|
-
await (0, deprecatedFlow_1.deprecatedProjectDevFlow)(
|
|
77
|
+
await (0, deprecatedFlow_1.deprecatedProjectDevFlow)({
|
|
78
|
+
args,
|
|
79
|
+
accountId: targetProjectAccountId,
|
|
80
|
+
projectConfig,
|
|
81
|
+
projectDir,
|
|
82
|
+
});
|
|
42
83
|
}
|
|
43
84
|
}
|
|
44
85
|
function projectDevBuilder(yargs) {
|
|
45
|
-
yargs.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
86
|
+
yargs.option('profile', {
|
|
87
|
+
type: 'string',
|
|
88
|
+
alias: 'p',
|
|
89
|
+
description: en_1.commands.project.dev.options.profile,
|
|
90
|
+
hidden: true,
|
|
91
|
+
});
|
|
92
|
+
yargs.options('testingAccount', {
|
|
93
|
+
type: 'string',
|
|
94
|
+
description: en_1.commands.project.dev.options.testingAccount,
|
|
95
|
+
hidden: true,
|
|
96
|
+
implies: ['projectAccount'],
|
|
97
|
+
});
|
|
98
|
+
yargs.options('projectAccount', {
|
|
99
|
+
type: 'string',
|
|
100
|
+
description: en_1.commands.project.dev.options.projectAccount,
|
|
101
|
+
hidden: true,
|
|
102
|
+
implies: ['testingAccount'],
|
|
103
|
+
});
|
|
104
|
+
yargs.example([['$0 project dev', en_1.commands.project.dev.examples.default]]);
|
|
105
|
+
yargs.conflicts('profile', 'account');
|
|
106
|
+
yargs.conflicts('profile', 'testingAccount');
|
|
107
|
+
yargs.conflicts('profile', 'projectAccount');
|
|
51
108
|
return yargs;
|
|
52
109
|
}
|
|
53
|
-
exports.builder = (0, yargsUtils_1.makeYargsBuilder)(projectDevBuilder,
|
|
110
|
+
exports.builder = (0, yargsUtils_1.makeYargsBuilder)(projectDevBuilder, command, describe, {
|
|
54
111
|
useGlobalOptions: true,
|
|
55
112
|
useAccountOptions: true,
|
|
56
113
|
useConfigOptions: true,
|
|
57
114
|
useEnvironmentOptions: true,
|
|
58
115
|
});
|
|
59
116
|
const projectDevCommand = {
|
|
60
|
-
command
|
|
61
|
-
describe
|
|
117
|
+
command,
|
|
118
|
+
describe,
|
|
62
119
|
handler,
|
|
63
120
|
builder: exports.builder,
|
|
64
121
|
};
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { ArgumentsCamelCase } from 'yargs';
|
|
2
|
-
import {
|
|
2
|
+
import { HsProfileFile } from '@hubspot/project-parsing-lib/src/lib/types';
|
|
3
3
|
import { ProjectDevArgs } from '../../../types/Yargs';
|
|
4
4
|
import { ProjectConfig } from '../../../types/Projects';
|
|
5
|
-
|
|
5
|
+
type UnifiedProjectDevFlowArgs = {
|
|
6
|
+
args: ArgumentsCamelCase<ProjectDevArgs>;
|
|
7
|
+
targetProjectAccountId: number;
|
|
8
|
+
providedTargetTestingAccountId?: number;
|
|
9
|
+
projectConfig: ProjectConfig;
|
|
10
|
+
projectDir: string;
|
|
11
|
+
profileConfig?: HsProfileFile;
|
|
12
|
+
};
|
|
13
|
+
export declare function unifiedProjectDevFlow({ args, targetProjectAccountId, providedTargetTestingAccountId, projectConfig, projectDir, profileConfig, }: UnifiedProjectDevFlowArgs): Promise<void>;
|
|
14
|
+
export {};
|