Why?:
If you are using a static site generator like Gridsome (Or Gatsby) with a backend CMS like WordPress, you will need a way to trigger the fetch&&rebuild of new content after update. Using JAMstack Deployments plugin for wordpress and this script you will be able to trigger the rebuild after any update or manually for that matter.
Features:
- runs build in child process
- rate limiter
- build limiter
- logging to file
- logging to Sentry.io
- logrotate
Clone somwhere close to your Gridsome project (ideally next to the project files [not inside!]).
Rename sample.env
to .env
Change TARGET_DIR
to relative directory to your gridsome project (or leave as is)
Install deps:
yarn
yarn run start:dev
Change NODE_ENV
to production
in .env
and run:
yarn run build
yarn run start:prod # or pm2 start dist/main.js --time --watch
Just add your project dsn to .env
You can test the webhook trigger and build using localtunnel like ngork or localtunnel (with lt -h "https://serverless.social" -p 3333
command)
You can change the build command in app.service
to run any desired build command.