@hubspot/cli 7.5.3-experimental.0 → 7.5.3
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.d.ts +12 -3
- package/api/migrate.js +9 -2
- package/bin/cli.js +100 -93
- package/commands/account/auth.d.ts +8 -0
- package/commands/account/auth.js +175 -0
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +54 -14
- package/commands/account/createOverride.d.ts +6 -0
- package/commands/account/createOverride.js +121 -0
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +36 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +38 -15
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +49 -9
- package/commands/account/removeOverride.d.ts +6 -0
- package/commands/account/removeOverride.js +93 -0
- 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 +27 -6
- package/commands/account.d.ts +3 -4
- package/commands/account.js +33 -53
- package/commands/app/migrate.d.ts +5 -6
- package/commands/app/migrate.js +60 -44
- 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 -10
- package/commands/auth.d.ts +5 -7
- package/commands/auth.js +37 -33
- 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 -16
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +23 -13
- package/commands/config/migrate.d.ts +6 -0
- package/commands/config/migrate.js +75 -0
- package/commands/config/set.d.ts +10 -1
- package/commands/config/set.js +56 -32
- package/commands/config.d.ts +3 -1
- package/commands/config.js +19 -11
- 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 -75
- 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 +20 -48
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +30 -22
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +38 -48
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -34
- 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 -42
- 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 -11
- 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 +21 -15
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +23 -17
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +24 -16
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +20 -14
- 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 +24 -47
- package/commands/init.d.ts +3 -7
- package/commands/init.js +31 -24
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +42 -44
- package/commands/list.d.ts +3 -7
- package/commands/list.js +21 -16
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -45
- package/commands/mcp/setup.d.ts +7 -0
- package/commands/mcp/setup.js +50 -0
- package/commands/mcp/start.d.ts +3 -0
- package/commands/mcp/start.js +75 -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 -30
- package/commands/module.d.ts +3 -1
- package/commands/module.js +23 -12
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +20 -15
- package/commands/open.d.ts +3 -7
- package/commands/open.js +20 -15
- package/commands/project/add.d.ts +8 -9
- package/commands/project/add.js +53 -85
- package/commands/project/cloneApp.d.ts +6 -8
- package/commands/project/cloneApp.js +51 -47
- package/commands/project/create.d.ts +4 -1
- package/commands/project/create.js +132 -81
- package/commands/project/deploy.d.ts +5 -6
- package/commands/project/deploy.js +93 -37
- package/commands/project/dev/deprecatedFlow.d.ts +8 -2
- package/commands/project/dev/deprecatedFlow.js +41 -26
- package/commands/project/dev/index.d.ts +4 -5
- package/commands/project/dev/index.js +103 -33
- package/commands/project/dev/unifiedFlow.d.ts +11 -2
- package/commands/project/dev/unifiedFlow.js +85 -46
- package/commands/project/download.d.ts +3 -7
- package/commands/project/download.js +18 -19
- package/commands/project/installDeps.d.ts +6 -1
- package/commands/project/installDeps.js +48 -32
- package/commands/project/listBuilds.d.ts +3 -7
- package/commands/project/listBuilds.js +32 -30
- package/commands/project/logs.d.ts +10 -1
- package/commands/project/logs.js +73 -65
- package/commands/project/migrate.d.ts +7 -8
- package/commands/project/migrate.js +49 -26
- package/commands/project/migrateApp.d.ts +3 -8
- package/commands/project/migrateApp.js +23 -20
- package/commands/project/open.d.ts +3 -7
- package/commands/project/open.js +29 -21
- 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 +10 -1
- package/commands/project/upload.js +94 -56
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +81 -0
- package/commands/project/watch.d.ts +6 -1
- package/commands/project/watch.js +95 -61
- package/commands/project.d.ts +3 -1
- package/commands/project.js +49 -37
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +22 -20
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +27 -21
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +35 -29
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +18 -44
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +21 -15
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +28 -18
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +19 -13
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +25 -17
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +23 -49
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +20 -16
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +22 -18
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +36 -30
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +22 -48
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +116 -135
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +74 -76
- package/lang/en.d.ts +3218 -0
- package/lang/en.js +3075 -3313
- package/lang/en.lyaml +96 -228
- package/lib/accountTypes.d.ts +1 -0
- package/lib/accountTypes.js +11 -0
- package/lib/app/migrate.d.ts +33 -4
- package/lib/app/migrate.js +179 -88
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/app/migrate_legacy.js +12 -11
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/buildAccount.d.ts +1 -2
- package/lib/buildAccount.js +11 -10
- package/lib/commonOpts.d.ts +4 -7
- package/lib/commonOpts.js +47 -19
- package/lib/configMigrate.d.ts +2 -0
- package/lib/configMigrate.js +83 -0
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -45
- package/lib/constants.d.ts +33 -0
- package/lib/constants.js +34 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +14 -40
- package/lib/doctor/Diagnosis.d.ts +1 -2
- package/lib/doctor/Diagnosis.js +19 -16
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +2 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +10 -9
- package/lib/doctor/Doctor.d.ts +1 -0
- package/lib/doctor/Doctor.js +60 -46
- package/lib/errorHandlers/index.js +13 -7
- package/lib/errorHandlers/suppressError.js +18 -26
- package/lib/filesystem.d.ts +1 -1
- package/lib/generateSelectors.js +3 -6
- package/lib/hasFeature.d.ts +3 -1
- 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 +12 -0
- package/lib/mcp/setup.js +216 -0
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +3 -3
- package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/middleware/configMiddleware.js +37 -3
- package/lib/middleware/fireAlarmMiddleware.d.ts +4 -0
- package/lib/middleware/fireAlarmMiddleware.js +125 -0
- package/lib/middleware/yargsChecksMiddleware.js +2 -2
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/oauth.js +1 -2
- package/lib/process.js +1 -2
- package/lib/projectProfiles.d.ts +7 -0
- package/lib/projectProfiles.js +83 -0
- package/lib/projects/ProjectLogsManager.d.ts +1 -1
- package/lib/projects/ProjectLogsManager.js +16 -21
- 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 +46 -42
- package/lib/projects/components.d.ts +2 -0
- package/lib/projects/components.js +82 -0
- package/lib/projects/config.d.ts +9 -0
- package/lib/projects/config.js +79 -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} +23 -15
- package/lib/projects/create/v3.d.ts +27 -0
- package/lib/projects/create/v3.js +158 -0
- package/lib/projects/ensureProjectExists.d.ts +11 -0
- package/lib/projects/ensureProjectExists.js +97 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +30 -0
- package/lib/projects/localDev/AppDevModeInterface.js +215 -0
- package/lib/{DevServerManager.d.ts → projects/localDev/DevServerManager.d.ts} +1 -1
- package/lib/{DevServerManager.js → projects/localDev/DevServerManager.js} +6 -6
- package/lib/projects/localDev/DevServerManagerV2.d.ts +22 -0
- package/lib/{DevServerManagerV2.js → projects/localDev/DevServerManagerV2.js} +22 -19
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +159 -0
- package/lib/{LocalDevManager.d.ts → projects/localDev/LocalDevManager.d.ts} +1 -1
- package/lib/{LocalDevManager.js → projects/localDev/LocalDevManager.js} +57 -83
- 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/{localDev.d.ts → projects/localDev/helpers.d.ts} +6 -4
- package/lib/{localDev.js → projects/localDev/helpers.js} +127 -114
- package/lib/projects/ui.d.ts +1 -0
- package/lib/projects/ui.js +15 -0
- package/lib/projects/upload.d.ts +17 -2
- package/lib/projects/upload.js +74 -50
- package/lib/projects/urls.d.ts +4 -0
- package/lib/projects/urls.js +23 -1
- package/lib/projects/watch.d.ts +1 -1
- package/lib/projects/watch.js +21 -18
- package/lib/prompts/accountNamePrompt.js +16 -13
- package/lib/prompts/accountsPrompt.js +1 -2
- package/lib/prompts/cmsFieldPrompt.js +1 -2
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createApiSamplePrompt.js +4 -5
- package/lib/prompts/createFunctionPrompt.js +13 -14
- package/lib/prompts/createModulePrompt.js +8 -9
- package/lib/prompts/createProjectPrompt.d.ts +20 -4
- package/lib/prompts/createProjectPrompt.js +43 -13
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/prompts/createTemplatePrompt.js +1 -2
- package/lib/prompts/downloadProjectPrompt.js +3 -4
- package/lib/prompts/installAppPrompt.d.ts +2 -0
- package/lib/prompts/installAppPrompt.js +45 -0
- package/lib/prompts/personalAccessKeyPrompt.js +35 -25
- package/lib/prompts/previewPrompt.js +5 -6
- package/lib/prompts/projectAddPrompt.d.ts +5 -1
- package/lib/prompts/projectAddPrompt.js +35 -8
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +15 -16
- package/lib/prompts/projectNamePrompt.js +5 -6
- package/lib/prompts/projectsLogsPrompt.js +3 -2
- package/lib/prompts/promptUtils.d.ts +4 -2
- package/lib/prompts/promptUtils.js +3 -1
- package/lib/prompts/sandboxesPrompt.js +5 -6
- package/lib/prompts/secretPrompt.js +2 -3
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +40 -0
- package/lib/prompts/selectHubDBTablePrompt.js +11 -8
- package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
- package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -9
- package/lib/prompts/setAsDefaultAccountPrompt.js +11 -2
- package/lib/prompts/uploadPrompt.js +4 -5
- package/lib/sandboxSync.js +15 -14
- package/lib/sandboxes.js +12 -13
- package/lib/serverlessLogs.js +4 -6
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/ui/boxen.d.ts +5 -0
- package/lib/ui/boxen.js +30 -0
- package/lib/ui/git.js +8 -9
- package/lib/ui/index.d.ts +4 -2
- package/lib/ui/index.js +20 -17
- package/lib/ui/logger.d.ts +10 -0
- package/lib/ui/logger.js +15 -0
- package/lib/ui/serverlessFunctionLogs.js +2 -3
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +5 -1
- 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 +17 -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 +100 -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/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 +19 -11
- 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 +14 -14
- package/lib/DevServerManagerV2.d.ts +0 -33
- package/lib/LocalDevManagerV2.d.ts +0 -64
- package/lib/LocalDevManagerV2.js +0 -377
- package/lib/projects/create.d.ts +0 -5
- package/lib/projects/index.d.ts +0 -21
- package/lib/projects/index.js +0 -194
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- package/lib/prompts/installPublicAppPrompt.js +0 -40
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
3
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
6
4
|
const lang_1 = require("../../lib/lang");
|
|
7
5
|
const ui_1 = require("../../lib/ui");
|
|
8
6
|
const migrate_1 = require("../app/migrate");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
7
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
8
|
+
const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
9
|
+
const { v2023_2, v2025_2 } = projects_1.PLATFORM_VERSIONS;
|
|
10
|
+
const command = 'migrate-app';
|
|
12
11
|
// TODO: Leave this as deprecated and remove in the next major release
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
async function handler(
|
|
12
|
+
const describe = (0, ui_1.uiDeprecatedTag)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.describe`), false);
|
|
13
|
+
const deprecated = true;
|
|
14
|
+
async function handler(args) {
|
|
16
15
|
logger_1.logger.warn((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.deprecationWarning`, {
|
|
17
16
|
oldCommand: (0, ui_1.uiCommandReference)('hs project migrate-app'),
|
|
18
|
-
newCommand: (0, ui_1.uiCommandReference)(
|
|
17
|
+
newCommand: (0, ui_1.uiCommandReference)(`hs app migrate --platform-version=${args.platformVersion}`),
|
|
19
18
|
}));
|
|
20
|
-
|
|
19
|
+
const localHandler = (0, migrate_1.handlerGenerator)('migrate-app');
|
|
20
|
+
await localHandler(args);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
24
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
25
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
22
|
+
function projectMigrateAppBuilder(yargs) {
|
|
26
23
|
yargs.options({
|
|
27
24
|
name: {
|
|
28
25
|
describe: (0, lang_1.i18n)(`commands.project.subcommands.migrateApp.options.name.describe`),
|
|
@@ -38,9 +35,9 @@ function builder(yargs) {
|
|
|
38
35
|
},
|
|
39
36
|
'platform-version': {
|
|
40
37
|
type: 'string',
|
|
41
|
-
choices:
|
|
38
|
+
choices: [v2023_2, v2025_2],
|
|
42
39
|
hidden: true,
|
|
43
|
-
default:
|
|
40
|
+
default: v2023_2,
|
|
44
41
|
},
|
|
45
42
|
});
|
|
46
43
|
yargs.example([
|
|
@@ -51,10 +48,16 @@ function builder(yargs) {
|
|
|
51
48
|
]);
|
|
52
49
|
return yargs;
|
|
53
50
|
}
|
|
51
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(projectMigrateAppBuilder, command, describe, {
|
|
52
|
+
useGlobalOptions: true,
|
|
53
|
+
useConfigOptions: true,
|
|
54
|
+
useAccountOptions: true,
|
|
55
|
+
useEnvironmentOptions: true,
|
|
56
|
+
});
|
|
54
57
|
const migrateAppCommand = {
|
|
55
|
-
command
|
|
56
|
-
describe
|
|
57
|
-
deprecated
|
|
58
|
+
command,
|
|
59
|
+
describe,
|
|
60
|
+
deprecated,
|
|
58
61
|
handler,
|
|
59
62
|
builder,
|
|
60
63
|
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs, TestingArgs } from '../../types/Yargs';
|
|
3
|
-
export declare const command = "open";
|
|
4
|
-
export declare const describe: string;
|
|
1
|
+
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs, TestingArgs, YargsCommandModule } from '../../types/Yargs';
|
|
5
2
|
type ProjectOpenArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs & {
|
|
6
3
|
project?: string;
|
|
7
4
|
};
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export {};
|
|
5
|
+
declare const projectOpenCommand: YargsCommandModule<unknown, ProjectOpenArgs>;
|
|
6
|
+
export default projectOpenCommand;
|
package/commands/project/open.js
CHANGED
|
@@ -3,29 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.describe = exports.command = void 0;
|
|
7
|
-
exports.handler = handler;
|
|
8
|
-
exports.builder = builder;
|
|
9
6
|
const open_1 = __importDefault(require("open"));
|
|
10
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
11
7
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
12
8
|
const lang_1 = require("../../lib/lang");
|
|
13
9
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
14
|
-
const
|
|
10
|
+
const config_1 = require("../../lib/projects/config");
|
|
11
|
+
const ensureProjectExists_1 = require("../../lib/projects/ensureProjectExists");
|
|
15
12
|
const urls_1 = require("../../lib/projects/urls");
|
|
16
13
|
const projectNamePrompt_1 = require("../../lib/prompts/projectNamePrompt");
|
|
17
14
|
const ui_1 = require("../../lib/ui");
|
|
18
15
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
17
|
+
const command = 'open';
|
|
18
|
+
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.open.describe`), false);
|
|
22
19
|
async function handler(args) {
|
|
23
20
|
const { project, derivedAccountId } = args;
|
|
24
21
|
(0, usageTracking_1.trackCommandUsage)('project-open', undefined, derivedAccountId);
|
|
25
|
-
const { projectConfig } = await (0,
|
|
22
|
+
const { projectConfig } = await (0, config_1.getProjectConfig)();
|
|
26
23
|
let projectName = project;
|
|
27
24
|
if (projectName) {
|
|
28
|
-
const { projectExists } = await (0,
|
|
25
|
+
const { projectExists } = await (0, ensureProjectExists_1.ensureProjectExists)(derivedAccountId, projectName, {
|
|
29
26
|
allowCreate: false,
|
|
30
27
|
});
|
|
31
28
|
if (!projectExists) {
|
|
@@ -41,26 +38,37 @@ async function handler(args) {
|
|
|
41
38
|
}
|
|
42
39
|
const url = (0, urls_1.getProjectDetailUrl)(projectName, derivedAccountId);
|
|
43
40
|
(0, open_1.default)(url, { url: true });
|
|
44
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
41
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.project.subcommands.open.success`, {
|
|
42
|
+
projectName: projectName,
|
|
43
|
+
}));
|
|
45
44
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
46
45
|
}
|
|
47
|
-
function
|
|
48
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
49
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
50
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
51
|
-
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
46
|
+
function projectOpenBuilder(yargs) {
|
|
52
47
|
yargs.options({
|
|
53
48
|
project: {
|
|
54
|
-
describe: (0, lang_1.i18n)(
|
|
49
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.open.options.project.describe`),
|
|
55
50
|
type: 'string',
|
|
56
51
|
},
|
|
57
52
|
});
|
|
58
|
-
yargs.example([
|
|
53
|
+
yargs.example([
|
|
54
|
+
[
|
|
55
|
+
'$0 project open',
|
|
56
|
+
(0, lang_1.i18n)(`commands.project.subcommands.open.examples.default`),
|
|
57
|
+
],
|
|
58
|
+
]);
|
|
59
59
|
return yargs;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(projectOpenBuilder, command, describe, {
|
|
62
|
+
useGlobalOptions: true,
|
|
63
|
+
useConfigOptions: true,
|
|
64
|
+
useAccountOptions: true,
|
|
65
|
+
useEnvironmentOptions: true,
|
|
66
|
+
useTestingOptions: true,
|
|
67
|
+
});
|
|
68
|
+
const projectOpenCommand = {
|
|
69
|
+
command,
|
|
70
|
+
describe,
|
|
64
71
|
handler,
|
|
65
72
|
builder,
|
|
66
73
|
};
|
|
74
|
+
exports.default = projectOpenCommand;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { YargsCommandModule, CommonArgs } from '../../../types/Yargs';
|
|
2
|
+
type ProjectProfileAddArgs = CommonArgs & {
|
|
3
|
+
name?: string;
|
|
4
|
+
targetAccount?: number;
|
|
5
|
+
};
|
|
6
|
+
declare const projectProfileAddCommand: YargsCommandModule<unknown, ProjectProfileAddArgs>;
|
|
7
|
+
export default projectProfileAddCommand;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
9
|
+
const getAccountIdentifier_1 = require("@hubspot/local-dev-lib/config/getAccountIdentifier");
|
|
10
|
+
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
11
|
+
const usageTracking_1 = require("../../../lib/usageTracking");
|
|
12
|
+
const config_2 = require("../../../lib/projects/config");
|
|
13
|
+
const ui_1 = require("../../../lib/ui");
|
|
14
|
+
const logger_1 = require("../../../lib/ui/logger");
|
|
15
|
+
const exitCodes_1 = require("../../../lib/enums/exitCodes");
|
|
16
|
+
const yargsUtils_1 = require("../../../lib/yargsUtils");
|
|
17
|
+
const en_1 = require("../../../lang/en");
|
|
18
|
+
const promptUtils_1 = require("../../../lib/prompts/promptUtils");
|
|
19
|
+
const validation_1 = require("../../../lib/validation");
|
|
20
|
+
const errorHandlers_1 = require("../../../lib/errorHandlers");
|
|
21
|
+
const command = 'add [name]';
|
|
22
|
+
const describe = (0, ui_1.uiBetaTag)(en_1.commands.project.profile.add.describe, false);
|
|
23
|
+
const verboseDescribe = (0, ui_1.uiBetaTag)(en_1.commands.project.profile.add.verboseDescribe, false);
|
|
24
|
+
async function selectProfileToCopyVariablesFrom(existingProfiles) {
|
|
25
|
+
let profileToCopyVariablesFrom;
|
|
26
|
+
if (existingProfiles.length == 1) {
|
|
27
|
+
logger_1.uiLogger.log('');
|
|
28
|
+
logger_1.uiLogger.log(en_1.commands.project.profile.add.logs.copyExistingProfile((0, project_parsing_lib_1.getHsProfileFilename)(existingProfiles[0])));
|
|
29
|
+
const shouldCopyVariables = await (0, promptUtils_1.confirmPrompt)('Copy profile variables?', {
|
|
30
|
+
defaultAnswer: true,
|
|
31
|
+
});
|
|
32
|
+
if (shouldCopyVariables) {
|
|
33
|
+
profileToCopyVariablesFrom = existingProfiles[0];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (existingProfiles.length > 1) {
|
|
37
|
+
logger_1.uiLogger.log('');
|
|
38
|
+
logger_1.uiLogger.log(en_1.commands.project.profile.add.logs.copyExistingProfiles);
|
|
39
|
+
const emptyChoice = {
|
|
40
|
+
name: en_1.commands.project.profile.add.prompts.copyExistingProfilePromptEmpty,
|
|
41
|
+
value: undefined,
|
|
42
|
+
};
|
|
43
|
+
const promptResponse = await (0, promptUtils_1.listPrompt)(en_1.commands.project.profile.add.prompts.copyExistingProfilePrompt, {
|
|
44
|
+
choices: [
|
|
45
|
+
...existingProfiles.map(profile => ({
|
|
46
|
+
name: (0, project_parsing_lib_1.getHsProfileFilename)(profile),
|
|
47
|
+
value: profile,
|
|
48
|
+
})),
|
|
49
|
+
emptyChoice,
|
|
50
|
+
],
|
|
51
|
+
});
|
|
52
|
+
if (promptResponse) {
|
|
53
|
+
profileToCopyVariablesFrom = promptResponse;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return profileToCopyVariablesFrom;
|
|
57
|
+
}
|
|
58
|
+
async function handler(args) {
|
|
59
|
+
const { derivedAccountId } = args;
|
|
60
|
+
(0, usageTracking_1.trackCommandUsage)('project-profile-add', undefined, derivedAccountId);
|
|
61
|
+
const { projectConfig, projectDir } = await (0, config_2.getProjectConfig)();
|
|
62
|
+
if (!projectConfig || !projectDir) {
|
|
63
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.add.errors.noProjectConfig);
|
|
64
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
65
|
+
}
|
|
66
|
+
const projectSourceDir = path_1.default.join(projectDir, projectConfig.srcDir);
|
|
67
|
+
let profileName = args.name;
|
|
68
|
+
let targetAccountId = args.targetAccount;
|
|
69
|
+
function checkIfProfileExists(profileName) {
|
|
70
|
+
return (0, validation_1.fileExists)(path_1.default.join(projectSourceDir, (0, project_parsing_lib_1.getHsProfileFilename)(profileName)));
|
|
71
|
+
}
|
|
72
|
+
function isValidProfileName(profileName) {
|
|
73
|
+
const trimmedProfileName = profileName.trim();
|
|
74
|
+
if (trimmedProfileName === '') {
|
|
75
|
+
return en_1.commands.project.profile.add.prompts.emptyName;
|
|
76
|
+
}
|
|
77
|
+
if (!/^[a-zA-Z0-9]+$/.test(trimmedProfileName)) {
|
|
78
|
+
return en_1.commands.project.profile.add.prompts.invalidProfileName;
|
|
79
|
+
}
|
|
80
|
+
if (checkIfProfileExists(trimmedProfileName)) {
|
|
81
|
+
return en_1.commands.project.profile.add.errors.profileExists(trimmedProfileName);
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
if (profileName) {
|
|
86
|
+
if (checkIfProfileExists(profileName)) {
|
|
87
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.add.errors.profileExists((0, project_parsing_lib_1.getHsProfileFilename)(profileName)));
|
|
88
|
+
logger_1.uiLogger.log('');
|
|
89
|
+
profileName = undefined;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const validationResult = isValidProfileName(profileName);
|
|
93
|
+
if (validationResult !== true) {
|
|
94
|
+
logger_1.uiLogger.error(validationResult);
|
|
95
|
+
logger_1.uiLogger.log('');
|
|
96
|
+
profileName = undefined;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (!profileName) {
|
|
101
|
+
const promptResponse = await (0, promptUtils_1.promptUser)({
|
|
102
|
+
type: 'input',
|
|
103
|
+
name: 'name',
|
|
104
|
+
message: en_1.commands.project.profile.add.prompts.namePrompt,
|
|
105
|
+
validate: isValidProfileName,
|
|
106
|
+
});
|
|
107
|
+
profileName = promptResponse.name;
|
|
108
|
+
}
|
|
109
|
+
if (targetAccountId) {
|
|
110
|
+
const accountId = (0, config_1.getAccountId)(targetAccountId);
|
|
111
|
+
if (accountId) {
|
|
112
|
+
targetAccountId = accountId;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.add.errors.invalidTargetAccount);
|
|
116
|
+
logger_1.uiLogger.log('');
|
|
117
|
+
targetAccountId = undefined;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (!targetAccountId) {
|
|
121
|
+
const configuredAccounts = (0, config_1.getConfigAccounts)();
|
|
122
|
+
if (!configuredAccounts || !configuredAccounts.length) {
|
|
123
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.add.errors.noAccountsConfigured);
|
|
124
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
125
|
+
}
|
|
126
|
+
const promptResponse = await (0, promptUtils_1.listPrompt)(en_1.commands.project.profile.add.prompts.targetAccountPrompt, {
|
|
127
|
+
choices: configuredAccounts.map(account => {
|
|
128
|
+
const accountId = (0, getAccountIdentifier_1.getAccountIdentifier)(account);
|
|
129
|
+
return {
|
|
130
|
+
name: (0, ui_1.uiAccountDescription)(accountId),
|
|
131
|
+
value: accountId,
|
|
132
|
+
};
|
|
133
|
+
}),
|
|
134
|
+
});
|
|
135
|
+
if (promptResponse) {
|
|
136
|
+
targetAccountId = promptResponse;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const existingProfiles = await (0, project_parsing_lib_1.getAllHsProfiles)(projectSourceDir);
|
|
140
|
+
let existingTargetAccountIdSelected = false;
|
|
141
|
+
for (const profile of existingProfiles) {
|
|
142
|
+
try {
|
|
143
|
+
const loadedProfile = (0, project_parsing_lib_1.loadHsProfileFile)(projectSourceDir, profile);
|
|
144
|
+
if (loadedProfile?.accountId === targetAccountId) {
|
|
145
|
+
existingTargetAccountIdSelected = true;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
// Skip profiles that can't be loaded
|
|
151
|
+
(0, errorHandlers_1.debugError)(err);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (existingTargetAccountIdSelected) {
|
|
155
|
+
logger_1.uiLogger.log('');
|
|
156
|
+
logger_1.uiLogger.warn(en_1.commands.project.profile.add.warnings.duplicateTargetAccount(targetAccountId));
|
|
157
|
+
}
|
|
158
|
+
const profileFileContent = {
|
|
159
|
+
accountId: targetAccountId,
|
|
160
|
+
variables: {},
|
|
161
|
+
};
|
|
162
|
+
const profileToCopyVariablesFrom = await selectProfileToCopyVariablesFrom(existingProfiles);
|
|
163
|
+
if (profileToCopyVariablesFrom) {
|
|
164
|
+
try {
|
|
165
|
+
const profileToCopyFileContent = (0, project_parsing_lib_1.loadHsProfileFile)(projectSourceDir, profileToCopyVariablesFrom);
|
|
166
|
+
if (profileToCopyFileContent?.variables) {
|
|
167
|
+
profileFileContent.variables = profileToCopyFileContent.variables;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.add.errors.failedToLoadProfile(profileToCopyVariablesFrom));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const profileFilename = (0, project_parsing_lib_1.getHsProfileFilename)(profileName);
|
|
175
|
+
try {
|
|
176
|
+
fs_1.default.writeFileSync(path_1.default.join(projectSourceDir, profileFilename), JSON.stringify(profileFileContent, null, 2), 'utf8');
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.add.errors.failedToCreateProfile);
|
|
180
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
181
|
+
}
|
|
182
|
+
logger_1.uiLogger.log('');
|
|
183
|
+
logger_1.uiLogger.log(en_1.commands.project.profile.add.logs.profileAdded(profileFilename));
|
|
184
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
185
|
+
}
|
|
186
|
+
function projectProfileAddBuilder(yargs) {
|
|
187
|
+
yargs.positional('name', {
|
|
188
|
+
describe: en_1.commands.project.profile.add.positionals.name,
|
|
189
|
+
type: 'string',
|
|
190
|
+
});
|
|
191
|
+
yargs.option('target-account', {
|
|
192
|
+
describe: en_1.commands.project.profile.add.options.targetAccount,
|
|
193
|
+
type: 'number',
|
|
194
|
+
});
|
|
195
|
+
yargs.example([
|
|
196
|
+
['$0 project profile add qa', en_1.commands.project.profile.add.example],
|
|
197
|
+
]);
|
|
198
|
+
return yargs;
|
|
199
|
+
}
|
|
200
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(projectProfileAddBuilder, command, verboseDescribe, {
|
|
201
|
+
useGlobalOptions: true,
|
|
202
|
+
});
|
|
203
|
+
const projectProfileAddCommand = {
|
|
204
|
+
command,
|
|
205
|
+
describe,
|
|
206
|
+
handler,
|
|
207
|
+
builder,
|
|
208
|
+
};
|
|
209
|
+
exports.default = projectProfileAddCommand;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { YargsCommandModule, CommonArgs } from '../../../types/Yargs';
|
|
2
|
+
type ProjectProfileDeleteArgs = CommonArgs & {
|
|
3
|
+
name?: string;
|
|
4
|
+
};
|
|
5
|
+
declare const projectProfileDeleteCommand: YargsCommandModule<unknown, ProjectProfileDeleteArgs>;
|
|
6
|
+
export default projectProfileDeleteCommand;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
9
|
+
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
10
|
+
const projects_2 = require("@hubspot/local-dev-lib/api/projects");
|
|
11
|
+
const usageTracking_1 = require("../../../lib/usageTracking");
|
|
12
|
+
const config_1 = require("../../../lib/projects/config");
|
|
13
|
+
const ui_1 = require("../../../lib/ui");
|
|
14
|
+
const logger_1 = require("../../../lib/ui/logger");
|
|
15
|
+
const exitCodes_1 = require("../../../lib/enums/exitCodes");
|
|
16
|
+
const yargsUtils_1 = require("../../../lib/yargsUtils");
|
|
17
|
+
const en_1 = require("../../../lang/en");
|
|
18
|
+
const promptUtils_1 = require("../../../lib/prompts/promptUtils");
|
|
19
|
+
const validation_1 = require("../../../lib/validation");
|
|
20
|
+
const errorHandlers_1 = require("../../../lib/errorHandlers");
|
|
21
|
+
const command = 'delete [name]';
|
|
22
|
+
const describe = (0, ui_1.uiBetaTag)(en_1.commands.project.profile.delete.describe, false);
|
|
23
|
+
async function handler(args) {
|
|
24
|
+
const { derivedAccountId } = args;
|
|
25
|
+
(0, usageTracking_1.trackCommandUsage)('project-profile-delete', undefined, derivedAccountId);
|
|
26
|
+
const { projectConfig, projectDir } = await (0, config_1.getProjectConfig)();
|
|
27
|
+
if (!projectConfig || !projectDir) {
|
|
28
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.delete.errors.noProjectConfig);
|
|
29
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
30
|
+
}
|
|
31
|
+
const projectSourceDir = path_1.default.join(projectDir, projectConfig.srcDir);
|
|
32
|
+
let profileName = undefined;
|
|
33
|
+
if (args.name) {
|
|
34
|
+
profileName = args.name;
|
|
35
|
+
const profileFilename = (0, project_parsing_lib_1.getHsProfileFilename)(profileName);
|
|
36
|
+
if (!(0, validation_1.fileExists)(path_1.default.join(projectSourceDir, profileFilename))) {
|
|
37
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.delete.errors.noProfileFound(profileFilename));
|
|
38
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const existingProfiles = await (0, project_parsing_lib_1.getAllHsProfiles)(projectSourceDir);
|
|
43
|
+
if (existingProfiles.length === 0) {
|
|
44
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.delete.errors.noProfilesFound);
|
|
45
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
46
|
+
}
|
|
47
|
+
const promptResponse = await (0, promptUtils_1.listPrompt)(en_1.commands.project.profile.delete.prompts.deleteProfilePrompt, {
|
|
48
|
+
choices: existingProfiles.map(profile => ({
|
|
49
|
+
name: (0, project_parsing_lib_1.getHsProfileFilename)(profile),
|
|
50
|
+
value: profile,
|
|
51
|
+
})),
|
|
52
|
+
});
|
|
53
|
+
if (promptResponse) {
|
|
54
|
+
profileName = promptResponse;
|
|
55
|
+
}
|
|
56
|
+
logger_1.uiLogger.log('');
|
|
57
|
+
}
|
|
58
|
+
// This should never happen
|
|
59
|
+
if (!profileName) {
|
|
60
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
61
|
+
}
|
|
62
|
+
let targetAccountId;
|
|
63
|
+
try {
|
|
64
|
+
const profileToDelete = (0, project_parsing_lib_1.loadHsProfileFile)(projectSourceDir, profileName);
|
|
65
|
+
targetAccountId = profileToDelete?.accountId;
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
logger_1.uiLogger.debug(en_1.commands.project.profile.delete.debug.failedToLoadProfile(profileName));
|
|
69
|
+
}
|
|
70
|
+
if (targetAccountId) {
|
|
71
|
+
let projectExists = false;
|
|
72
|
+
try {
|
|
73
|
+
const fetchProjectResponse = await (0, projects_1.fetchProject)(targetAccountId, projectConfig.name);
|
|
74
|
+
projectExists = !!fetchProjectResponse.data;
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
(0, errorHandlers_1.debugError)(err);
|
|
78
|
+
}
|
|
79
|
+
if (projectExists) {
|
|
80
|
+
const confirmResponse = await (0, promptUtils_1.confirmPrompt)(en_1.commands.project.profile.delete.prompts.deleteProjectPrompt(targetAccountId), {
|
|
81
|
+
defaultAnswer: false,
|
|
82
|
+
});
|
|
83
|
+
if (confirmResponse) {
|
|
84
|
+
await (0, projects_2.deleteProject)(targetAccountId, projectConfig.name);
|
|
85
|
+
logger_1.uiLogger.log(en_1.commands.project.profile.delete.logs.deletedProject(targetAccountId));
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
logger_1.uiLogger.log(en_1.commands.project.profile.delete.logs.didNotDeleteProject(targetAccountId));
|
|
89
|
+
}
|
|
90
|
+
logger_1.uiLogger.log('');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const profileFilename = (0, project_parsing_lib_1.getHsProfileFilename)(profileName);
|
|
94
|
+
try {
|
|
95
|
+
fs_1.default.unlinkSync(path_1.default.join(projectSourceDir, profileFilename));
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.delete.errors.failedToDeleteProfile(profileFilename));
|
|
99
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
100
|
+
}
|
|
101
|
+
logger_1.uiLogger.log(en_1.commands.project.profile.delete.logs.profileDeleted(profileFilename));
|
|
102
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
103
|
+
}
|
|
104
|
+
function projectProfileDeleteBuilder(yargs) {
|
|
105
|
+
yargs.positional('name', {
|
|
106
|
+
describe: en_1.commands.project.profile.delete.positionals.name,
|
|
107
|
+
type: 'string',
|
|
108
|
+
});
|
|
109
|
+
yargs.example([
|
|
110
|
+
['$0 project profile delete qa', en_1.commands.project.profile.delete.example],
|
|
111
|
+
]);
|
|
112
|
+
return yargs;
|
|
113
|
+
}
|
|
114
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(projectProfileDeleteBuilder, command, describe, {
|
|
115
|
+
useGlobalOptions: true,
|
|
116
|
+
});
|
|
117
|
+
const projectProfileDeleteCommand = {
|
|
118
|
+
command,
|
|
119
|
+
describe,
|
|
120
|
+
handler,
|
|
121
|
+
builder,
|
|
122
|
+
};
|
|
123
|
+
exports.default = projectProfileDeleteCommand;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const ui_1 = require("../../lib/ui");
|
|
7
|
+
const add_1 = __importDefault(require("./profile/add"));
|
|
8
|
+
const delete_1 = __importDefault(require("./profile/delete"));
|
|
9
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
10
|
+
const en_1 = require("../../lang/en");
|
|
11
|
+
const command = ['profile', 'profiles'];
|
|
12
|
+
const describe = undefined; // uiBetaTag(commands.project.profile.describe, false);
|
|
13
|
+
const verboseDescribe = (0, ui_1.uiBetaTag)(en_1.commands.project.profile.verboseDescribe, false);
|
|
14
|
+
function projectProfileBuilder(yargs) {
|
|
15
|
+
yargs.command(add_1.default).command(delete_1.default).demandCommand(1, '');
|
|
16
|
+
return yargs;
|
|
17
|
+
}
|
|
18
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(projectProfileBuilder, command, verboseDescribe);
|
|
19
|
+
const projectProfileCommand = {
|
|
20
|
+
command,
|
|
21
|
+
describe,
|
|
22
|
+
builder,
|
|
23
|
+
handler: () => { },
|
|
24
|
+
};
|
|
25
|
+
exports.default = projectProfileCommand;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { CommonArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type ProjectUploadArgs = CommonArgs & {
|
|
3
|
+
forceCreate: boolean;
|
|
4
|
+
message: string;
|
|
5
|
+
m: string;
|
|
6
|
+
skipValidation: boolean;
|
|
7
|
+
profile?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const projectUploadCommand: YargsCommandModule<unknown, ProjectUploadArgs>;
|
|
10
|
+
export default projectUploadCommand;
|