-
Couldn't load subscription status.
- Fork 657
Enable multi-app deploy support in webiny deploy command #4743
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
Changes from 3 commits
5d92b42
64c353b
ada5145
2568d72
d09a4e0
b569ac8
aad1b34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,12 @@ export interface IDeployNoAppParams { | |
| } | ||
|
|
||
| export interface IDeployWithAppParams extends IDeployNoAppParams { | ||
| apps: AppName[]; | ||
| build?: boolean; | ||
| preview?: boolean; | ||
| } | ||
|
|
||
| export interface IDeploySingleAppParams extends IDeployNoAppParams { | ||
| app: AppName; | ||
| build?: boolean; | ||
| preview?: boolean; | ||
|
|
@@ -43,14 +49,16 @@ export class DeployCommand implements Command.Interface<IDeployCommandParams> { | |
| description: "Deploys specified app or all apps in the project", | ||
| examples: [ | ||
| "$0 deploy api --env dev", | ||
| "$0 deploy core api --env dev", | ||
| "$0 deploy admin --env prod", | ||
| "$0 deploy --env prod", | ||
| "$0 deploy" | ||
| ], | ||
| params: [ | ||
| { | ||
| name: "app", | ||
| description: "Name of the app (core, admin, or api)", | ||
| name: "apps..", | ||
|
||
| description: | ||
| "Name of the app(s) to deploy (core, admin, or api). You can specify multiple apps.", | ||
| type: "string" | ||
| } | ||
| ], | ||
|
|
@@ -61,7 +69,12 @@ export class DeployCommand implements Command.Interface<IDeployCommandParams> { | |
| type: "string", | ||
| default: "dev", | ||
| validation: params => { | ||
| if ("app" in params && !params.env) { | ||
| if ( | ||
| "apps" in params && | ||
| params.apps && | ||
| params.apps.length > 0 && | ||
| !params.env | ||
| ) { | ||
| throw new Error("Environment name is required when deploying an app."); | ||
| } | ||
| return true; | ||
|
|
@@ -111,8 +124,15 @@ export class DeployCommand implements Command.Interface<IDeployCommandParams> { | |
| } | ||
| ], | ||
| handler: async (params: IDeployCommandParams) => { | ||
| if ("app" in params) { | ||
| await this.deployApp(params); | ||
| if ("apps" in params && params.apps && params.apps.length > 0) { | ||
| // Deploy specified apps | ||
| for (const app of params.apps) { | ||
| const appParams = { ...params, app }; | ||
| ui.info("Deploying %s app...", app.charAt(0).toUpperCase() + app.slice(1)); | ||
| await this.deployApp(appParams); | ||
| ui.newLine(); | ||
| } | ||
| ui.success(`Apps deployed: ${params.apps.join(", ")}`); | ||
| } else { | ||
| const isCi = projectSdk.isCi(); | ||
| const coreStack = await projectSdk.getAppStackOutput({ | ||
|
|
@@ -195,7 +215,7 @@ export class DeployCommand implements Command.Interface<IDeployCommandParams> { | |
| }; | ||
| } | ||
|
|
||
| private async deployApp(params: IDeployWithAppParams) { | ||
| private async deployApp(params: IDeploySingleAppParams) { | ||
| const projectSdk = await this.getProjectSdkService.execute(); | ||
|
|
||
| const ui = this.uiService; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.