drawio-desktop/sync.js

21 lines
878 B
JavaScript
Raw Normal View History

2017-02-25 21:46:12 +03:00
const fs = require('fs')
const path = require('path')
2017-03-04 23:06:01 +03:00
const child_process = require('child_process')
2018-01-23 20:12:11 +00:00
const electronAppDir = path.join(__dirname, 'drawio', 'src/main/webapp')
const appjsonpath = path.join(__dirname, 'drawio', 'src/main/webapp', 'package.json')
2019-08-21 11:19:53 -04:00
const disableUpdatePath = path.join(__dirname, 'drawio', 'src/main/webapp', 'disableUpdate.js')
2017-02-25 21:46:12 +03:00
2020-12-30 20:01:01 +00:00
let ver = fs.readFileSync(path.join(__dirname, 'drawio', 'VERSION'), 'utf8')
//let ver = '14.1.5' // just to test autoupdate
2017-02-25 21:46:12 +03:00
let pj = require(appjsonpath)
pj.version = ver
2017-05-28 20:56:47 +03:00
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');
2019-08-21 11:19:53 -04:00
2017-05-28 20:56:47 +03:00
child_process.spawnSync('yarn', ['install', '--production'], {cwd: electronAppDir})