Guest User

Untitled

a guest
Jun 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. const { spawn } = require('child_process');
  2. const watch = require('node-watch');
  3.  
  4. let commandComplete = true;
  5. watch([
  6. './src',
  7. 'graphcool.yml',
  8. 'types.graphql'
  9. ], { recursive: true }, function(evt, name) {
  10. if (!commandComplete) {
  11. // Do not run until last deploy has finished
  12. return;
  13. }
  14. commandComplete = false
  15.  
  16. console.log('%s changed.', name);
  17.  
  18. // Run command to rebuild
  19. const ls = spawn('graphcool', ['deploy'], {
  20. stdio: 'inherit'
  21. });
  22.  
  23. ls.on('exit', function (code) {
  24. commandComplete = true
  25. });
  26. });
Add Comment
Please, Sign In to add comment