Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { spawn } = require('child_process');
- const watch = require('node-watch');
- let commandComplete = true;
- watch([
- './src',
- 'graphcool.yml',
- 'types.graphql'
- ], { recursive: true }, function(evt, name) {
- if (!commandComplete) {
- // Do not run until last deploy has finished
- return;
- }
- commandComplete = false
- console.log('%s changed.', name);
- // Run command to rebuild
- const ls = spawn('graphcool', ['deploy'], {
- stdio: 'inherit'
- });
- ls.on('exit', function (code) {
- commandComplete = true
- });
- });
Add Comment
Please, Sign In to add comment