Skip to content

Commit

Permalink
refactor: launch project flag
Browse files Browse the repository at this point in the history
  • Loading branch information
aman19K committed Jun 19, 2024
1 parent 09754e4 commit 335f067
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/commands/app/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export default class Deploy extends AppCLIBaseCommand {
"$ <%= config.bin %> <%= command.id %>",
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1>",
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1> --hosting-type <Custom Hosting> --app-url <https://localhost:3000>",
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1> --hosting-type <Hosting with Launch> --launch-project-type <existing-project>",
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1> --hosting-type <Hosting with Launch> --launch-project-type <new-project>",
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1> --hosting-type <Hosting with Launch> --launch-project-type <new-project> --config <config-path>",
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1> --hosting-type <Hosting with Launch> --launch-project <existing>",
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1> --hosting-type <Hosting with Launch> --launch-project <new>",
"$ <%= config.bin %> <%= command.id %> --org <UID> --app-uid <APP-UID-1> --hosting-type <Hosting with Launch> --launch-project <new> --config <config-path>",
];

static flags: FlagInput = {
Expand All @@ -51,10 +51,10 @@ export default class Deploy extends AppCLIBaseCommand {
description: deployAppMsg.FORCE_DISCONNECT,
default: false,
}),
"launch-project-type": Flags.string({
"launch-project": Flags.string({
multiple: false,
options: ["existing-project", "new-project"],
description: deployAppMsg.LAUNCH_PROJECT_TYPE,
options: ["existing", "new"],
description: deployAppMsg.LAUNCH_PROJECT,
}),
config: Flags.string({
char: "c",
Expand Down Expand Up @@ -89,8 +89,8 @@ export default class Deploy extends AppCLIBaseCommand {
const config = setupConfig(flags["config"]);
config["name"] = config["name"] || app?.name;
await this.handleAppDisconnect(projects);
this.flags["launch-project-type"] =
this.flags["launch-project-type"] || (await askProjectType());
this.flags["launch-project"] =
this.flags["launch-project"] || (await askProjectType());
await this.handleHostingWithLaunch(config, updateHostingPayload, projects);
break;
default:
Expand Down Expand Up @@ -190,9 +190,9 @@ export default class Deploy extends AppCLIBaseCommand {
): Promise<void> {
let url: string = "";

if (this.flags["launch-project-type"] === "existing-project") {
if (this.flags["launch-project"] === "existing") {
url = await this.handleExistingProject(updateHostingPayload, projects);
} else if (this.flags["launch-project-type"] === "new-project") {
} else if (this.flags["launch-project"] === "new") {
config["name"] = await handleProjectNameConflict(
config["name"],
projects
Expand Down
2 changes: 1 addition & 1 deletion src/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const reinstallAppMsg = {
const deployAppMsg = {
APP_DEPLOYED: "{app} deployed successfully.",
FORCE_DISCONNECT: "Force disconnect launch project by skipping the confirmation",
LAUNCH_PROJECT_TYPE: "Launch Project Type",
LAUNCH_PROJECT: "Launch Project",
APP_URL: "App URL",
HOSTING_TYPE: "Hosting Type",
CONFIG_FILE: "[optional] path of config file",
Expand Down
8 changes: 4 additions & 4 deletions src/util/inquirer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@ async function selectProject(
const askProjectType = async (): Promise<string> => {
return await cliux.inquire<string>({
type: "list",
name: "selected_project_type",
message: "Launch Project type",
name: "selected_launch_project",
message: "Launch Project",
choices: [
{ name: "Existing", value: "existing-project" },
{ name: "New", value: "new-project" },
{ name: "Existing", value: "existing" },
{ name: "New", value: "new" },
],
});
};
Expand Down

0 comments on commit 335f067

Please sign in to comment.