-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
garden up
command as alias for deploy --logs
- Loading branch information
Showing
4 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright (C) 2018-2023 Garden Technologies, Inc. <[email protected]> | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
import chalk from "chalk" | ||
import { Command, CommandParams, CommandResult } from "./base" | ||
import { dedent } from "../util/string" | ||
import { deployArgs, DeployCommand, deployOpts } from "./deploy" | ||
import { serveOpts } from "./serve" | ||
import { DevCommand } from "./dev" | ||
import type { LoggerType } from "../logger/logger" | ||
|
||
const upArgs = { | ||
...deployArgs, | ||
} | ||
|
||
const upOpts = { | ||
...deployOpts, | ||
...serveOpts, | ||
} | ||
|
||
type UpArgs = typeof upArgs | ||
type UpOpts = typeof upOpts | ||
|
||
export class UpCommand extends Command<UpArgs, UpOpts> { | ||
name = "up" | ||
help = "Spin up your stack with the dev console and streaming logs." | ||
emoji: "🚀" | ||
|
||
description = dedent` | ||
Spin up your stack with the dev console and streaming logs. | ||
This is basically an alias for ${chalk.cyanBright( | ||
"garden dev --cmd 'deploy --logs'" | ||
)}, but you can add any arguments and flags supported by the ${chalk.cyanBright("deploy")} command as well. | ||
` | ||
|
||
getTerminalWriterType(): LoggerType { | ||
return "ink" | ||
} | ||
|
||
async action(params: CommandParams<UpArgs, UpOpts>): Promise<CommandResult> { | ||
let cmd: Command = new DevCommand() | ||
|
||
if (params.commandLine) { | ||
// We're already in the dev command | ||
cmd = new DeployCommand() | ||
params.opts.logs = true | ||
} else { | ||
params.opts.cmd = ["deploy --logs " + params.args.$all!.join(" ")] | ||
} | ||
|
||
cmd.printHeader(params) | ||
await cmd.prepare(params) | ||
|
||
return cmd.action(params) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters