Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

check.js 780B

12345678910111213141516171819202122232425262728
  1. /* eslint-disable unicorn/no-process-exit */
  2. 'use strict';
  3. let updateNotifier = require('.');
  4. const options = JSON.parse(process.argv[2]);
  5. updateNotifier = new updateNotifier.UpdateNotifier(options);
  6. (async () => {
  7. // Exit process when offline
  8. setTimeout(process.exit, 1000 * 30);
  9. const update = await updateNotifier.fetchInfo();
  10. // Only update the last update check time on success
  11. updateNotifier.config.set('lastUpdateCheck', Date.now());
  12. if (update.type && update.type !== 'latest') {
  13. updateNotifier.config.set('update', update);
  14. }
  15. // Call process exit explicitly to terminate the child process,
  16. // otherwise the child process will run forever, according to the Node.js docs
  17. process.exit();
  18. })().catch(error => {
  19. console.error(error);
  20. process.exit(1);
  21. });