-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathgulpfile.js
More file actions
40 lines (37 loc) Β· 799 Bytes
/
gulpfile.js
File metadata and controls
40 lines (37 loc) Β· 799 Bytes
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
31
32
33
34
35
36
37
38
39
40
const spawn = require('child_process').spawn
const { watch } = require('gulp')
var p
const SRC_FILES = [
'./src/main/*.js',
'./src/main/windows/*.js',
'./src/main/lib/*.js'
]
const ELECTRON = __dirname + '/node_modules/.bin/electron'
const DEBUG = false
let args = ['.']
// Start the electron process.
async function electron () {
// kill previous spawned process
if (p) {
p.kill()
}
if (DEBUG) args.unshift('--inspect=5858')
// `spawn` a child `gulp` process linked to the parent `stdio`
p = await spawn(ELECTRON, args, {
stdio: 'inherit',
env: {
...process.env,
DEBUG: 'simple-peer'
}
})
}
exports.default = () => {
watch(
SRC_FILES,
{
queue: false,
ignoreInitial: false // Execute task on startup
},
electron
)
}