Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.

Commit

Permalink
W.I.P.
Browse files Browse the repository at this point in the history
  • Loading branch information
pierce-h committed Sep 15, 2020
1 parent 9600456 commit 8479681
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions src/core/publish-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { watchDeployment } from "./publish-app/watch-deployment";
import { green, red } from "chalk";
import parseDeploymentErrors from './utils/parse-deployment-errors';
import Table from 'cli-table';

import { ConnectApp } from './types'

class AppFailedToPackageError extends Error {
code: string;
Expand Down Expand Up @@ -129,39 +129,32 @@ export default async function publishApp(
console.log(
green(`Your app was published successfully ${logSymbols.success} `),
);
await createOrFindTestAccount(client, platformApp);
}

return newDeployment;
}

const sellers = await client.sellers.getSellersForAppId(platformApp.id)
const email = `${platformApp.id}@test.com`;
await createOrFindTestAccount(client, platformApp);

console.log(newDeployment);
return newDeployment;
}

if (sellers.some((seller) => seller.email === email)) {
const table = new Table();
const createOrFindTestAccount = async (client: APIClient, platformApp: ConnectApp) => {
const sellers = await client.sellers.getSellersForAppId(platformApp.id)
const email = `${platformApp.id}@test.com`;

table.push(
{ 'Email': [email] },
{ 'Password': [platformApp.id] },
{ 'URL': ["test.com"] }
);
} else {
if (!sellers.some((seller) => seller.email === email)) {
cli.action.start("Creating test account");
await client.sellers.createSeller(platformApp.id, email, platformApp.id)
cli.action.stop(`${logSymbols.success}`);

const table = new Table();

table.push(
{ 'Email': [email] },
{ 'Password': [platformApp.id] },
{ 'URL': ["test.com"] }
);

console.log(table.toString());
}

return newDeployment;
const table = new Table();

table.push(
{ 'Email': [email] },
{ 'Password': [platformApp.id] },
{ 'Test URL': ["https://ss-devss127.sslocal.com/"] }
);
console.log("Test your app with the account below:");
console.log(table.toString());
}

0 comments on commit 8479681

Please sign in to comment.