UNPKG

dependency-guardian

Version:

A powerful dependency management and analysis tool for Node.js projects

23 lines (21 loc) 690 B
class UpdateScheduler { async scheduleUpdates() { const cron = require('node-cron'); const schedule = config.get('updates.schedule'); cron.schedule(schedule, async () => { const updates = await this.findAvailableUpdates(); for (const update of updates) { await this.processUpdate(update); } }); } async processUpdate(update) { const result = await this.applyUpdate(update); if (!result.success && config.get('updates.rollbackOnFailure')) { await this.rollback(update); } if (result.success && config.get('updates.createPullRequest')) { await this.createPullRequest(update); } } }