-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsync.js
34 lines (27 loc) · 941 Bytes
/
sync.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
31
32
33
34
const fs = require('fs')
const path = require('path')
const child_process = require('child_process')
const electronAppDir = path.join(__dirname, 'app')
const appjsonpath = path.join(electronAppDir, 'package.json')
try {
let ver = fs.readFileSync(path.join(__dirname, 'draw.io', 'VERSION'), 'utf8')
// let ver = '7.2.3' // just to test autoupdate
let pj = require(appjsonpath)
pj.version = ver
fs.writeFileSync(appjsonpath, JSON.stringify(pj, null, 2), 'utf8')
console.log(`App version successfully updated: ${ver}`)
} catch (err) {
console.error(`Problem updating app version`, err)
}
const res = child_process.spawnSync('yarn', ['install', '--production'], {
cwd: electronAppDir,
stdio: 'pipe',
shell: true,
})
console.log(`App dir: ${electronAppDir}`)
if (res.error) {
console.error('sub:', res.stderr && res.stderr.toString())
} else {
console.log('sub:', res.stdout && res.stdout.toString())
}
process.exit(res.status)