Skip to content

Commit

Permalink
PCC-1882: Updated site creation command
Browse files Browse the repository at this point in the history
  • Loading branch information
aumkar committed Jan 28, 2025
1 parent aeef080 commit 1149f77
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
10 changes: 3 additions & 7 deletions packages/cli/src/cli/commands/sites/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ import AddOnApiHelper from "../../../lib/addonApiHelper";
import { printTable } from "../../../lib/cliDisplay";
import { errorHandler, IncorrectAccount } from "../../exceptions";

export const createSite = errorHandler<{ url: string; googleAccount: string }>(
async ({ url, googleAccount }) => {
export const createSite = errorHandler<{ url: string; domain: string }>(
async ({ url, domain }) => {
const spinner = ora("Creating site...").start();
if (!googleAccount) {
spinner.fail("You must provide Google workspace account");
return;
}

try {
const siteId = await AddOnApiHelper.createSite(url, googleAccount);
const siteId = await AddOnApiHelper.createSite(url, domain);
spinner.succeed(
`Successfully created the site with given details. Id: ${siteId}`,
);
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,16 +389,16 @@ yargs(hideBin(process.argv))
type: "string",
demandOption: true,
});
yargs.option("googleAccount", {
describe: "Google workspace account email",
yargs.option("domain", {
describe: "Domain of the site",
type: "string",
demandOption: false,
demandOption: true,
});
},
async (args) =>
await createSite({
url: args.url as string,
googleAccount: args.googleAccount as string,
domain: args.domain as string,
}),
)
.command(
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/lib/addonApiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ class AddOnApiHelper {
}
}

static async createSite(url: string, googleAccount: string): Promise<string> {
static async createSite(url: string, domain: string): Promise<string> {
const { access_token: googleAccessToken } = await this.getGoogleTokens({
email: googleAccount,
domain,
});
const { access_token: auth0AccessToken } = await this.getAuth0Tokens();

Expand Down

0 comments on commit 1149f77

Please sign in to comment.