strapi-plugin-website-builder
Version:
A plugin for Strapi Headless CMS that provides the ability to trigger website builds manually, periodically or through model events.
22 lines (18 loc) • 400 B
JavaScript
;
const { getService } = require('../utils/common');
function bootstrapCron({ strapi, build }) {
// create cron check
strapi.cron.add({
[build.name]: {
options: {
rule: build.trigger.expression,
},
task: () => {
getService({ strapi, name: 'build' }).trigger({ name: build.name, trigger: { type: 'cron' } });
},
},
});
}
module.exports = {
bootstrapCron,
};