There are two files you'll find in your project that are important for Webiny:
This file is always located in your project's root and is unique. Our CLI relies on this file to find the project root when you run it from project folders that are not root.
template - this property contains the name and version of the project template you used to bootstrap your project. It may not be very important to you at this point, but it will help us to provide you with migration tools and other support in the future.
projectName - generated using your project folder name. This one is used to name resources during deployment of infrastructure to the cloud. It will help you to look for specific resources in AWS Console.
- plugins - an array of CLI plugins. You can easily add your own CLI plugins here to expand the Webiny CLI capabilities.
Here's what this file may look like in your project:
You will find this file in each package that represents an app or an API resource. In this file we define:
- commands - arbitrary functions to be executed by
yarn webiny run [command]
In the future, we may add more features in here, but for now it's just
This file gives you a way to create your own commands to handle your code, by writing simple functions. We provide a lot of utility functions in our
@webiny/project-utils package for you to use for bundling apps, functions, etc. A good example is found in
apps/admin/webiny.config.js. The example below shows a simplified version of the aforementioned file:
With this you defined a
webiny.config.js file and 2 commands:
build. The most common way to run them is by adding a script to your
package.json located right next to the
You can also run the command by calling
yarn webiny run [name].
Every command you define will have the same parameters,
- options - is an object containing input parameters parsed by yargs which we use under the hood for our CLI. By running
yarn webiny run myCommand --custom=value,
yargswill parse that command and your
customparameter will be accessible via the
- context - this is a
Contextobject provided by Webiny CLI. It contains helper methods, plugins and other useful information constructed at runtime.