diff --git a/package-lock.json b/package-lock.json index ea9ed0c..c08f62b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@contentstack/apps-cli", - "version": "1.0.6", + "version": "1.0.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@contentstack/apps-cli", - "version": "1.0.6", + "version": "1.0.7", "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.17", diff --git a/package.json b/package.json index 76360c0..f3a48e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@contentstack/apps-cli", - "version": "1.0.6", + "version": "1.0.7", "description": "App ClI", "author": "Contentstack CLI", "homepage": "https://github.com/contentstack/contentstack-apps-cli", diff --git a/src/util/inquirer.ts b/src/util/inquirer.ts index a00d1df..c55142e 100644 --- a/src/util/inquirer.ts +++ b/src/util/inquirer.ts @@ -12,8 +12,7 @@ import { import { Installation } from "@contentstack/management/types/app/installation"; import { AppTarget } from "@contentstack/management/types/app/index"; -import config from "../config"; -import messages, { $t, commonMsg, errors, uninstallAppMsg } from "../messages"; +import messages, { $t, errors, uninstallAppMsg } from "../messages"; import { CommonOptions, getOrganizations, @@ -159,28 +158,20 @@ async function getInstalledApps( * @return {*} {Promise} */ async function getDeveloperHubUrl(): Promise { - const { cma, name } = configHandler.get("region") || {}; - let developerHubBaseUrl = (config.developerHubUrls as Record)[ - cma - ]; - - if (!developerHubBaseUrl) { - developerHubBaseUrl = await cliux.inquire({ - type: "input", - name: "name", - validate: (url) => { - if (!url) return errors.BASE_URL_EMPTY; - - return true; - }, - message: $t(commonMsg.DEVELOPER_HUB_URL_PROMPT, { name }), - }); - } + const { cma } = configHandler.get("region") || {}; + let developerHubBaseUrl = cma.replace("api", "developerhub-api"); if (developerHubBaseUrl.startsWith("http")) { developerHubBaseUrl = developerHubBaseUrl.split("//")[1]; } + developerHubBaseUrl = developerHubBaseUrl.startsWith("dev11") + ? developerHubBaseUrl.replace("dev11", "dev") + : developerHubBaseUrl; + developerHubBaseUrl = developerHubBaseUrl.endsWith("io") + ? developerHubBaseUrl.replace("io", "com") + : developerHubBaseUrl; + return developerHubBaseUrl; }