forked from minbrowser/min
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwatch.js
30 lines (24 loc) · 795 Bytes
/
watch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const chokidar = require('chokidar')
const path = require('path')
const mainDir = path.resolve(__dirname, '../main')
const jsDir = path.resolve(__dirname, '../js')
const preloadDir = path.resolve(__dirname, '../js/preload')
const buildMain = require('./buildMain.js')
const buildBrowser = require('./buildBrowser.js')
const buildPreload = require('./buildPreload.js')
// rebuild everything on startup
buildMain()
buildBrowser()
buildPreload()
chokidar.watch(mainDir).on('change', function () {
console.log('rebuilding main')
buildMain()
})
chokidar.watch(jsDir, {ignored: preloadDir}).on('change', function () {
console.log('rebuilding browser')
buildBrowser()
})
chokidar.watch(preloadDir).on('change', function () {
console.log('rebuilding preload script')
buildPreload()
})