Webiny CLI
Learn what Webiny CLI is and how it can help you in your project development.
- what is the Webiny CLI
- what are the commonly used commands
Overview
Webiny CLI (command line interface) is the central tool that you’ll be using throughout the complete project development process, in your terminal of choice.
Out of the box, it offers a couple of commands that will let you perform essential tasks like deployments, development and production code builds, different scaffolding, and so on.
Additionally, the Webiny CLI is pluggable, meaning you can easily create your own custom commands, or even replace the existing ones. Please visit the Adding Custom Commands guide for more information.For a full list of commands, in your terminal of choice, make sure to run yarn webiny --help
.
Common Commands
yarn webiny watch {folder} --env {env}
Watches specified project application for application and cloud infrastructure code changes, and performs rebuilds and redeploys, accordingly.
yarn webiny build {folder} --env {dev}
Builds a project application located inside of the specified folder.
yarn webiny deploy --env {dev}
By default, the command will deploy project applications into the dev
environment. But, you can specify a different one using the --env
argument.
yarn webiny deploy {folder} --env {env}
Builds a project application located inside of the specified folder and deploys cloud infrastructure resources defined within it, into the specified environment.
The --env
argument is required.
yarn webiny destroy {folder} --env {env}
Destroys cloud infrastructure resources that were previously deployed as part of the specified project application, into a specified environment.
The --env
argument is required.
yarn webiny output {folder} --env {env}
Returns stack output for the specified project application and environment.
Stack output represents all of the values that were exported from project application’s cloud infrastructure code, for the specified environment. For example, in the API project application, in the api/pulumi/dev/index.ts
file, we have the following:
return {
region: process.env.AWS_REGION,
apiUrl: cloudfront.cloudfront.domainName.apply(value => `https://${value}`),
cognitoUserPoolId: cognito.userPool.id,
cognitoAppClientId: cognito.userPoolClient.id,
updatePbSettingsFunction: pageBuilder.functions.updateSettings.arn,
psQueueAdd: prerenderingService.functions.queue.add.arn,
psQueueProcess: prerenderingService.functions.queue.process.arn,
dynamoDbTable: dynamoDb.table.name,
dynamoDbElasticsearchTable: elasticSearch.table.name
};
yarn webiny info --env {env}
Returns useful URLs, for example, the URL over which the deployed GraphQL API can be accessed.
yarn webiny pulumi {folder} --env {env} -- {command}
Provides a way to execute Pulumi specific commands directly via the Pulumi CLI.
yarn webiny ws run {cmd} --folder {f} --scope {s}
Runs provided command, for example the watch
command, across multiple workspaces (packages) in your project. Workspaces are defined via either the --folder
or --scope
argument.
yarn webiny disable-telemetry
Completely disables collection of anonymous usage information.
By default, Webiny collects anonymous usage information, which is exclusively used for improving the product and understanding usage patterns. Please take a look at our Telemetry page for more information on this subject.
FAQ
Do I Need to Install Webiny CLI Manually?
No, Webiny CLI comes set up automatically with every new Webiny project. Note that it’s not installed as a global tool, but on a per-project basis. So, in theory, you could have two projects with different versions of the CLI.
Do I Need to Invoke the Webiny CLI With yarn
?
For the highest chance that everything will work as expected, we recommend you do so. But do note that if you’re using some of the alternative terminals, like for example Zsh , you might even get away without it.