Skip to content

Latest commit

 

History

History
 
 

rerender-pages-command

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Introduction

With this example, we show how you can create a simple rerender-pages Webiny CLI command that does the following:

  1. lists all published pages created via the Page Builder application
  2. visits them and ensures the received HTTP response code is 200
  3. if not 200, then we rerender the page via a custom rerenderPage GraphQL mutation

Create the rerenderPage Mutation

The mutation can be created by simply registering a new GraphQLSchemaPlugin plugin.

Check this file api/code/graphql/src/plugins/rerenderPage.ts to see how it's done. Also, make sure the plugin is imported and registered in api/code/graphql/src/index.ts file.

Further reading: Extend GraphQL API.

Create custom rerender-pages Webiny CLI command

Check this file scripts/rerenderPages.ts to see how it's done. Also, make sure the plugin is imported and registered in the root webiny.project.ts file.

Further reading: Adding Custom Commands.

Usage

Once all of the above is in place, in your terminal of choice, from your project root, simply run the yarn webiny rerender-pages --env {environment} command.

Example Usage