@hubspot/cli 7.5.2-experimental.0 → 7.5.3-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/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 +172 -91
- 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
package/commands/logs.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const { isHubSpotHttpError } = require('@hubspot/local-dev-lib/errors/index');
|
|
14
|
-
const i18nKey = 'commands.logs';
|
|
3
|
+
const usageTracking_1 = require("../lib/usageTracking");
|
|
4
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
5
|
+
const serverlessFunctionLogs_1 = require("../lib/ui/serverlessFunctionLogs");
|
|
6
|
+
const functions_1 = require("@hubspot/local-dev-lib/api/functions");
|
|
7
|
+
const serverlessLogs_1 = require("../lib/serverlessLogs");
|
|
8
|
+
const lang_1 = require("../lib/lang");
|
|
9
|
+
const promptUtils_1 = require("../lib/prompts/promptUtils");
|
|
10
|
+
const exitCodes_1 = require("../lib/enums/exitCodes");
|
|
11
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
12
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
15
13
|
const handleLogsError = (e, accountId, functionPath) => {
|
|
16
|
-
if (isHubSpotHttpError(e) && (e.status === 404 || e.status == 400)) {
|
|
17
|
-
logger.error(i18n(
|
|
14
|
+
if ((0, index_1.isHubSpotHttpError)(e) && (e.status === 404 || e.status == 400)) {
|
|
15
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.logs.errors.noLogsFound`, {
|
|
18
16
|
accountId,
|
|
19
17
|
functionPath,
|
|
20
18
|
}));
|
|
@@ -22,101 +20,111 @@ const handleLogsError = (e, accountId, functionPath) => {
|
|
|
22
20
|
};
|
|
23
21
|
const endpointLog = async (accountId, functionPath, options) => {
|
|
24
22
|
const { limit, latest, follow, compact } = options;
|
|
25
|
-
const
|
|
23
|
+
const requestParams = {
|
|
26
24
|
limit,
|
|
27
25
|
latest,
|
|
28
26
|
follow,
|
|
29
|
-
compact,
|
|
30
27
|
endpoint: functionPath,
|
|
31
28
|
};
|
|
32
|
-
logger.debug(i18n(
|
|
29
|
+
logger_1.logger.debug((0, lang_1.i18n)(`commands.logs.gettingLogs`, {
|
|
33
30
|
latest,
|
|
34
31
|
functionPath,
|
|
35
32
|
}));
|
|
36
33
|
let logsResp;
|
|
37
34
|
if (follow) {
|
|
38
|
-
const tailCall = after => getFunctionLogs(accountId, functionPath, { after });
|
|
35
|
+
const tailCall = (after) => (0, functions_1.getFunctionLogs)(accountId, functionPath, { after });
|
|
39
36
|
const fetchLatest = () => {
|
|
40
37
|
try {
|
|
41
|
-
return getLatestFunctionLog(accountId, functionPath);
|
|
38
|
+
return (0, functions_1.getLatestFunctionLog)(accountId, functionPath);
|
|
42
39
|
}
|
|
43
40
|
catch (e) {
|
|
44
41
|
handleLogsError(e, accountId, functionPath);
|
|
42
|
+
return Promise.reject(e);
|
|
45
43
|
}
|
|
46
44
|
};
|
|
47
|
-
await tailLogs(accountId, functionPath, fetchLatest, tailCall, compact);
|
|
45
|
+
await (0, serverlessLogs_1.tailLogs)(accountId, functionPath, fetchLatest, tailCall, compact);
|
|
48
46
|
}
|
|
49
47
|
else if (latest) {
|
|
50
48
|
try {
|
|
51
|
-
const { data } = await getLatestFunctionLog(accountId, functionPath);
|
|
49
|
+
const { data } = await (0, functions_1.getLatestFunctionLog)(accountId, functionPath);
|
|
52
50
|
logsResp = data;
|
|
53
51
|
}
|
|
54
52
|
catch (e) {
|
|
55
53
|
handleLogsError(e, accountId, functionPath);
|
|
56
|
-
process.exit(EXIT_CODES.ERROR);
|
|
54
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
57
|
else {
|
|
60
58
|
try {
|
|
61
|
-
const { data } = await getFunctionLogs(accountId, functionPath,
|
|
59
|
+
const { data } = await (0, functions_1.getFunctionLogs)(accountId, functionPath, requestParams);
|
|
62
60
|
logsResp = data;
|
|
63
61
|
}
|
|
64
62
|
catch (e) {
|
|
65
63
|
handleLogsError(e, accountId, functionPath);
|
|
66
|
-
process.exit(EXIT_CODES.ERROR);
|
|
64
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
if (logsResp) {
|
|
70
|
-
return outputLogs(logsResp,
|
|
68
|
+
return (0, serverlessFunctionLogs_1.outputLogs)(logsResp, { compact });
|
|
71
69
|
}
|
|
72
70
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
const command = 'logs [endpoint]';
|
|
72
|
+
const describe = (0, lang_1.i18n)(`commands.logs.describe`);
|
|
73
|
+
const handler = async (options) => {
|
|
76
74
|
const { endpoint: endpointArgValue, latest, derivedAccountId } = options;
|
|
77
|
-
trackCommandUsage('logs', { latest }, derivedAccountId);
|
|
78
|
-
const { endpointPromptValue } = await promptUser({
|
|
75
|
+
(0, usageTracking_1.trackCommandUsage)('logs', latest ? { action: 'latest' } : {}, derivedAccountId);
|
|
76
|
+
const { endpointPromptValue } = await (0, promptUtils_1.promptUser)({
|
|
79
77
|
name: 'endpointPromptValue',
|
|
80
|
-
message: i18n(
|
|
78
|
+
message: (0, lang_1.i18n)(`commands.logs.endpointPrompt`),
|
|
81
79
|
when: !endpointArgValue,
|
|
82
80
|
});
|
|
83
|
-
endpointLog(derivedAccountId, endpointArgValue || endpointPromptValue, options);
|
|
81
|
+
await endpointLog(derivedAccountId, endpointArgValue || endpointPromptValue, options);
|
|
84
82
|
};
|
|
85
|
-
|
|
83
|
+
function logsBuilder(yargs) {
|
|
86
84
|
yargs.positional('endpoint', {
|
|
87
|
-
describe: i18n(
|
|
85
|
+
describe: (0, lang_1.i18n)(`commands.logs.positionals.endpoint.describe`),
|
|
88
86
|
type: 'string',
|
|
89
87
|
});
|
|
90
88
|
yargs
|
|
91
89
|
.options({
|
|
92
90
|
latest: {
|
|
93
91
|
alias: 'l',
|
|
94
|
-
describe: i18n(
|
|
92
|
+
describe: (0, lang_1.i18n)(`commands.logs.options.latest.describe`),
|
|
95
93
|
type: 'boolean',
|
|
96
94
|
},
|
|
97
95
|
compact: {
|
|
98
|
-
describe: i18n(
|
|
96
|
+
describe: (0, lang_1.i18n)(`commands.logs.options.compact.describe`),
|
|
99
97
|
type: 'boolean',
|
|
100
98
|
},
|
|
101
99
|
follow: {
|
|
102
100
|
alias: ['f'],
|
|
103
|
-
describe: i18n(
|
|
101
|
+
describe: (0, lang_1.i18n)(`commands.logs.options.follow.describe`),
|
|
104
102
|
type: 'boolean',
|
|
105
103
|
},
|
|
106
104
|
limit: {
|
|
107
|
-
describe: i18n(
|
|
105
|
+
describe: (0, lang_1.i18n)(`commands.logs.options.limit.describe`),
|
|
108
106
|
type: 'number',
|
|
109
107
|
},
|
|
110
108
|
})
|
|
111
109
|
.conflicts('follow', 'limit');
|
|
112
110
|
yargs.example([
|
|
113
|
-
['$0 logs my-endpoint', i18n(
|
|
114
|
-
['$0 logs my-endpoint --limit=10', i18n(
|
|
115
|
-
['$0 logs my-endpoint --follow', i18n(
|
|
111
|
+
['$0 logs my-endpoint', (0, lang_1.i18n)(`commands.logs.examples.default`)],
|
|
112
|
+
['$0 logs my-endpoint --limit=10', (0, lang_1.i18n)(`commands.logs.examples.limit`)],
|
|
113
|
+
['$0 logs my-endpoint --follow', (0, lang_1.i18n)(`commands.logs.examples.follow`)],
|
|
116
114
|
]);
|
|
117
|
-
addConfigOptions(yargs);
|
|
118
|
-
addAccountOptions(yargs);
|
|
119
|
-
addUseEnvironmentOptions(yargs);
|
|
120
|
-
addGlobalOptions(yargs);
|
|
121
115
|
return yargs;
|
|
116
|
+
}
|
|
117
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(logsBuilder, command, describe, {
|
|
118
|
+
useGlobalOptions: true,
|
|
119
|
+
useConfigOptions: true,
|
|
120
|
+
useAccountOptions: true,
|
|
121
|
+
useEnvironmentOptions: true,
|
|
122
|
+
});
|
|
123
|
+
const logsCommand = {
|
|
124
|
+
command,
|
|
125
|
+
describe,
|
|
126
|
+
builder,
|
|
127
|
+
handler,
|
|
122
128
|
};
|
|
129
|
+
exports.default = logsCommand;
|
|
130
|
+
module.exports = logsCommand;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
4
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
5
|
+
const en_1 = require("../../lang/en");
|
|
6
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
7
|
+
const setup_1 = require("../../lib/mcp/setup");
|
|
8
|
+
const command = ['setup', 'update'];
|
|
9
|
+
const describe = undefined; // Leave hidden for now
|
|
10
|
+
async function handler(args) {
|
|
11
|
+
try {
|
|
12
|
+
await import('@modelcontextprotocol/sdk/server/mcp.js');
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
logger_1.uiLogger.error(en_1.commands.mcp.setup.errors.needsNode20);
|
|
16
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const derivedTargets = await (0, setup_1.addMcpServerToConfig)(args.client);
|
|
20
|
+
if (args.addDocsSearch) {
|
|
21
|
+
await (0, setup_1.addMintlifyMcpServer)(derivedTargets);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
26
|
+
}
|
|
27
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
28
|
+
}
|
|
29
|
+
function setupBuilder(yargs) {
|
|
30
|
+
yargs
|
|
31
|
+
.option('client', {
|
|
32
|
+
describe: en_1.commands.mcp.setup.args.client,
|
|
33
|
+
type: 'array',
|
|
34
|
+
choices: [...setup_1.supportedTools.map(tool => tool.value)],
|
|
35
|
+
})
|
|
36
|
+
.option('add-docs-search', {
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
});
|
|
39
|
+
return yargs;
|
|
40
|
+
}
|
|
41
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(setupBuilder, command, describe, {
|
|
42
|
+
useGlobalOptions: true,
|
|
43
|
+
});
|
|
44
|
+
const mcpSetupCommand = {
|
|
45
|
+
command,
|
|
46
|
+
describe,
|
|
47
|
+
handler,
|
|
48
|
+
builder,
|
|
49
|
+
};
|
|
50
|
+
exports.default = mcpSetupCommand;
|
|
@@ -0,0 +1,75 @@
|
|
|
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 child_process_1 = require("child_process");
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
10
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
11
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
12
|
+
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
13
|
+
const en_1 = require("../../lang/en");
|
|
14
|
+
const process_1 = require("../../lib/process");
|
|
15
|
+
const command = 'start';
|
|
16
|
+
const describe = undefined; // Leave hidden for now
|
|
17
|
+
async function handler() {
|
|
18
|
+
try {
|
|
19
|
+
await import('@modelcontextprotocol/sdk/server/mcp.js');
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
logger_1.uiLogger.error(en_1.commands.mcp.start.errors.needsNode20);
|
|
23
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
24
|
+
}
|
|
25
|
+
await startMcpServer();
|
|
26
|
+
}
|
|
27
|
+
async function startMcpServer() {
|
|
28
|
+
try {
|
|
29
|
+
const serverPath = path_1.default.join(__dirname, '..', '..', 'mcp-server', 'server.js');
|
|
30
|
+
// Check if server file exists
|
|
31
|
+
if (!fs_1.default.existsSync(serverPath)) {
|
|
32
|
+
logger_1.uiLogger.error(en_1.commands.mcp.start.errors.serverFileNotFound(serverPath));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
logger_1.uiLogger.info(en_1.commands.mcp.start.startingServer);
|
|
36
|
+
logger_1.uiLogger.info(en_1.commands.mcp.start.stopInstructions);
|
|
37
|
+
// Start the server using ts-node
|
|
38
|
+
const child = (0, child_process_1.spawn)('node', [serverPath], {
|
|
39
|
+
stdio: 'inherit',
|
|
40
|
+
env: {
|
|
41
|
+
...process.env,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
// Handle server process events
|
|
45
|
+
child.on('error', error => {
|
|
46
|
+
(0, errorHandlers_1.logError)(error);
|
|
47
|
+
logger_1.uiLogger.error(en_1.commands.mcp.start.errors.failedToStart);
|
|
48
|
+
});
|
|
49
|
+
child.on('close', () => {
|
|
50
|
+
logger_1.uiLogger.info(en_1.commands.mcp.start.stoppedSuccessfully);
|
|
51
|
+
});
|
|
52
|
+
(0, process_1.handleExit)(() => {
|
|
53
|
+
logger_1.uiLogger.info(en_1.commands.mcp.start.shuttingDown);
|
|
54
|
+
child.kill('SIGTERM');
|
|
55
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
logger_1.uiLogger.error(en_1.commands.mcp.start.errors.failedToStart);
|
|
60
|
+
(0, errorHandlers_1.logError)(error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function startBuilder(yargs) {
|
|
64
|
+
return yargs;
|
|
65
|
+
}
|
|
66
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(startBuilder, command, describe, {
|
|
67
|
+
useGlobalOptions: true,
|
|
68
|
+
});
|
|
69
|
+
const mcpStartCommand = {
|
|
70
|
+
command,
|
|
71
|
+
describe,
|
|
72
|
+
handler,
|
|
73
|
+
builder,
|
|
74
|
+
};
|
|
75
|
+
exports.default = mcpStartCommand;
|
package/commands/mcp.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
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 start_1 = __importDefault(require("./mcp/start"));
|
|
7
|
+
const setup_1 = __importDefault(require("./mcp/setup"));
|
|
8
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
9
|
+
const en_1 = require("../lang/en");
|
|
10
|
+
const command = 'mcp';
|
|
11
|
+
// Leave this as undefined to hide the command
|
|
12
|
+
const describe = undefined;
|
|
13
|
+
function mcpBuilder(yargs) {
|
|
14
|
+
yargs.command(start_1.default).command(setup_1.default).demandCommand(1, '');
|
|
15
|
+
return yargs;
|
|
16
|
+
}
|
|
17
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(mcpBuilder, command, en_1.commands.mcp.describe, {
|
|
18
|
+
useGlobalOptions: true,
|
|
19
|
+
});
|
|
20
|
+
const mcpCommand = {
|
|
21
|
+
command,
|
|
22
|
+
describe,
|
|
23
|
+
builder,
|
|
24
|
+
handler: () => { },
|
|
25
|
+
};
|
|
26
|
+
exports.default = mcpCommand;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type MarketplaceValidateArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
3
|
+
src: string;
|
|
4
|
+
};
|
|
5
|
+
declare const marketplaceValidateCommand: YargsCommandModule<unknown, MarketplaceValidateArgs>;
|
|
6
|
+
export default marketplaceValidateCommand;
|
|
@@ -1,39 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
text: i18n(`${i18nKey}.logs.validatingModule`, {
|
|
18
|
-
path: src,
|
|
19
|
-
}),
|
|
6
|
+
const SpinniesManager_1 = __importDefault(require("../../lib/ui/SpinniesManager"));
|
|
7
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
8
|
+
const marketplaceValidate_1 = require("../../lib/marketplaceValidate");
|
|
9
|
+
const en_1 = require("../../lang/en");
|
|
10
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
11
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
12
|
+
const command = 'marketplace-validate <src>';
|
|
13
|
+
const describe = en_1.commands.module.subcommands.marketplaceValidate.describe;
|
|
14
|
+
async function handler(args) {
|
|
15
|
+
const { src, derivedAccountId } = args;
|
|
16
|
+
(0, usageTracking_1.trackCommandUsage)('validate', undefined, derivedAccountId);
|
|
17
|
+
SpinniesManager_1.default.init();
|
|
18
|
+
SpinniesManager_1.default.add('marketplaceValidation', {
|
|
19
|
+
text: en_1.commands.module.subcommands.marketplaceValidate.logs.validatingModule(src),
|
|
20
20
|
});
|
|
21
21
|
const assetType = 'MODULE';
|
|
22
|
-
const validationId = await kickOffValidation(derivedAccountId, assetType, src);
|
|
23
|
-
await pollForValidationFinish(derivedAccountId, validationId);
|
|
24
|
-
|
|
25
|
-
const validationResults = await fetchValidationResults(derivedAccountId, validationId);
|
|
26
|
-
processValidationErrors(
|
|
27
|
-
displayValidationResults(
|
|
28
|
-
process.exit();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
addConfigOptions(yargs);
|
|
32
|
-
addAccountOptions(yargs);
|
|
33
|
-
addUseEnvironmentOptions(yargs);
|
|
22
|
+
const validationId = await (0, marketplaceValidate_1.kickOffValidation)(derivedAccountId, assetType, src);
|
|
23
|
+
await (0, marketplaceValidate_1.pollForValidationFinish)(derivedAccountId, validationId);
|
|
24
|
+
SpinniesManager_1.default.remove('marketplaceValidation');
|
|
25
|
+
const validationResults = await (0, marketplaceValidate_1.fetchValidationResults)(derivedAccountId, validationId);
|
|
26
|
+
(0, marketplaceValidate_1.processValidationErrors)(en_1.commands.module.subcommands.marketplaceValidate.errors.invalidPath, validationResults);
|
|
27
|
+
(0, marketplaceValidate_1.displayValidationResults)(en_1.commands.module.subcommands.marketplaceValidate.results, validationResults);
|
|
28
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
29
|
+
}
|
|
30
|
+
function marketplaceValidateBuilder(yargs) {
|
|
34
31
|
yargs.positional('src', {
|
|
35
|
-
describe:
|
|
32
|
+
describe: en_1.commands.module.subcommands.marketplaceValidate.positionals.src,
|
|
36
33
|
type: 'string',
|
|
37
34
|
});
|
|
38
35
|
return yargs;
|
|
36
|
+
}
|
|
37
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(marketplaceValidateBuilder, command, describe, {
|
|
38
|
+
useConfigOptions: true,
|
|
39
|
+
useAccountOptions: true,
|
|
40
|
+
useEnvironmentOptions: true,
|
|
41
|
+
});
|
|
42
|
+
const marketplaceValidateCommand = {
|
|
43
|
+
command,
|
|
44
|
+
describe,
|
|
45
|
+
handler,
|
|
46
|
+
builder,
|
|
39
47
|
};
|
|
48
|
+
exports.default = marketplaceValidateCommand;
|
package/commands/module.d.ts
CHANGED
package/commands/module.js
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.builder = yargs => {
|
|
11
|
-
addConfigOptions(yargs);
|
|
12
|
-
addAccountOptions(yargs);
|
|
13
|
-
addGlobalOptions(yargs);
|
|
14
|
-
yargs.command(marketplaceValidate).demandCommand(1, '');
|
|
6
|
+
const marketplace_validate_1 = __importDefault(require("./module/marketplace-validate"));
|
|
7
|
+
const en_1 = require("../lang/en");
|
|
8
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
9
|
+
const command = 'module';
|
|
10
|
+
const describe = en_1.commands.module.describe;
|
|
11
|
+
function moduleBuilder(yargs) {
|
|
12
|
+
yargs.command(marketplace_validate_1.default).demandCommand(1, '');
|
|
15
13
|
return yargs;
|
|
14
|
+
}
|
|
15
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(moduleBuilder, command, describe, {
|
|
16
|
+
useGlobalOptions: true,
|
|
17
|
+
useConfigOptions: true,
|
|
18
|
+
useAccountOptions: true,
|
|
19
|
+
});
|
|
20
|
+
const moduleCommand = {
|
|
21
|
+
command,
|
|
22
|
+
describe,
|
|
23
|
+
builder,
|
|
24
|
+
handler: () => { },
|
|
16
25
|
};
|
|
26
|
+
exports.default = moduleCommand;
|
|
27
|
+
module.exports = moduleCommand;
|
package/commands/mv.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommonArgs, ConfigArgs, EnvironmentArgs } from '../types/Yargs';
|
|
3
|
-
export declare const command = "mv <srcPath> <destPath>";
|
|
4
|
-
export declare const describe: string;
|
|
1
|
+
import { CommonArgs, ConfigArgs, EnvironmentArgs, YargsCommandModule } from '../types/Yargs';
|
|
5
2
|
type MvArgs = CommonArgs & ConfigArgs & EnvironmentArgs & {
|
|
6
3
|
srcPath: string;
|
|
7
4
|
destPath: string;
|
|
8
5
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {};
|
|
6
|
+
declare const cmsMvCommand: YargsCommandModule<unknown, MvArgs>;
|
|
7
|
+
export default cmsMvCommand;
|
package/commands/mv.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe = exports.command = void 0;
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
3
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
4
|
const fileMapper_1 = require("@hubspot/local-dev-lib/api/fileMapper");
|
|
8
5
|
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
9
6
|
const index_2 = require("../lib/errorHandlers/index");
|
|
10
|
-
const commonOpts_1 = require("../lib/commonOpts");
|
|
11
7
|
const usageTracking_1 = require("../lib/usageTracking");
|
|
12
8
|
const filesystem_1 = require("../lib/filesystem");
|
|
13
9
|
const lang_1 = require("../lib/lang");
|
|
14
10
|
const ui_1 = require("../lib/ui");
|
|
15
|
-
const
|
|
11
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
16
12
|
function getCorrectedDestPath(srcPath, destPath) {
|
|
17
13
|
if (!(0, filesystem_1.isPathFolder)(srcPath)) {
|
|
18
14
|
return destPath;
|
|
@@ -20,27 +16,27 @@ function getCorrectedDestPath(srcPath, destPath) {
|
|
|
20
16
|
// Makes sure that nested folders are moved independently
|
|
21
17
|
return `${destPath}/${srcPath.split('/').pop()}`;
|
|
22
18
|
}
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const command = 'mv <srcPath> <destPath>';
|
|
20
|
+
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.mv.describe`), false);
|
|
25
21
|
async function handler(args) {
|
|
26
22
|
const { srcPath, destPath, derivedAccountId } = args;
|
|
27
23
|
(0, usageTracking_1.trackCommandUsage)('mv', undefined, derivedAccountId);
|
|
28
24
|
try {
|
|
29
25
|
await (0, fileMapper_1.moveFile)(derivedAccountId, srcPath, getCorrectedDestPath(srcPath, destPath));
|
|
30
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
26
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.mv.move`, {
|
|
31
27
|
accountId: derivedAccountId,
|
|
32
28
|
destPath,
|
|
33
29
|
srcPath,
|
|
34
30
|
}));
|
|
35
31
|
}
|
|
36
32
|
catch (error) {
|
|
37
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
33
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.mv.errors.moveFailed`, {
|
|
38
34
|
accountId: derivedAccountId,
|
|
39
35
|
destPath,
|
|
40
36
|
srcPath,
|
|
41
37
|
}));
|
|
42
38
|
if ((0, index_1.isSpecifiedError)(error, { statusCode: 409 })) {
|
|
43
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
39
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.mv.errors.sourcePathExists`, {
|
|
44
40
|
destPath,
|
|
45
41
|
srcPath,
|
|
46
42
|
}));
|
|
@@ -52,11 +48,7 @@ async function handler(args) {
|
|
|
52
48
|
}
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
|
-
function
|
|
56
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
57
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
58
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
59
|
-
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
51
|
+
function cmsMvBuilder(yargs) {
|
|
60
52
|
yargs.positional('srcPath', {
|
|
61
53
|
describe: 'Remote hubspot path',
|
|
62
54
|
type: 'string',
|
|
@@ -67,3 +59,16 @@ function builder(yargs) {
|
|
|
67
59
|
});
|
|
68
60
|
return yargs;
|
|
69
61
|
}
|
|
62
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(cmsMvBuilder, command, describe, {
|
|
63
|
+
useGlobalOptions: true,
|
|
64
|
+
useConfigOptions: true,
|
|
65
|
+
useAccountOptions: true,
|
|
66
|
+
useEnvironmentOptions: true,
|
|
67
|
+
});
|
|
68
|
+
const cmsMvCommand = {
|
|
69
|
+
command,
|
|
70
|
+
describe,
|
|
71
|
+
handler,
|
|
72
|
+
builder,
|
|
73
|
+
};
|
|
74
|
+
exports.default = cmsMvCommand;
|
package/commands/open.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommonArgs, ConfigArgs, EnvironmentArgs, AccountArgs } from '../types/Yargs';
|
|
3
|
-
export declare const command = "open [shortcut]";
|
|
4
|
-
export declare const describe: string;
|
|
1
|
+
import { CommonArgs, ConfigArgs, EnvironmentArgs, AccountArgs, YargsCommandModule } from '../types/Yargs';
|
|
5
2
|
type OpenArgs = CommonArgs & ConfigArgs & EnvironmentArgs & AccountArgs & {
|
|
6
3
|
shortcut?: string;
|
|
7
4
|
list?: boolean;
|
|
8
5
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {};
|
|
6
|
+
declare const openCommand: YargsCommandModule<unknown, OpenArgs>;
|
|
7
|
+
export default openCommand;
|