Skip to content

Instantly share code, notes, and snippets.

@tehpsalmist
Last active September 12, 2018 02:14
Show Gist options
  • Save tehpsalmist/fee4b6b5d22ec366381092f7b47b88db to your computer and use it in GitHub Desktop.
Save tehpsalmist/fee4b6b5d22ec366381092f7b47b88db to your computer and use it in GitHub Desktop.
const chokidar = require('chokidar')
const { exec } = require('child_process')
const frontend = chokidar.watch([
'./plugins/**/*',
'./maya.json'
], { ignored: ['./plugins/*/node_modules', './plugins/*/build/**.*'] })
frontend.on('ready', () => console.log('I am at your service, my liege.'))
frontend.on('change', (path) => {
console.log('redeploying')
exec('mayan deploy --frontend', { shell: '/bin/zsh' }, (err, stdout, stderr) => {
if (err) console.error('err:', err)
if (stdout) console.log('stdout:', stdout)
if (stderr) console.error('stderr:', stderr)
if (!err && !stderr) console.log('Successfully Deployed at', new Date().toLocaleString())
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment