@hubspot/cli 8.0.10-experimental.6 → 8.0.10-experimental.7
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 +77 -0
- package/api/migrate.js +55 -0
- package/bin/cli.d.ts +2 -0
- package/bin/cli.js +136 -0
- package/bin/hs.d.ts +2 -0
- package/bin/hscms.d.ts +2 -0
- package/bin/silenceErrors.d.ts +2 -0
- package/bin/silenceErrors.js +11 -0
- package/commands/account/auth.d.ts +8 -0
- package/commands/account/auth.js +102 -0
- package/commands/account/clean.d.ts +6 -0
- package/commands/account/clean.js +125 -0
- package/commands/account/createOverride.d.ts +6 -0
- package/commands/account/createOverride.js +93 -0
- package/commands/account/info.d.ts +4 -0
- package/commands/account/info.js +75 -0
- package/commands/account/list.d.ts +4 -0
- package/commands/account/list.js +107 -0
- package/commands/account/remove.d.ts +6 -0
- package/commands/account/remove.js +87 -0
- package/commands/account/removeOverride.d.ts +6 -0
- package/commands/account/removeOverride.js +71 -0
- package/commands/account/rename.d.ts +7 -0
- package/commands/account/rename.js +51 -0
- package/commands/account/use.d.ts +6 -0
- package/commands/account/use.js +93 -0
- package/commands/account.d.ts +3 -0
- package/commands/account.js +35 -0
- package/commands/app/migrate.d.ts +6 -0
- package/commands/app/migrate.js +96 -0
- package/commands/app/secret/add.d.ts +7 -0
- package/commands/app/secret/add.js +63 -0
- package/commands/app/secret/delete.d.ts +8 -0
- package/commands/app/secret/delete.js +86 -0
- package/commands/app/secret/list.d.ts +6 -0
- package/commands/app/secret/list.js +63 -0
- package/commands/app/secret/update.d.ts +7 -0
- package/commands/app/secret/update.js +76 -0
- package/commands/app/secret.d.ts +3 -0
- package/commands/app/secret.js +26 -0
- package/commands/app.d.ts +3 -0
- package/commands/app.js +18 -0
- package/commands/auth.d.ts +9 -0
- package/commands/auth.js +190 -0
- package/commands/cms/app/create.d.ts +9 -0
- package/commands/cms/app/create.js +81 -0
- package/commands/cms/app.d.ts +3 -0
- package/commands/cms/app.js +17 -0
- package/commands/cms/convertFields.d.ts +7 -0
- package/commands/cms/convertFields.js +97 -0
- package/commands/cms/delete.d.ts +6 -0
- package/commands/cms/delete.js +43 -0
- package/commands/cms/fetch.d.ts +12 -0
- package/commands/cms/fetch.js +80 -0
- package/commands/cms/function/create.d.ts +12 -0
- package/commands/cms/function/create.js +84 -0
- package/commands/cms/function/deploy.d.ts +6 -0
- package/commands/cms/function/deploy.js +89 -0
- package/commands/cms/function/list.d.ts +6 -0
- package/commands/cms/function/list.js +59 -0
- package/commands/cms/function/logs.d.ts +10 -0
- package/commands/cms/function/logs.js +136 -0
- package/commands/cms/function/server.d.ts +10 -0
- package/commands/cms/function/server.js +69 -0
- package/commands/cms/function.d.ts +3 -0
- package/commands/cms/function.js +27 -0
- package/commands/cms/getReactModule.d.ts +7 -0
- package/commands/cms/getReactModule.js +77 -0
- package/commands/cms/lighthouseScore.d.ts +8 -0
- package/commands/cms/lighthouseScore.js +281 -0
- package/commands/cms/lint.d.ts +6 -0
- package/commands/cms/lint.js +83 -0
- package/commands/cms/list.d.ts +6 -0
- package/commands/cms/list.js +96 -0
- package/commands/cms/module/create.d.ts +11 -0
- package/commands/cms/module/create.js +84 -0
- package/commands/cms/module/marketplace-validate.d.ts +6 -0
- package/commands/cms/module/marketplace-validate.js +62 -0
- package/commands/cms/module.d.ts +3 -0
- package/commands/cms/module.js +21 -0
- package/commands/cms/mv.d.ts +7 -0
- package/commands/cms/mv.js +60 -0
- package/commands/cms/template/create.d.ts +9 -0
- package/commands/cms/template/create.js +72 -0
- package/commands/cms/template.d.ts +3 -0
- package/commands/cms/template.js +17 -0
- package/commands/cms/theme/create.d.ts +6 -0
- package/commands/cms/theme/create.js +58 -0
- package/commands/cms/theme/generate-selectors.d.ts +6 -0
- package/commands/cms/theme/generate-selectors.js +171 -0
- package/commands/cms/theme/marketplace-validate.d.ts +6 -0
- package/commands/cms/theme/marketplace-validate.js +64 -0
- package/commands/cms/theme/preview.d.ts +11 -0
- package/commands/cms/theme/preview.js +126 -0
- package/commands/cms/theme.d.ts +3 -0
- package/commands/cms/theme.js +25 -0
- package/commands/cms/upload.d.ts +12 -0
- package/commands/cms/upload.js +212 -0
- package/commands/cms/watch.d.ts +13 -0
- package/commands/cms/watch.js +132 -0
- package/commands/cms/webpack/create.d.ts +6 -0
- package/commands/cms/webpack/create.js +58 -0
- package/commands/cms/webpack.d.ts +3 -0
- package/commands/cms/webpack.js +17 -0
- package/commands/cms.d.ts +3 -0
- package/commands/cms.js +49 -0
- package/commands/completion.d.ts +3 -0
- package/commands/completion.js +27 -0
- package/commands/config/migrate.d.ts +6 -0
- package/commands/config/migrate.js +70 -0
- package/commands/config/set.d.ts +11 -0
- package/commands/config/set.js +141 -0
- package/commands/config.d.ts +3 -0
- package/commands/config.js +18 -0
- package/commands/customObject/create.d.ts +7 -0
- package/commands/customObject/create.js +64 -0
- package/commands/customObject/createSchema.d.ts +6 -0
- package/commands/customObject/createSchema.js +55 -0
- package/commands/customObject/deleteSchema.d.ts +7 -0
- package/commands/customObject/deleteSchema.js +69 -0
- package/commands/customObject/fetchAllSchemas.d.ts +6 -0
- package/commands/customObject/fetchAllSchemas.js +57 -0
- package/commands/customObject/fetchSchema.d.ts +7 -0
- package/commands/customObject/fetchSchema.js +67 -0
- package/commands/customObject/listSchemas.d.ts +4 -0
- package/commands/customObject/listSchemas.js +35 -0
- package/commands/customObject/updateSchema.d.ts +7 -0
- package/commands/customObject/updateSchema.js +70 -0
- package/commands/customObject.d.ts +3 -0
- package/commands/customObject.js +38 -0
- package/commands/doctor.d.ts +6 -0
- package/commands/doctor.js +70 -0
- package/commands/feedback.d.ts +4 -0
- package/commands/feedback.js +32 -0
- package/commands/filemanager/fetch.d.ts +8 -0
- package/commands/filemanager/fetch.js +58 -0
- package/commands/filemanager/upload.d.ts +7 -0
- package/commands/filemanager/upload.js +97 -0
- package/commands/filemanager.d.ts +3 -0
- package/commands/filemanager.js +18 -0
- package/commands/getStarted.d.ts +8 -0
- package/commands/getStarted.js +322 -0
- package/commands/hubdb/clear.d.ts +7 -0
- package/commands/hubdb/clear.js +58 -0
- package/commands/hubdb/create.d.ts +6 -0
- package/commands/hubdb/create.js +74 -0
- package/commands/hubdb/delete.d.ts +6 -0
- package/commands/hubdb/delete.js +68 -0
- package/commands/hubdb/fetch.d.ts +7 -0
- package/commands/hubdb/fetch.js +55 -0
- package/commands/hubdb/list.d.ts +4 -0
- package/commands/hubdb/list.js +79 -0
- package/commands/hubdb.d.ts +5 -0
- package/commands/hubdb.js +27 -0
- package/commands/init.d.ts +8 -0
- package/commands/init.js +200 -0
- package/commands/mcp/setup.d.ts +6 -0
- package/commands/mcp/setup.js +36 -0
- package/commands/mcp/start.d.ts +6 -0
- package/commands/mcp/start.js +72 -0
- package/commands/mcp.d.ts +3 -0
- package/commands/mcp.js +20 -0
- package/commands/open.d.ts +7 -0
- package/commands/open.js +70 -0
- package/commands/project/add.d.ts +10 -0
- package/commands/project/add.js +79 -0
- package/commands/project/cloneApp.d.ts +1 -0
- package/commands/project/cloneApp.js +1 -0
- package/commands/project/create.d.ts +4 -0
- package/commands/project/create.js +175 -0
- package/commands/project/deploy.d.ts +11 -0
- package/commands/project/deploy.js +196 -0
- package/commands/project/dev/deprecatedFlow.d.ts +11 -0
- package/commands/project/dev/deprecatedFlow.js +135 -0
- package/commands/project/dev/index.d.ts +5 -0
- package/commands/project/dev/index.js +174 -0
- package/commands/project/dev/unifiedFlow.d.ts +14 -0
- package/commands/project/dev/unifiedFlow.js +162 -0
- package/commands/project/download.d.ts +8 -0
- package/commands/project/download.js +95 -0
- package/commands/project/installDeps.d.ts +6 -0
- package/commands/project/installDeps.js +80 -0
- package/commands/project/lint.d.ts +6 -0
- package/commands/project/lint.js +178 -0
- package/commands/project/list.d.ts +4 -0
- package/commands/project/list.js +62 -0
- package/commands/project/listBuilds.d.ts +7 -0
- package/commands/project/listBuilds.js +120 -0
- package/commands/project/logs.d.ts +10 -0
- package/commands/project/logs.js +119 -0
- package/commands/project/migrate.d.ts +7 -0
- package/commands/project/migrate.js +91 -0
- package/commands/project/open.d.ts +6 -0
- package/commands/project/open.js +61 -0
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +203 -0
- package/commands/project/profile/delete.d.ts +6 -0
- package/commands/project/profile/delete.js +129 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +19 -0
- package/commands/project/updateDeps.d.ts +6 -0
- package/commands/project/updateDeps.js +80 -0
- package/commands/project/upload.d.ts +10 -0
- package/commands/project/upload.js +145 -0
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +156 -0
- package/commands/project/watch.d.ts +6 -0
- package/commands/project/watch.js +152 -0
- package/commands/project.d.ts +3 -0
- package/commands/project.js +72 -0
- package/commands/sandbox/create.d.ts +8 -0
- package/commands/sandbox/create.js +156 -0
- package/commands/sandbox/delete.d.ts +7 -0
- package/commands/sandbox/delete.js +189 -0
- package/commands/sandbox.d.ts +3 -0
- package/commands/sandbox.js +19 -0
- package/commands/secret/addSecret.d.ts +6 -0
- package/commands/secret/addSecret.js +58 -0
- package/commands/secret/deleteSecret.d.ts +7 -0
- package/commands/secret/deleteSecret.js +71 -0
- package/commands/secret/listSecret.d.ts +4 -0
- package/commands/secret/listSecret.js +43 -0
- package/commands/secret/updateSecret.d.ts +6 -0
- package/commands/secret/updateSecret.js +57 -0
- package/commands/secret.d.ts +3 -0
- package/commands/secret.js +25 -0
- package/commands/testAccount/create.d.ts +15 -0
- package/commands/testAccount/create.js +232 -0
- package/commands/testAccount/createConfig.d.ts +8 -0
- package/commands/testAccount/createConfig.js +92 -0
- package/commands/testAccount/delete.d.ts +7 -0
- package/commands/testAccount/delete.js +188 -0
- package/commands/testAccount/importData.d.ts +9 -0
- package/commands/testAccount/importData.js +61 -0
- package/commands/testAccount.d.ts +3 -0
- package/commands/testAccount.js +25 -0
- package/commands/upgrade.d.ts +8 -0
- package/commands/upgrade.js +119 -0
- package/lang/en.d.ts +3990 -0
- package/lang/en.js +4013 -0
- package/lib/CLIWebSocketServer.d.ts +28 -0
- package/lib/CLIWebSocketServer.js +91 -0
- package/lib/accountAuth.d.ts +10 -0
- package/lib/accountAuth.js +109 -0
- package/lib/accountTypes.d.ts +9 -0
- package/lib/accountTypes.js +41 -0
- package/lib/app/migrate.d.ts +44 -0
- package/lib/app/migrate.js +389 -0
- package/lib/app/urls.d.ts +17 -0
- package/lib/app/urls.js +16 -0
- package/lib/buildAccount.d.ts +15 -0
- package/lib/buildAccount.js +184 -0
- package/lib/cliUpgradeUtils.d.ts +22 -0
- package/lib/cliUpgradeUtils.js +62 -0
- package/lib/cmsAssets/api-sample.d.ts +3 -0
- package/lib/cmsAssets/api-sample.js +60 -0
- package/lib/cmsAssets/app.d.ts +3 -0
- package/lib/cmsAssets/app.js +12 -0
- package/lib/cmsAssets/function.d.ts +3 -0
- package/lib/cmsAssets/function.js +11 -0
- package/lib/cmsAssets/index.d.ts +5 -0
- package/lib/cmsAssets/index.js +21 -0
- package/lib/cmsAssets/module.d.ts +3 -0
- package/lib/cmsAssets/module.js +20 -0
- package/lib/cmsAssets/react-app.d.ts +3 -0
- package/lib/cmsAssets/react-app.js +12 -0
- package/lib/cmsAssets/template.d.ts +3 -0
- package/lib/cmsAssets/template.js +20 -0
- package/lib/cmsAssets/vue-app.d.ts +3 -0
- package/lib/cmsAssets/vue-app.js +12 -0
- package/lib/cmsAssets/webpack-serverless.d.ts +3 -0
- package/lib/cmsAssets/webpack-serverless.js +12 -0
- package/lib/cmsAssets/website-theme.d.ts +3 -0
- package/lib/cmsAssets/website-theme.js +19 -0
- package/lib/commandSuggestion.d.ts +3 -0
- package/lib/commandSuggestion.js +39 -0
- package/lib/commonOpts.d.ts +25 -0
- package/lib/commonOpts.js +181 -0
- package/lib/configMigrate.d.ts +2 -0
- package/lib/configMigrate.js +182 -0
- package/lib/configOptions.d.ts +21 -0
- package/lib/configOptions.js +111 -0
- package/lib/constants.d.ts +145 -0
- package/lib/constants.js +146 -0
- package/lib/customObject.d.ts +3 -0
- package/lib/customObject.js +11 -0
- package/lib/dependencyManagement.d.ts +21 -0
- package/lib/dependencyManagement.js +243 -0
- package/lib/developerTestAccounts.d.ts +6 -0
- package/lib/developerTestAccounts.js +66 -0
- package/lib/doctor/Diagnosis.d.ts +27 -0
- package/lib/doctor/Diagnosis.js +113 -0
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +69 -0
- package/lib/doctor/DiagnosticInfoBuilder.js +169 -0
- package/lib/doctor/Doctor.d.ts +35 -0
- package/lib/doctor/Doctor.js +566 -0
- package/lib/enums/exitCodes.d.ts +5 -0
- package/lib/enums/exitCodes.js +10 -0
- package/lib/errorHandlers/index.d.ts +19 -0
- package/lib/errorHandlers/index.js +99 -0
- package/lib/errorHandlers/suppressError.d.ts +2 -0
- package/lib/errorHandlers/suppressError.js +53 -0
- package/lib/errors/ProjectErrors.d.ts +15 -0
- package/lib/errors/ProjectErrors.js +30 -0
- package/lib/errors/ProjectValidationError.d.ts +4 -0
- package/lib/errors/ProjectValidationError.js +9 -0
- package/lib/errors/PromptExitError.d.ts +4 -0
- package/lib/errors/PromptExitError.js +8 -0
- package/lib/filesystem.d.ts +2 -0
- package/lib/filesystem.js +19 -0
- package/lib/generateSelectors.d.ts +20 -0
- package/lib/generateSelectors.js +110 -0
- package/lib/getStarted/getStartedV2.d.ts +7 -0
- package/lib/getStarted/getStartedV2.js +18 -0
- package/lib/getStartedV2Actions.d.ts +50 -0
- package/lib/getStartedV2Actions.js +199 -0
- package/lib/hasFeature.d.ts +4 -0
- package/lib/hasFeature.js +18 -0
- package/lib/http.d.ts +1 -0
- package/lib/http.js +28 -0
- package/lib/importData.d.ts +3 -0
- package/lib/importData.js +51 -0
- package/lib/interpolation.d.ts +7 -0
- package/lib/interpolation.js +84 -0
- package/lib/jsonLoader.d.ts +14 -0
- package/lib/jsonLoader.js +60 -0
- package/lib/links.d.ts +11 -0
- package/lib/links.js +107 -0
- package/lib/marketplaceValidate.d.ts +16 -0
- package/lib/marketplaceValidate.js +88 -0
- package/lib/mcp/setup.d.ts +17 -0
- package/lib/mcp/setup.js +345 -0
- package/lib/middleware/autoUpdateMiddleware.d.ts +4 -0
- package/lib/middleware/autoUpdateMiddleware.js +105 -0
- package/lib/middleware/commandTargetingUtils.d.ts +8 -0
- package/lib/middleware/commandTargetingUtils.js +76 -0
- package/lib/middleware/configMiddleware.d.ts +15 -0
- package/lib/middleware/configMiddleware.js +93 -0
- package/lib/middleware/fireAlarmMiddleware.d.ts +4 -0
- package/lib/middleware/fireAlarmMiddleware.js +118 -0
- package/lib/middleware/gitMiddleware.d.ts +2 -0
- package/lib/middleware/gitMiddleware.js +21 -0
- package/lib/middleware/requestMiddleware.d.ts +1 -0
- package/lib/middleware/requestMiddleware.js +5 -0
- package/lib/middleware/spinniesMiddleware.d.ts +1 -0
- package/lib/middleware/spinniesMiddleware.js +4 -0
- package/lib/middleware/usageTrackingMiddleware.d.ts +13 -0
- package/lib/middleware/usageTrackingMiddleware.js +16 -0
- package/lib/middleware/yargsChecksMiddleware.d.ts +4 -0
- package/lib/middleware/yargsChecksMiddleware.js +18 -0
- package/lib/npm/npmCli.d.ts +17 -0
- package/lib/npm/npmCli.js +59 -0
- package/lib/npm/packageJson.d.ts +24 -0
- package/lib/npm/packageJson.js +102 -0
- package/lib/npm/workspaces.d.ts +12 -0
- package/lib/npm/workspaces.js +48 -0
- package/lib/oauth.d.ts +2 -0
- package/lib/oauth.js +93 -0
- package/lib/parsing.d.ts +1 -0
- package/lib/parsing.js +8 -0
- package/lib/polling.d.ts +21 -0
- package/lib/polling.js +48 -0
- package/lib/process.d.ts +13 -0
- package/lib/process.js +56 -0
- package/lib/projects/ProjectLogsManager.d.ts +29 -0
- package/lib/projects/ProjectLogsManager.js +155 -0
- package/lib/projects/add/legacyAddComponent.d.ts +5 -0
- package/lib/projects/add/legacyAddComponent.js +46 -0
- package/lib/projects/add/v2AddComponent.d.ts +9 -0
- package/lib/projects/add/v2AddComponent.js +111 -0
- package/lib/projects/components.d.ts +16 -0
- package/lib/projects/components.js +252 -0
- package/lib/projects/config.d.ts +9 -0
- package/lib/projects/config.js +73 -0
- package/lib/projects/create/index.d.ts +24 -0
- package/lib/projects/create/index.js +33 -0
- package/lib/projects/create/legacy.d.ts +6 -0
- package/lib/projects/create/legacy.js +48 -0
- package/lib/projects/create/v2.d.ts +26 -0
- package/lib/projects/create/v2.js +158 -0
- package/lib/projects/deploy.d.ts +13 -0
- package/lib/projects/deploy.js +76 -0
- package/lib/projects/ensureProjectExists.d.ts +11 -0
- package/lib/projects/ensureProjectExists.js +89 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +41 -0
- package/lib/projects/localDev/AppDevModeInterface.js +337 -0
- package/lib/projects/localDev/DevServerManager.d.ts +21 -0
- package/lib/projects/localDev/DevServerManager.js +64 -0
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +40 -0
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +128 -0
- package/lib/projects/localDev/DevSessionManager.d.ts +18 -0
- package/lib/projects/localDev/DevSessionManager.js +95 -0
- package/lib/projects/localDev/LocalDevLogger.d.ts +34 -0
- package/lib/projects/localDev/LocalDevLogger.js +178 -0
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.d.ts +59 -0
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +387 -0
- package/lib/projects/localDev/LocalDevProcess.d.ts +39 -0
- package/lib/projects/localDev/LocalDevProcess.js +277 -0
- package/lib/projects/localDev/LocalDevState.d.ts +63 -0
- package/lib/projects/localDev/LocalDevState.js +139 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +48 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +21 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +169 -0
- package/lib/projects/localDev/UIExtensionsDevModeInterface.d.ts +13 -0
- package/lib/projects/localDev/UIExtensionsDevModeInterface.js +37 -0
- package/lib/projects/localDev/helpers/account.d.ts +14 -0
- package/lib/projects/localDev/helpers/account.js +222 -0
- package/lib/projects/localDev/helpers/devSessionsApi.d.ts +9 -0
- package/lib/projects/localDev/helpers/devSessionsApi.js +19 -0
- package/lib/projects/localDev/helpers/process.d.ts +1 -0
- package/lib/projects/localDev/helpers/process.js +17 -0
- package/lib/projects/localDev/helpers/project.d.ts +16 -0
- package/lib/projects/localDev/helpers/project.js +216 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +8 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +19 -0
- package/lib/projects/platformVersion.d.ts +9 -0
- package/lib/projects/platformVersion.js +39 -0
- package/lib/projects/pollProjectBuildAndDeploy.d.ts +10 -0
- package/lib/projects/pollProjectBuildAndDeploy.js +344 -0
- package/lib/projects/projectProfiles.d.ts +17 -0
- package/lib/projects/projectProfiles.js +140 -0
- package/lib/projects/structure.d.ts +18 -0
- package/lib/projects/structure.js +130 -0
- package/lib/projects/ui.d.ts +1 -0
- package/lib/projects/ui.js +12 -0
- package/lib/projects/uieLinting.d.ts +33 -0
- package/lib/projects/uieLinting.js +220 -0
- package/lib/projects/upload.d.ts +33 -0
- package/lib/projects/upload.js +147 -0
- package/lib/projects/urls.d.ts +10 -0
- package/lib/projects/urls.js +42 -0
- package/lib/projects/watch.d.ts +5 -0
- package/lib/projects/watch.js +168 -0
- package/lib/prompts/accountNamePrompt.d.ts +11 -0
- package/lib/prompts/accountNamePrompt.js +64 -0
- package/lib/prompts/accountsPrompt.d.ts +2 -0
- package/lib/prompts/accountsPrompt.js +33 -0
- package/lib/prompts/cmsFieldPrompt.d.ts +1 -0
- package/lib/prompts/cmsFieldPrompt.js +40 -0
- package/lib/prompts/confirmImportDataPrompt.d.ts +1 -0
- package/lib/prompts/confirmImportDataPrompt.js +12 -0
- package/lib/prompts/createApiSamplePrompt.d.ts +10 -0
- package/lib/prompts/createApiSamplePrompt.js +58 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +25 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +162 -0
- package/lib/prompts/createFunctionPrompt.d.ts +9 -0
- package/lib/prompts/createFunctionPrompt.js +94 -0
- package/lib/prompts/createModulePrompt.d.ts +10 -0
- package/lib/prompts/createModulePrompt.js +116 -0
- package/lib/prompts/createTemplatePrompt.d.ts +6 -0
- package/lib/prompts/createTemplatePrompt.js +29 -0
- package/lib/prompts/downloadProjectPrompt.d.ts +10 -0
- package/lib/prompts/downloadProjectPrompt.js +53 -0
- package/lib/prompts/importDataFilePathPrompt.d.ts +1 -0
- package/lib/prompts/importDataFilePathPrompt.js +26 -0
- package/lib/prompts/importDataTestAccountSelectPrompt.d.ts +3 -0
- package/lib/prompts/importDataTestAccountSelectPrompt.js +28 -0
- package/lib/prompts/installAppPrompt.d.ts +2 -0
- package/lib/prompts/installAppPrompt.js +39 -0
- package/lib/prompts/personalAccessKeyPrompt.d.ts +29 -0
- package/lib/prompts/personalAccessKeyPrompt.js +135 -0
- package/lib/prompts/previewPrompt.d.ts +15 -0
- package/lib/prompts/previewPrompt.js +48 -0
- package/lib/prompts/projectAddPrompt.d.ts +15 -0
- package/lib/prompts/projectAddPrompt.js +82 -0
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +12 -0
- package/lib/prompts/projectDevTargetAccountPrompt.js +166 -0
- package/lib/prompts/projectNameAndDestPrompt.d.ts +3 -0
- package/lib/prompts/projectNameAndDestPrompt.js +53 -0
- package/lib/prompts/projectNamePrompt.d.ts +6 -0
- package/lib/prompts/projectNamePrompt.js +27 -0
- package/lib/prompts/projectsLogsPrompt.d.ts +12 -0
- package/lib/prompts/projectsLogsPrompt.js +20 -0
- package/lib/prompts/promptUtils.d.ts +32 -0
- package/lib/prompts/promptUtils.js +222 -0
- package/lib/prompts/sandboxesPrompt.d.ts +10 -0
- package/lib/prompts/sandboxesPrompt.js +63 -0
- package/lib/prompts/secretPrompt.d.ts +13 -0
- package/lib/prompts/secretPrompt.js +31 -0
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +37 -0
- package/lib/prompts/selectHubDBTablePrompt.d.ts +12 -0
- package/lib/prompts/selectHubDBTablePrompt.js +66 -0
- package/lib/prompts/selectProjectTemplatePrompt.d.ts +27 -0
- package/lib/prompts/selectProjectTemplatePrompt.js +75 -0
- package/lib/prompts/selectPublicAppForMigrationPrompt.d.ts +9 -0
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +68 -0
- package/lib/prompts/setAsDefaultAccountPrompt.d.ts +1 -0
- package/lib/prompts/setAsDefaultAccountPrompt.js +26 -0
- package/lib/prompts/uploadPrompt.d.ts +9 -0
- package/lib/prompts/uploadPrompt.js +32 -0
- package/lib/sandboxes.d.ts +14 -0
- package/lib/sandboxes.js +105 -0
- package/lib/schema.d.ts +3 -0
- package/lib/schema.js +27 -0
- package/lib/serverlessLogs.d.ts +4 -0
- package/lib/serverlessLogs.js +154 -0
- package/lib/testUtils.d.ts +14 -0
- package/lib/testUtils.js +18 -0
- package/lib/theme/cmsDevServerProcess.d.ts +12 -0
- package/lib/theme/cmsDevServerProcess.js +148 -0
- package/lib/theme/cmsDevServerRunner.d.ts +14 -0
- package/lib/theme/cmsDevServerRunner.js +90 -0
- package/lib/theme/migrate.d.ts +13 -0
- package/lib/theme/migrate.js +85 -0
- package/lib/ui/SpinniesManager.d.ts +39 -0
- package/lib/ui/SpinniesManager.js +259 -0
- package/lib/ui/git.d.ts +1 -0
- package/lib/ui/git.js +25 -0
- package/lib/ui/index.d.ts +31 -0
- package/lib/ui/index.js +150 -0
- package/lib/ui/logger.d.ts +11 -0
- package/lib/ui/logger.js +13 -0
- package/lib/ui/removeAnsiCodes.d.ts +1 -0
- package/lib/ui/removeAnsiCodes.js +4 -0
- package/lib/ui/serverlessFunctionLogs.d.ts +9 -0
- package/lib/ui/serverlessFunctionLogs.js +88 -0
- package/lib/ui/spinniesUtils.d.ts +32 -0
- package/lib/ui/spinniesUtils.js +151 -0
- package/lib/ui/supportHyperlinks.d.ts +7 -0
- package/lib/ui/supportHyperlinks.js +59 -0
- package/lib/ui/supportsColor.d.ts +17 -0
- package/lib/ui/supportsColor.js +97 -0
- package/lib/ui/uiMessages.d.ts +73 -0
- package/lib/ui/uiMessages.js +76 -0
- package/lib/upload.d.ts +1 -0
- package/lib/upload.js +49 -0
- package/lib/usageTracking.d.ts +32 -0
- package/lib/usageTracking.js +174 -0
- package/lib/utils/hasFlag.d.ts +1 -0
- package/lib/utils/hasFlag.js +9 -0
- package/lib/validation.d.ts +13 -0
- package/lib/validation.js +142 -0
- package/lib/yargsUtils.d.ts +16 -0
- package/lib/yargsUtils.js +49 -0
- package/mcp-server/server.d.ts +1 -0
- package/mcp-server/server.js +13 -0
- package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +24 -0
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +105 -0
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +20 -0
- package/mcp-server/tools/cms/HsCreateModuleTool.js +127 -0
- package/mcp-server/tools/cms/HsCreateTemplateTool.d.ts +25 -0
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +84 -0
- package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +18 -0
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +75 -0
- package/mcp-server/tools/cms/HsListFunctionsTool.d.ts +15 -0
- package/mcp-server/tools/cms/HsListFunctionsTool.js +64 -0
- package/mcp-server/tools/cms/HsListTool.d.ts +15 -0
- package/mcp-server/tools/cms/HsListTool.js +64 -0
- package/mcp-server/tools/index.d.ts +3 -0
- package/mcp-server/tools/index.js +48 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +36 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +82 -0
- package/mcp-server/tools/project/CreateProjectTool.d.ts +40 -0
- package/mcp-server/tools/project/CreateProjectTool.js +98 -0
- package/mcp-server/tools/project/CreateTestAccountTool.d.ts +51 -0
- package/mcp-server/tools/project/CreateTestAccountTool.js +170 -0
- package/mcp-server/tools/project/DeployProjectTool.d.ts +15 -0
- package/mcp-server/tools/project/DeployProjectTool.js +58 -0
- package/mcp-server/tools/project/DocFetchTool.d.ts +14 -0
- package/mcp-server/tools/project/DocFetchTool.js +57 -0
- package/mcp-server/tools/project/DocsSearchTool.d.ts +23 -0
- package/mcp-server/tools/project/DocsSearchTool.js +69 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +16 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +73 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +13 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.js +56 -0
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +21 -0
- package/mcp-server/tools/project/GetBuildLogsTool.js +124 -0
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +16 -0
- package/mcp-server/tools/project/GetBuildStatusTool.js +165 -0
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +15 -0
- package/mcp-server/tools/project/GetConfigValuesTool.js +65 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +19 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +50 -0
- package/mcp-server/tools/project/UploadProjectTools.d.ts +16 -0
- package/mcp-server/tools/project/UploadProjectTools.js +83 -0
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +14 -0
- package/mcp-server/tools/project/ValidateProjectTool.js +42 -0
- package/mcp-server/tools/project/constants.d.ts +18 -0
- package/mcp-server/tools/project/constants.js +29 -0
- package/mcp-server/types.d.ts +14 -0
- package/mcp-server/types.js +13 -0
- package/mcp-server/utils/command.d.ts +8 -0
- package/mcp-server/utils/command.js +33 -0
- package/mcp-server/utils/config.d.ts +1 -0
- package/mcp-server/utils/config.js +10 -0
- package/mcp-server/utils/content.d.ts +3 -0
- package/mcp-server/utils/content.js +24 -0
- package/mcp-server/utils/feedbackTracking.d.ts +1 -0
- package/mcp-server/utils/feedbackTracking.js +26 -0
- package/mcp-server/utils/toolUsageTracking.d.ts +3 -0
- package/mcp-server/utils/toolUsageTracking.js +24 -0
- package/package.json +2 -1
- package/types/Cms.d.ts +46 -0
- package/types/Cms.js +27 -0
- package/types/LocalDev.d.ts +47 -0
- package/types/LocalDev.js +1 -0
- package/types/PackageJson.d.ts +10 -0
- package/types/PackageJson.js +1 -0
- package/types/ProjectComponents.d.ts +23 -0
- package/types/ProjectComponents.js +2 -0
- package/types/Projects.d.ts +130 -0
- package/types/Projects.js +6 -0
- package/types/Prompts.d.ts +28 -0
- package/types/Prompts.js +1 -0
- package/types/Sandboxes.d.ts +5 -0
- package/types/Sandboxes.js +1 -0
- package/types/Yargs.d.ts +46 -0
- package/types/Yargs.js +1 -0
- package/ui/components/ActionSection.d.ts +12 -0
- package/ui/components/ActionSection.js +25 -0
- package/ui/components/BoxWithTitle.d.ts +11 -0
- package/ui/components/BoxWithTitle.js +9 -0
- package/ui/components/FullScreen.d.ts +6 -0
- package/ui/components/FullScreen.js +13 -0
- package/ui/components/HorizontalSelectPrompt.d.ts +8 -0
- package/ui/components/HorizontalSelectPrompt.js +30 -0
- package/ui/components/InputField.d.ts +10 -0
- package/ui/components/InputField.js +10 -0
- package/ui/components/SelectInput.d.ts +11 -0
- package/ui/components/SelectInput.js +59 -0
- package/ui/components/StatusIcon.d.ts +9 -0
- package/ui/components/StatusIcon.js +17 -0
- package/ui/components/StatusMessageBoxes.d.ts +13 -0
- package/ui/components/StatusMessageBoxes.js +31 -0
- package/ui/components/Table.d.ts +89 -0
- package/ui/components/Table.js +246 -0
- package/ui/components/getStarted/GetStartedFlow.d.ts +8 -0
- package/ui/components/getStarted/GetStartedFlow.js +213 -0
- package/ui/components/getStarted/reducer.d.ts +79 -0
- package/ui/components/getStarted/reducer.js +108 -0
- package/ui/components/getStarted/screens/InstallationScreen.d.ts +7 -0
- package/ui/components/getStarted/screens/InstallationScreen.js +16 -0
- package/ui/components/getStarted/screens/ProjectSetupScreen.d.ts +16 -0
- package/ui/components/getStarted/screens/ProjectSetupScreen.js +40 -0
- package/ui/components/getStarted/screens/UploadScreen.d.ts +7 -0
- package/ui/components/getStarted/screens/UploadScreen.js +43 -0
- package/ui/components/getStarted/selectors.d.ts +2 -0
- package/ui/components/getStarted/selectors.js +1 -0
- package/ui/constants.d.ts +6 -0
- package/ui/constants.js +6 -0
- package/ui/lib/constants.d.ts +17 -0
- package/ui/lib/constants.js +17 -0
- package/ui/lib/table.d.ts +2 -0
- package/ui/lib/table.js +11 -0
- package/ui/lib/useTerminalSize.d.ts +13 -0
- package/ui/lib/useTerminalSize.js +31 -0
- package/ui/playground/Playground.d.ts +5 -0
- package/ui/playground/Playground.js +25 -0
- package/ui/playground/fixtures.d.ts +9 -0
- package/ui/playground/fixtures.js +126 -0
- package/ui/render.d.ts +23 -0
- package/ui/render.js +75 -0
- package/ui/styles.d.ts +21 -0
- package/ui/styles.js +21 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { getConfigAccountById, getConfigDefaultAccount, getConfigFilePath, } from '@hubspot/local-dev-lib/config';
|
|
2
|
+
import { getDefaultAccountOverrideFilePath } from '@hubspot/local-dev-lib/config/defaultAccountOverride';
|
|
3
|
+
import { getAccessToken } from '@hubspot/local-dev-lib/personalAccessKey';
|
|
4
|
+
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
5
|
+
import { indent } from '../../lib/ui/index.js';
|
|
6
|
+
import { commands } from '../../lang/en.js';
|
|
7
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
8
|
+
import { renderList } from '../../ui/render.js';
|
|
9
|
+
const describe = commands.account.subcommands.info.describe;
|
|
10
|
+
const command = 'info [account]';
|
|
11
|
+
async function handler(args) {
|
|
12
|
+
const { derivedAccountId } = args;
|
|
13
|
+
const config = getConfigAccountById(derivedAccountId);
|
|
14
|
+
// check if the provided account is using a personal access key, if not, show an error
|
|
15
|
+
if (config && config.authType === 'personalaccesskey') {
|
|
16
|
+
const { name, personalAccessKey, env } = config;
|
|
17
|
+
let scopeGroups = [];
|
|
18
|
+
const response = await getAccessToken(personalAccessKey, env, derivedAccountId);
|
|
19
|
+
scopeGroups = response.scopeGroups.map(s => [s]);
|
|
20
|
+
// If a default account is present in the config, display it
|
|
21
|
+
const configPath = getConfigFilePath();
|
|
22
|
+
if (configPath) {
|
|
23
|
+
uiLogger.log(commands.account.subcommands.info.defaultAccountTitle);
|
|
24
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.info.configPath(configPath)}`);
|
|
25
|
+
const defaultAccount = getConfigDefaultAccount();
|
|
26
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.info.defaultAccount(defaultAccount.name)}`);
|
|
27
|
+
}
|
|
28
|
+
// If a default account override is present, display it
|
|
29
|
+
const overrideFilePath = getDefaultAccountOverrideFilePath();
|
|
30
|
+
if (overrideFilePath) {
|
|
31
|
+
uiLogger.log('');
|
|
32
|
+
uiLogger.log(commands.account.subcommands.info.overrideFilePathTitle);
|
|
33
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.info.overrideFilePath(overrideFilePath)}`);
|
|
34
|
+
const defaultAccount = getConfigDefaultAccount();
|
|
35
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.info.overrideAccount(defaultAccount.name)}`);
|
|
36
|
+
}
|
|
37
|
+
uiLogger.log('');
|
|
38
|
+
uiLogger.log(commands.account.subcommands.info.name(name));
|
|
39
|
+
uiLogger.log(commands.account.subcommands.info.accountId(derivedAccountId));
|
|
40
|
+
uiLogger.log(commands.account.subcommands.info.scopeGroups);
|
|
41
|
+
renderList(scopeGroups);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
uiLogger.log(commands.account.subcommands.info.errors.notUsingPersonalAccessKey);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function accountInfoBuilder(yargs) {
|
|
48
|
+
yargs.positional('account', {
|
|
49
|
+
describe: commands.account.subcommands.info.options.account.describe,
|
|
50
|
+
type: 'string',
|
|
51
|
+
});
|
|
52
|
+
yargs.example([
|
|
53
|
+
['$0 accounts info', commands.account.subcommands.info.examples.default],
|
|
54
|
+
[
|
|
55
|
+
'$0 accounts info MyAccount',
|
|
56
|
+
commands.account.subcommands.info.examples.nameBased,
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
'$0 accounts info 1234567',
|
|
60
|
+
commands.account.subcommands.info.examples.idBased,
|
|
61
|
+
],
|
|
62
|
+
]);
|
|
63
|
+
return yargs;
|
|
64
|
+
}
|
|
65
|
+
const builder = makeYargsBuilder(accountInfoBuilder, command, describe, {
|
|
66
|
+
useGlobalOptions: true,
|
|
67
|
+
useConfigOptions: true,
|
|
68
|
+
});
|
|
69
|
+
const accountInfoCommand = {
|
|
70
|
+
command,
|
|
71
|
+
describe,
|
|
72
|
+
handler,
|
|
73
|
+
builder,
|
|
74
|
+
};
|
|
75
|
+
export default accountInfoCommand;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { getConfigFilePath, getAllConfigAccounts, getConfigDefaultAccountIfExists, } from '@hubspot/local-dev-lib/config';
|
|
2
|
+
import { getDefaultAccountOverrideFilePath } from '@hubspot/local-dev-lib/config/defaultAccountOverride';
|
|
3
|
+
import { indent } from '../../lib/ui/index.js';
|
|
4
|
+
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
5
|
+
import { isSandbox, isDeveloperTestAccount } from '../../lib/accountTypes.js';
|
|
6
|
+
import { HUBSPOT_ACCOUNT_TYPES, HUBSPOT_ACCOUNT_TYPE_STRINGS, } from '@hubspot/local-dev-lib/constants/config';
|
|
7
|
+
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
8
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
9
|
+
import { commands } from '../../lang/en.js';
|
|
10
|
+
import { renderTable } from '../../ui/render.js';
|
|
11
|
+
const command = ['list', 'ls'];
|
|
12
|
+
const describe = commands.account.subcommands.list.describe;
|
|
13
|
+
function sortAndMapAccounts(accounts) {
|
|
14
|
+
const mappedAccountData = {};
|
|
15
|
+
// Standard and app developer accounts
|
|
16
|
+
accounts
|
|
17
|
+
.filter(p => p.accountType &&
|
|
18
|
+
(p.accountType === HUBSPOT_ACCOUNT_TYPES.STANDARD ||
|
|
19
|
+
p.accountType === HUBSPOT_ACCOUNT_TYPES.APP_DEVELOPER))
|
|
20
|
+
.forEach(account => {
|
|
21
|
+
mappedAccountData[account.accountId] = [account];
|
|
22
|
+
});
|
|
23
|
+
// Non-standard accounts (sandbox, developer test account)
|
|
24
|
+
accounts
|
|
25
|
+
.filter(p => p.accountType && (isSandbox(p) || isDeveloperTestAccount(p)))
|
|
26
|
+
.forEach(p => {
|
|
27
|
+
if (p.parentAccountId) {
|
|
28
|
+
mappedAccountData[p.parentAccountId] = [
|
|
29
|
+
...(mappedAccountData[p.parentAccountId] || []),
|
|
30
|
+
p,
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
mappedAccountData[p.accountId] = [p];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return mappedAccountData;
|
|
38
|
+
}
|
|
39
|
+
function getAccountData(mappedAccountData) {
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
const accountData = [];
|
|
42
|
+
Object.entries(mappedAccountData).forEach(([key, set]) => {
|
|
43
|
+
const hasParentAccount = set.filter(p => p.accountId === parseInt(key, 10))[0];
|
|
44
|
+
set.forEach(account => {
|
|
45
|
+
let name = `${account.name} [${HUBSPOT_ACCOUNT_TYPE_STRINGS[account.accountType]}]`;
|
|
46
|
+
if (isSandbox(account)) {
|
|
47
|
+
if (hasParentAccount && set.length > 1) {
|
|
48
|
+
name = `↳ ${name}`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else if (isDeveloperTestAccount(account)) {
|
|
52
|
+
if (hasParentAccount && set.length > 1) {
|
|
53
|
+
name = `↳ ${name}`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
accountData.push([name, account.accountId, account.authType]);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
return accountData;
|
|
60
|
+
}
|
|
61
|
+
async function handler(args) {
|
|
62
|
+
const { derivedAccountId } = args;
|
|
63
|
+
trackCommandUsage('accounts-list', undefined, derivedAccountId);
|
|
64
|
+
const configPath = getConfigFilePath();
|
|
65
|
+
const accountsList = getAllConfigAccounts();
|
|
66
|
+
const mappedAccountData = sortAndMapAccounts(accountsList);
|
|
67
|
+
const accountData = getAccountData(mappedAccountData);
|
|
68
|
+
const tableHeader = [
|
|
69
|
+
commands.account.subcommands.list.labels.name,
|
|
70
|
+
commands.account.subcommands.list.labels.accountId,
|
|
71
|
+
commands.account.subcommands.list.labels.authType,
|
|
72
|
+
];
|
|
73
|
+
const defaultAccount = getConfigDefaultAccountIfExists();
|
|
74
|
+
const accountId = defaultAccount?.accountId;
|
|
75
|
+
const overrideFilePath = getDefaultAccountOverrideFilePath();
|
|
76
|
+
// If a default account is present in the config, display it
|
|
77
|
+
if (configPath && accountId) {
|
|
78
|
+
uiLogger.log(commands.account.subcommands.list.defaultAccountTitle);
|
|
79
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.list.configPath(configPath)}`);
|
|
80
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.list.currentResolvedDefaultAccount(accountId)}`);
|
|
81
|
+
uiLogger.log('');
|
|
82
|
+
}
|
|
83
|
+
// If a default account override is present, display it
|
|
84
|
+
if (overrideFilePath && accountId) {
|
|
85
|
+
uiLogger.log(commands.account.subcommands.list.overrideFilePathTitle);
|
|
86
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.list.overrideFilePath(overrideFilePath)}`);
|
|
87
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.list.currentResolvedDefaultAccount(accountId)}`);
|
|
88
|
+
uiLogger.log('');
|
|
89
|
+
}
|
|
90
|
+
uiLogger.log(commands.account.subcommands.list.accounts);
|
|
91
|
+
renderTable(tableHeader, accountData, true);
|
|
92
|
+
}
|
|
93
|
+
function accountListBuilder(yargs) {
|
|
94
|
+
yargs.example([['$0 accounts list']]);
|
|
95
|
+
return yargs;
|
|
96
|
+
}
|
|
97
|
+
const builder = makeYargsBuilder(accountListBuilder, command, describe, {
|
|
98
|
+
useGlobalOptions: true,
|
|
99
|
+
useConfigOptions: true,
|
|
100
|
+
});
|
|
101
|
+
const accountListCommand = {
|
|
102
|
+
command,
|
|
103
|
+
describe,
|
|
104
|
+
handler,
|
|
105
|
+
builder,
|
|
106
|
+
};
|
|
107
|
+
export default accountListCommand;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CommonArgs, ConfigArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
type AccountRemoveArgs = CommonArgs & ConfigArgs & {
|
|
3
|
+
account?: string;
|
|
4
|
+
};
|
|
5
|
+
declare const accountRemoveCommand: YargsCommandModule<unknown, AccountRemoveArgs>;
|
|
6
|
+
export default accountRemoveCommand;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { getConfigFilePath, removeAccountFromConfig, getConfigDefaultAccountIfExists, getConfigAccountIfExists, getConfigAccountById, setConfigAccountAsDefault, getAllConfigAccounts, } from '@hubspot/local-dev-lib/config';
|
|
3
|
+
import { getDefaultAccountOverrideAccountId, getDefaultAccountOverrideFilePath, } from '@hubspot/local-dev-lib/config/defaultAccountOverride';
|
|
4
|
+
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
5
|
+
import { promptUser } from '../../lib/prompts/promptUtils.js';
|
|
6
|
+
import { logError } from '../../lib/errorHandlers/index.js';
|
|
7
|
+
import { selectAccountFromConfig } from '../../lib/prompts/accountsPrompt.js';
|
|
8
|
+
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
9
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
10
|
+
import { commands } from '../../lang/en.js';
|
|
11
|
+
const command = 'remove [account]';
|
|
12
|
+
const describe = commands.account.subcommands.remove.describe;
|
|
13
|
+
async function handler(args) {
|
|
14
|
+
const { account: accountFlag } = args;
|
|
15
|
+
let accountToRemoveConfig = accountFlag
|
|
16
|
+
? getConfigAccountIfExists(accountFlag)
|
|
17
|
+
: undefined;
|
|
18
|
+
let accountToRemoveId = accountToRemoveConfig?.accountId;
|
|
19
|
+
if (accountFlag && !accountToRemoveConfig) {
|
|
20
|
+
uiLogger.error(commands.account.subcommands.remove.errors.accountNotFound(accountFlag, getConfigFilePath()));
|
|
21
|
+
}
|
|
22
|
+
if (!accountToRemoveId) {
|
|
23
|
+
accountToRemoveId = await selectAccountFromConfig(commands.account.subcommands.remove.prompts.selectAccountToRemove);
|
|
24
|
+
}
|
|
25
|
+
accountToRemoveConfig = getConfigAccountById(accountToRemoveId);
|
|
26
|
+
trackCommandUsage('accounts-remove', undefined, accountToRemoveId);
|
|
27
|
+
const currentDefaultAccount = getConfigDefaultAccountIfExists();
|
|
28
|
+
const accounts = getAllConfigAccounts();
|
|
29
|
+
const accountOverride = getDefaultAccountOverrideAccountId(accounts);
|
|
30
|
+
const overrideFilePath = getDefaultAccountOverrideFilePath();
|
|
31
|
+
if (overrideFilePath &&
|
|
32
|
+
accountOverride &&
|
|
33
|
+
accountOverride === accountToRemoveConfig?.accountId) {
|
|
34
|
+
const { deleteOverrideFile } = await promptUser({
|
|
35
|
+
type: 'confirm',
|
|
36
|
+
name: 'deleteOverrideFile',
|
|
37
|
+
message: commands.account.subcommands.remove.prompts.deleteOverrideFile(overrideFilePath, accountToRemoveConfig.name),
|
|
38
|
+
});
|
|
39
|
+
try {
|
|
40
|
+
if (deleteOverrideFile) {
|
|
41
|
+
fs.unlinkSync(overrideFilePath);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
logError(error);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (accountToRemoveConfig) {
|
|
49
|
+
removeAccountFromConfig(accountToRemoveConfig.accountId);
|
|
50
|
+
}
|
|
51
|
+
uiLogger.success(commands.account.subcommands.remove.success.accountRemoved(accountToRemoveConfig.name));
|
|
52
|
+
if (currentDefaultAccount &&
|
|
53
|
+
accountToRemoveConfig?.accountId === currentDefaultAccount.accountId) {
|
|
54
|
+
uiLogger.log('');
|
|
55
|
+
uiLogger.log(commands.account.subcommands.remove.logs.replaceDefaultAccount);
|
|
56
|
+
const newDefaultAccount = await selectAccountFromConfig();
|
|
57
|
+
setConfigAccountAsDefault(newDefaultAccount);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function accountRemoveBuilder(yargs) {
|
|
61
|
+
yargs.positional('account', {
|
|
62
|
+
describe: commands.account.subcommands.remove.options.account.describe,
|
|
63
|
+
type: 'string',
|
|
64
|
+
});
|
|
65
|
+
yargs.example([
|
|
66
|
+
[
|
|
67
|
+
'$0 accounts remove',
|
|
68
|
+
commands.account.subcommands.remove.examples.default,
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
'$0 accounts remove MyAccount',
|
|
72
|
+
commands.account.subcommands.remove.examples.byName,
|
|
73
|
+
],
|
|
74
|
+
]);
|
|
75
|
+
return yargs;
|
|
76
|
+
}
|
|
77
|
+
const builder = makeYargsBuilder(accountRemoveBuilder, command, describe, {
|
|
78
|
+
useGlobalOptions: true,
|
|
79
|
+
useConfigOptions: true,
|
|
80
|
+
});
|
|
81
|
+
const accountRemoveCommand = {
|
|
82
|
+
command,
|
|
83
|
+
describe,
|
|
84
|
+
handler,
|
|
85
|
+
builder,
|
|
86
|
+
};
|
|
87
|
+
export default accountRemoveCommand;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CommonArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
type RemoveOverrideArgs = CommonArgs & {
|
|
3
|
+
force?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const accountRemoveOverrideCommand: YargsCommandModule<unknown, RemoveOverrideArgs>;
|
|
6
|
+
export default accountRemoveOverrideCommand;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import { globalConfigFileExists, getAllConfigAccounts, } from '@hubspot/local-dev-lib/config';
|
|
3
|
+
import { getDefaultAccountOverrideAccountId, getDefaultAccountOverrideFilePath, } from '@hubspot/local-dev-lib/config/defaultAccountOverride';
|
|
4
|
+
import { DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME } from '@hubspot/local-dev-lib/constants/config';
|
|
5
|
+
import { promptUser } from '../../lib/prompts/promptUtils.js';
|
|
6
|
+
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
7
|
+
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
8
|
+
import { logError } from '../../lib/errorHandlers/index.js';
|
|
9
|
+
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
10
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
11
|
+
import { commands } from '../../lang/en.js';
|
|
12
|
+
const command = 'remove-override';
|
|
13
|
+
const describe = commands.account.subcommands.removeOverride.describe(DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME);
|
|
14
|
+
async function handler(args) {
|
|
15
|
+
const { force } = args;
|
|
16
|
+
const globalConfigExists = globalConfigFileExists();
|
|
17
|
+
if (!globalConfigExists) {
|
|
18
|
+
uiLogger.error(commands.account.subcommands.removeOverride.errors.globalConfigNotFound);
|
|
19
|
+
process.exit(EXIT_CODES.ERROR);
|
|
20
|
+
}
|
|
21
|
+
const accounts = getAllConfigAccounts();
|
|
22
|
+
const accountOverride = getDefaultAccountOverrideAccountId(accounts);
|
|
23
|
+
const overrideFilePath = getDefaultAccountOverrideFilePath();
|
|
24
|
+
if (accountOverride && overrideFilePath) {
|
|
25
|
+
const accountId = accountOverride;
|
|
26
|
+
trackCommandUsage('account-removeOverride', undefined, accountId);
|
|
27
|
+
if (!force) {
|
|
28
|
+
uiLogger.log(commands.account.subcommands.removeOverride.accountOverride(overrideFilePath, accountOverride.toString()));
|
|
29
|
+
const { deleteOverrideFile } = await promptUser({
|
|
30
|
+
type: 'confirm',
|
|
31
|
+
name: 'deleteOverrideFile',
|
|
32
|
+
message: commands.account.subcommands.removeOverride.prompts
|
|
33
|
+
.deleteOverrideFile,
|
|
34
|
+
});
|
|
35
|
+
uiLogger.log('');
|
|
36
|
+
if (!deleteOverrideFile) {
|
|
37
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
fs.unlinkSync(overrideFilePath);
|
|
42
|
+
uiLogger.success(commands.account.subcommands.removeOverride.success);
|
|
43
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
logError(error);
|
|
47
|
+
process.exit(EXIT_CODES.ERROR);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
uiLogger.log(commands.account.subcommands.removeOverride.noOverrideFile);
|
|
52
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function accountRemoveOverrideBuilder(yargs) {
|
|
56
|
+
yargs.options('force', {
|
|
57
|
+
describe: commands.account.subcommands.removeOverride.options.force.describe,
|
|
58
|
+
type: 'boolean',
|
|
59
|
+
});
|
|
60
|
+
return yargs;
|
|
61
|
+
}
|
|
62
|
+
const builder = makeYargsBuilder(accountRemoveOverrideBuilder, command, describe, {
|
|
63
|
+
useGlobalOptions: true,
|
|
64
|
+
});
|
|
65
|
+
const accountRemoveOverrideCommand = {
|
|
66
|
+
command,
|
|
67
|
+
describe,
|
|
68
|
+
handler,
|
|
69
|
+
builder,
|
|
70
|
+
};
|
|
71
|
+
export default accountRemoveOverrideCommand;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CommonArgs, ConfigArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
export type AccountRenameArgs = CommonArgs & ConfigArgs & {
|
|
3
|
+
accountName: string;
|
|
4
|
+
newName: string;
|
|
5
|
+
};
|
|
6
|
+
declare const accountRenameCommand: YargsCommandModule<unknown, AccountRenameArgs>;
|
|
7
|
+
export default accountRenameCommand;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { renameConfigAccount } from '@hubspot/local-dev-lib/config';
|
|
2
|
+
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
3
|
+
import { commands } from '../../lang/en.js';
|
|
4
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
5
|
+
import { logError } from '../../lib/errorHandlers/index.js';
|
|
6
|
+
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
7
|
+
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
8
|
+
import { toKebabCase } from '@hubspot/local-dev-lib/text';
|
|
9
|
+
const command = 'rename <account-name> <new-name>';
|
|
10
|
+
const describe = commands.account.subcommands.rename.describe;
|
|
11
|
+
async function handler(args) {
|
|
12
|
+
const { accountName, newName, derivedAccountId } = args;
|
|
13
|
+
trackCommandUsage('accounts-rename', undefined, derivedAccountId);
|
|
14
|
+
const newNameKebabCase = toKebabCase(newName);
|
|
15
|
+
const nameWasSanitized = newNameKebabCase !== newName;
|
|
16
|
+
try {
|
|
17
|
+
renameConfigAccount(accountName, newNameKebabCase);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
logError(error);
|
|
21
|
+
process.exit(EXIT_CODES.ERROR);
|
|
22
|
+
}
|
|
23
|
+
uiLogger.success(commands.account.subcommands.rename.success.renamed(accountName, newNameKebabCase, nameWasSanitized));
|
|
24
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
25
|
+
}
|
|
26
|
+
function accountRenameBuilder(yargs) {
|
|
27
|
+
yargs.positional('account-name', {
|
|
28
|
+
describe: commands.account.subcommands.rename.positionals.accountName.describe,
|
|
29
|
+
type: 'string',
|
|
30
|
+
});
|
|
31
|
+
yargs.positional('new-name', {
|
|
32
|
+
describe: commands.account.subcommands.rename.positionals.newName.describe,
|
|
33
|
+
type: 'string',
|
|
34
|
+
});
|
|
35
|
+
yargs.example([
|
|
36
|
+
['$0 accounts rename myExistingAccountName myNewAccountName'],
|
|
37
|
+
]);
|
|
38
|
+
return yargs;
|
|
39
|
+
}
|
|
40
|
+
const builder = makeYargsBuilder(accountRenameBuilder, command, describe, {
|
|
41
|
+
useGlobalOptions: true,
|
|
42
|
+
useConfigOptions: true,
|
|
43
|
+
useAccountOptions: true,
|
|
44
|
+
});
|
|
45
|
+
const accountRenameCommand = {
|
|
46
|
+
command,
|
|
47
|
+
describe,
|
|
48
|
+
handler,
|
|
49
|
+
builder,
|
|
50
|
+
};
|
|
51
|
+
export default accountRenameCommand;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { getConfigFilePath, setConfigAccountAsDefault, getConfigAccountIfExists, getConfigAccountByName, getConfigAccountById, globalConfigFileExists, getAllConfigAccounts, } from '@hubspot/local-dev-lib/config';
|
|
2
|
+
import { getDefaultAccountOverrideAccountId, getDefaultAccountOverrideFilePath, } from '@hubspot/local-dev-lib/config/defaultAccountOverride';
|
|
3
|
+
import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
|
|
4
|
+
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
5
|
+
import { commands } from '../../lang/en.js';
|
|
6
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
7
|
+
import { selectAccountFromConfig, AUTHENTICATE_NEW_ACCOUNT_VALUE, } from '../../lib/prompts/accountsPrompt.js';
|
|
8
|
+
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
9
|
+
import { authenticateNewAccount } from '../../lib/accountAuth.js';
|
|
10
|
+
import { PromptExitError } from '../../lib/errors/PromptExitError.js';
|
|
11
|
+
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
12
|
+
const command = 'use [account]';
|
|
13
|
+
const describe = commands.account.subcommands.use.describe;
|
|
14
|
+
async function handler(args) {
|
|
15
|
+
let newDefaultAccount = args.account;
|
|
16
|
+
const usingGlobalConfig = globalConfigFileExists();
|
|
17
|
+
if (!newDefaultAccount) {
|
|
18
|
+
newDefaultAccount = await selectAccountFromConfig('', usingGlobalConfig);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const account = getConfigAccountIfExists(newDefaultAccount);
|
|
22
|
+
if (!account) {
|
|
23
|
+
uiLogger.error(commands.account.subcommands.use.errors.accountNotFound(newDefaultAccount, getConfigFilePath()));
|
|
24
|
+
newDefaultAccount = await selectAccountFromConfig('', usingGlobalConfig);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (newDefaultAccount === AUTHENTICATE_NEW_ACCOUNT_VALUE) {
|
|
28
|
+
let updatedConfig;
|
|
29
|
+
try {
|
|
30
|
+
updatedConfig = await authenticateNewAccount({
|
|
31
|
+
env: args.qa ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD,
|
|
32
|
+
setAsDefaultAccount: true,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
if (e instanceof PromptExitError) {
|
|
37
|
+
process.exit(e.exitCode);
|
|
38
|
+
}
|
|
39
|
+
throw e;
|
|
40
|
+
}
|
|
41
|
+
if (!updatedConfig) {
|
|
42
|
+
process.exit(EXIT_CODES.ERROR);
|
|
43
|
+
}
|
|
44
|
+
trackCommandUsage('accounts-use', undefined, updatedConfig.accountId);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
let account;
|
|
48
|
+
if (!isNaN(Number(newDefaultAccount))) {
|
|
49
|
+
account = getConfigAccountById(Number(newDefaultAccount));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
account = getConfigAccountByName(String(newDefaultAccount));
|
|
53
|
+
}
|
|
54
|
+
trackCommandUsage('accounts-use', undefined, account?.accountId);
|
|
55
|
+
const accounts = getAllConfigAccounts();
|
|
56
|
+
const accountOverride = getDefaultAccountOverrideAccountId(accounts);
|
|
57
|
+
const overrideFilePath = getDefaultAccountOverrideFilePath();
|
|
58
|
+
if (accountOverride && overrideFilePath) {
|
|
59
|
+
uiLogger.warn(commands.account.subcommands.use.accountOverride(accountOverride.toString()));
|
|
60
|
+
uiLogger.log(commands.account.subcommands.use.accountOverrideCommands);
|
|
61
|
+
uiLogger.log('');
|
|
62
|
+
}
|
|
63
|
+
setConfigAccountAsDefault(String(newDefaultAccount));
|
|
64
|
+
return uiLogger.success(commands.account.subcommands.use.success.defaultAccountUpdated(account.name));
|
|
65
|
+
}
|
|
66
|
+
function accountUseBuilder(yargs) {
|
|
67
|
+
yargs.positional('account', {
|
|
68
|
+
describe: commands.account.subcommands.use.options.account.describe,
|
|
69
|
+
type: 'string',
|
|
70
|
+
});
|
|
71
|
+
yargs.example([
|
|
72
|
+
['$0 accounts use', commands.account.subcommands.use.examples.default],
|
|
73
|
+
[
|
|
74
|
+
'$0 accounts use MyAccount',
|
|
75
|
+
commands.account.subcommands.use.examples.nameBased,
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
'$0 accounts use 1234567',
|
|
79
|
+
commands.account.subcommands.use.examples.idBased,
|
|
80
|
+
],
|
|
81
|
+
]);
|
|
82
|
+
return yargs;
|
|
83
|
+
}
|
|
84
|
+
const builder = makeYargsBuilder(accountUseBuilder, command, describe, {
|
|
85
|
+
useGlobalOptions: true,
|
|
86
|
+
});
|
|
87
|
+
const accountUseCommand = {
|
|
88
|
+
command,
|
|
89
|
+
describe,
|
|
90
|
+
handler,
|
|
91
|
+
builder,
|
|
92
|
+
};
|
|
93
|
+
export default accountUseCommand;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { commands } from '../lang/en.js';
|
|
2
|
+
import auth from './account/auth.js';
|
|
3
|
+
import list from './account/list.js';
|
|
4
|
+
import rename from './account/rename.js';
|
|
5
|
+
import use from './account/use.js';
|
|
6
|
+
import info from './account/info.js';
|
|
7
|
+
import remove from './account/remove.js';
|
|
8
|
+
import clean from './account/clean.js';
|
|
9
|
+
import createOverride from './account/createOverride.js';
|
|
10
|
+
import removeOverride from './account/removeOverride.js';
|
|
11
|
+
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
12
|
+
const command = ['account', 'accounts'];
|
|
13
|
+
const describe = commands.account.describe;
|
|
14
|
+
function accountBuilder(yargs) {
|
|
15
|
+
yargs
|
|
16
|
+
.command(auth)
|
|
17
|
+
.command(list)
|
|
18
|
+
.command(rename)
|
|
19
|
+
.command(use)
|
|
20
|
+
.command(info)
|
|
21
|
+
.command(remove)
|
|
22
|
+
.command(clean)
|
|
23
|
+
.command(createOverride)
|
|
24
|
+
.command(removeOverride)
|
|
25
|
+
.demandCommand(1, '');
|
|
26
|
+
return yargs;
|
|
27
|
+
}
|
|
28
|
+
const builder = makeYargsBuilder(accountBuilder, command, describe);
|
|
29
|
+
const accountCommand = {
|
|
30
|
+
command,
|
|
31
|
+
describe,
|
|
32
|
+
builder,
|
|
33
|
+
handler: () => { },
|
|
34
|
+
};
|
|
35
|
+
export default accountCommand;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ArgumentsCamelCase } from 'yargs';
|
|
2
|
+
import { YargsCommandModule } from '../../types/Yargs.js';
|
|
3
|
+
import { MigrateAppArgs } from '../../lib/app/migrate.js';
|
|
4
|
+
export declare function handlerGenerator(commandTrackingName: string): (args: ArgumentsCamelCase<MigrateAppArgs>) => Promise<void>;
|
|
5
|
+
declare const migrateCommand: YargsCommandModule<unknown, MigrateAppArgs>;
|
|
6
|
+
export default migrateCommand;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { getConfigAccountById } from '@hubspot/local-dev-lib/config';
|
|
2
|
+
import { PLATFORM_VERSIONS } from '@hubspot/local-dev-lib/constants/projects';
|
|
3
|
+
import { trackCommandMetadataUsage, trackCommandUsage, } from '../../lib/usageTracking.js';
|
|
4
|
+
import { commands } from '../../lang/en.js';
|
|
5
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
6
|
+
import { ApiErrorContext, logError } from '../../lib/errorHandlers/index.js';
|
|
7
|
+
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
8
|
+
import { migrateApp } from '../../lib/app/migrate.js';
|
|
9
|
+
import { getIsInProject } from '../../lib/projects/config.js';
|
|
10
|
+
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
11
|
+
const { v2025_2, v2026_03_beta, v2026_03 } = PLATFORM_VERSIONS;
|
|
12
|
+
const command = 'migrate';
|
|
13
|
+
const describe = commands.project.migrateApp.describe;
|
|
14
|
+
export function handlerGenerator(commandTrackingName) {
|
|
15
|
+
return async function handler(args) {
|
|
16
|
+
const { derivedAccountId, platformVersion, unstable } = args;
|
|
17
|
+
await trackCommandUsage(commandTrackingName, {}, derivedAccountId);
|
|
18
|
+
const accountConfig = getConfigAccountById(derivedAccountId);
|
|
19
|
+
if (!accountConfig) {
|
|
20
|
+
uiLogger.error(commands.project.migrateApp.errors.noAccountConfig);
|
|
21
|
+
return process.exit(EXIT_CODES.ERROR);
|
|
22
|
+
}
|
|
23
|
+
uiLogger.log('');
|
|
24
|
+
uiLogger.log(commands.project.migrateApp.header);
|
|
25
|
+
uiLogger.log('');
|
|
26
|
+
try {
|
|
27
|
+
if (getIsInProject()) {
|
|
28
|
+
uiLogger.error(commands.project.migrateApp.errors.notAllowedWithinProject);
|
|
29
|
+
return process.exit(EXIT_CODES.ERROR);
|
|
30
|
+
}
|
|
31
|
+
args.platformVersion = unstable
|
|
32
|
+
? PLATFORM_VERSIONS.unstable
|
|
33
|
+
: platformVersion;
|
|
34
|
+
await migrateApp(derivedAccountId, args);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (error &&
|
|
38
|
+
typeof error === 'object' &&
|
|
39
|
+
'errors' in error &&
|
|
40
|
+
Array.isArray(error.errors)) {
|
|
41
|
+
error.errors.forEach(err => logError(err));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
logError(error, new ApiErrorContext({ accountId: derivedAccountId }));
|
|
45
|
+
}
|
|
46
|
+
await trackCommandMetadataUsage(commandTrackingName, { successful: false }, derivedAccountId);
|
|
47
|
+
return process.exit(EXIT_CODES.ERROR);
|
|
48
|
+
}
|
|
49
|
+
await trackCommandMetadataUsage(commandTrackingName, { successful: true }, derivedAccountId);
|
|
50
|
+
return process.exit(EXIT_CODES.SUCCESS);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const handler = handlerGenerator('app-migrate');
|
|
54
|
+
function appMigrateBuilder(yargs) {
|
|
55
|
+
yargs.options({
|
|
56
|
+
name: {
|
|
57
|
+
describe: commands.project.migrateApp.options.name.describe,
|
|
58
|
+
type: 'string',
|
|
59
|
+
},
|
|
60
|
+
dest: {
|
|
61
|
+
describe: commands.project.migrateApp.options.dest.describe,
|
|
62
|
+
type: 'string',
|
|
63
|
+
},
|
|
64
|
+
'app-id': {
|
|
65
|
+
describe: commands.project.migrateApp.options.appId.describe,
|
|
66
|
+
type: 'number',
|
|
67
|
+
},
|
|
68
|
+
'platform-version': {
|
|
69
|
+
type: 'string',
|
|
70
|
+
choices: [v2025_2, v2026_03_beta, v2026_03],
|
|
71
|
+
default: v2026_03,
|
|
72
|
+
},
|
|
73
|
+
unstable: {
|
|
74
|
+
type: 'boolean',
|
|
75
|
+
default: false,
|
|
76
|
+
hidden: true,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
yargs.example([
|
|
80
|
+
[`$0 app migrate`, commands.project.migrateApp.examples.default],
|
|
81
|
+
]);
|
|
82
|
+
return yargs;
|
|
83
|
+
}
|
|
84
|
+
const builder = makeYargsBuilder(appMigrateBuilder, command, commands.project.migrateApp.describe, {
|
|
85
|
+
useGlobalOptions: true,
|
|
86
|
+
useConfigOptions: true,
|
|
87
|
+
useAccountOptions: true,
|
|
88
|
+
useEnvironmentOptions: true,
|
|
89
|
+
});
|
|
90
|
+
const migrateCommand = {
|
|
91
|
+
command,
|
|
92
|
+
describe,
|
|
93
|
+
handler,
|
|
94
|
+
builder,
|
|
95
|
+
};
|
|
96
|
+
export default migrateCommand;
|