Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX- 345 | removed static url #234

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@ const config = {
manifestPath: resolve(__dirname, "manifest.json"),
boilerplateName: "marketplace-app-boilerplate-main",
developerHubBaseUrl: "",
developerHubUrls: {
// NOTE CDA url used as developer-hub url mapper to avoid conflict if user used any custom name
"https://api.contentstack.io": "developerhub-api.contentstack.com",
"https://eu-api.contentstack.com": "eu-developerhub-api.contentstack.com",
"https://azure-na-api.contentstack.com":
"azure-na-developerhub-api.contentstack.com",
"https://azure-eu-api.contentstack.com":
"azure-eu-developerhub-api.contentstack.com",
"https://gcp-na-api.contentstack.com": "gcp-na-developerhub-api.contentstack.com",
},
appBoilerplateGithubUrl:
"https://codeload.github.com/contentstack/marketplace-app-boilerplate/zip/refs/heads/main",
defaultAppFileName: "manifest",
Expand Down
4 changes: 1 addition & 3 deletions test/unit/commands/app/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ const { origin, pathname } = new URL(config.appBoilerplateGithubUrl);
const zipPath = join(process.cwd(), "test", "unit", "mock", "boilerplate.zip");
const region: { cma: string; name: string; cda: string } =
configHandler.get("region");
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[
region.cma
];
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");
harshithad0703 marked this conversation as resolved.
Show resolved Hide resolved

describe("app:create", () => {
beforeEach(() => {
Expand Down
5 changes: 1 addition & 4 deletions test/unit/commands/app/delete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import { test, expect } from "@oclif/test";
import { cliux, configHandler, ux } from "@contentstack/cli-utilities";
import * as mock from "../../mock/common.mock.json"

import config from "../../../../src/config";
import messages, {$t} from "../../../../src/messages";

const region: { cma: string; name: string; cda: string } =
configHandler.get("region");
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[
region.cma
];
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");
harshithad0703 marked this conversation as resolved.
Show resolved Hide resolved

describe("app:delete", () => {
describe("app:delete with --org and --app-uid flags", () => {
Expand Down
4 changes: 1 addition & 3 deletions test/unit/commands/app/get.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import * as commonUtils from "../../../../src/util/common-utils";

const region: { cma: string; name: string; cda: string } =
configHandler.get("region");
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[
region.cma
];
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");

describe("app:get", () => {
describe("Get app manifest", () => {
Expand Down
3 changes: 1 addition & 2 deletions test/unit/commands/app/install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import {expect, test} from "@oclif/test";

import * as mock from "../../mock/common.mock.json"

import config from "../../../../src/config";
import messages, { $t } from "../../../../src/messages";

const region: { cma: string, cda: string, name: string } = configHandler.get("region");
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[region.cma];
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");

describe("app:install", () => {
describe("Install an app on organization", () => {
Expand Down
3 changes: 1 addition & 2 deletions test/unit/commands/app/uninstall.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { expect, test } from "@oclif/test";

import * as mock from "../../mock/common.mock.json"

import config from "../../../../src/config"
import messages, {$t} from "../../../../src/messages";

const region: { cma: string, cda: string, name: string } = configHandler.get("region");
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[region.cma];
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");

describe("app:uninstall", () => {
describe("Uninstall an app from organization", () => {
Expand Down
5 changes: 1 addition & 4 deletions test/unit/commands/app/update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ import { PassThrough } from "stream";
import { expect, test } from "@oclif/test";
import { cliux, ux, configHandler } from "@contentstack/cli-utilities";

import config from "../../../../src/config";
import messages from "../../../../src/messages";
import * as mock from "../../mock/common.mock.json";
import manifestData from "../../config/manifest.json";

const region: { cma: string; name: string; cda: string } =
configHandler.get("region");
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[
region.cma
];
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");

describe("app:update", () => {
describe("Update app with `--app-manifest` flag", () => {
Expand Down
5 changes: 1 addition & 4 deletions test/unit/util/common-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ import {
managementSDKClient,
} from "@contentstack/cli-utilities";

import config from "../../../src/config";
import { LogFn } from "../../../src/types";
import * as mock from "../mock/common.mock.json";
import { fetchApps, getOrganizations } from "../../../src/util/common-utils";

const region: { cma: string; name: string; cda: string } =
configHandler.get("region");
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[
region.cma
];
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");

describe("common utils", () => {
const log: LogFn = () => {};
Expand Down
Loading