Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions packages/project-aws/src/extensions/Webiny.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const Webiny = () => {
<Project />
<BeforeBuild src={p("Webiny/BuildAppWorkspace.js")} />
<AdminAfterDeploy src={p("Webiny/UploadAdminAppToS3.js")} />
<AdminAfterDeploy src={p("Webiny/PrintAdminUrl.js")} />
<ApiAfterDeploy src={p("Webiny/ExecuteDataMigrations.js")} />
<ExtensionDefinitions src={p("Webiny/definitions.js")} />

Expand Down
59 changes: 59 additions & 0 deletions packages/project-aws/src/extensions/Webiny/PrintAdminUrl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { createImplementation } from "@webiny/di-container";
import {
AdminAfterDeploy,
GetAppStackOutput,
UiService
} from "@webiny/project/abstractions/index.js";
import { type IDefaultStackOutput } from "~/pulumi/types.js";
import chalk from "chalk";

interface IAdminStackOutput extends IDefaultStackOutput {
appUrl?: string;
}

class PrintAdminUrl implements AdminAfterDeploy.Interface {
constructor(
private ui: UiService.Interface,
private getAppStackOutput: GetAppStackOutput.Interface
) {}

async execute(params: AdminAfterDeploy.Params) {
// No need to print URL if we're doing a preview.
if (params.preview) {
return;
}

const appOutput = await this.getAppStackOutput.execute<IAdminStackOutput>(params);
if (!appOutput) {
this.ui.info("Admin app stack output not found.");
return;
}

const { green, blue } = chalk;

// Construct the Admin URL from stack output
// Use appUrl if available (includes custom domain support), otherwise construct from appDomain
const adminUrl = appOutput.appUrl || (appOutput.appDomain ? `https://${appOutput.appDomain}` : null);

if (!adminUrl) {
this.ui.info("Admin URL not available in stack output.");
return;
}

const output = [
"",
green("Admin Application Deployed"),
`‣ Environment: ${blue(params.env)}`,
`‣ Admin URL: ${blue(adminUrl)}`,
""
];

console.log(output.join("\n"));
}
}

export default createImplementation({
abstraction: AdminAfterDeploy,
implementation: PrintAdminUrl,
dependencies: [UiService, GetAppStackOutput]
});