forked from jgraph/drawio-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sync.js
20 lines (14 loc) · 878 Bytes
/
sync.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const fs = require('fs')
const path = require('path')
const child_process = require('child_process')
const electronAppDir = path.join(__dirname, 'drawio', 'src/main/webapp')
const appjsonpath = path.join(__dirname, 'drawio', 'src/main/webapp', 'package.json')
const disableUpdatePath = path.join(__dirname, 'drawio', 'src/main/webapp', 'disableUpdate.js')
let ver = fs.readFileSync(path.join(__dirname, 'drawio', 'VERSION'), 'utf8')
//let ver = '14.1.5' // just to test autoupdate
let pj = require(appjsonpath)
pj.version = ver
fs.writeFileSync(appjsonpath, JSON.stringify(pj, null, 2), 'utf8')
//Enable/disable updates
fs.writeFileSync(disableUpdatePath, 'module.exports = { disableUpdate: function() { return ' + (process.argv[2] == 'disableUpdate'? 'true' : 'false') + ';}}', 'utf8');
child_process.spawnSync('yarn', ['install', '--production'], {cwd: electronAppDir})