-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): add a
webstone deploy web
CLI command
- Loading branch information
1 parent
d47bbbb
commit 2ecb412
Showing
5 changed files
with
45 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@webstone/cli": minor | ||
--- | ||
|
||
Add a `webstone deploy web` CLI command. |
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,34 @@ | ||
import type { WebstoneToolbox } from "../../extensions/web"; | ||
|
||
import { GluegunCommand } from "gluegun"; | ||
|
||
const command: GluegunCommand = { | ||
// @ts-ignore: WebstoneToolbox extends GluegunToolbox, ignore TS error. | ||
run: async (toolbox: WebstoneToolbox) => { | ||
const { parameters, print, system, web } = toolbox; | ||
|
||
if (!web.configure.deployment.isAnyAdapterInstalled()) { | ||
print.warning( | ||
"No deployment adapter configured. Please run `pnpm webstone web configure deployment` to fix this before you deploy the application." | ||
); | ||
return; | ||
} | ||
|
||
const buildSpinner = print.spin(`Building the web service...`); | ||
await system.run(`pnpm build --filter ./services/web`); | ||
buildSpinner.succeed(); | ||
|
||
if (parameters.options.preview) { | ||
print.info(`Previewing the web service...`); | ||
await system.exec(`pnpm preview --filter ./services/web`, { | ||
stdout: "inherit", | ||
}); | ||
} else { | ||
print.highlight( | ||
`TODO: Link to deployment docs for the ${web.configure.deployment.getInstalledAdapterPackageName()} adapter.` | ||
); | ||
} | ||
}, | ||
}; | ||
|
||
module.exports = command; |
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