2017-02-25 21:46:12 +03:00
|
|
|
const fs = require('fs')
|
|
|
|
|
const path = require('path')
|
2017-03-04 23:06:01 +03:00
|
|
|
|
2022-09-01 13:45:23 +01:00
|
|
|
const appjsonpath = path.join(__dirname, 'package.json')
|
2023-06-16 12:54:47 -04:00
|
|
|
const disableUpdatePath = path.join(__dirname, 'src/main', 'disableUpdate.js')
|
2026-02-22 14:30:42 +00:00
|
|
|
const versionPath = path.join(__dirname, 'drawio', 'VERSION')
|
2017-02-25 21:46:12 +03:00
|
|
|
|
2026-02-22 14:30:42 +00:00
|
|
|
if (!fs.existsSync(versionPath))
|
|
|
|
|
{
|
|
|
|
|
console.error('Error: drawio/VERSION not found. Did you clone with --recursive or run git submodule update --init?')
|
|
|
|
|
process.exit(1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let ver = fs.readFileSync(versionPath, 'utf8').trim()
|
2020-12-30 20:01:01 +00:00
|
|
|
//let ver = '14.1.5' // just to test autoupdate
|
2017-02-25 21:46:12 +03:00
|
|
|
|
2026-02-22 14:30:42 +00:00
|
|
|
if (!/^\d+\.\d+\.\d+$/.test(ver))
|
|
|
|
|
{
|
|
|
|
|
console.error('Error: drawio/VERSION contains invalid version: "' + ver + '"')
|
|
|
|
|
process.exit(1)
|
|
|
|
|
}
|
|
|
|
|
|
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')
|
2021-02-23 19:41:06 -05:00
|
|
|
//Enable/disable updates
|
2024-05-17 17:34:22 -04:00
|
|
|
fs.writeFileSync(disableUpdatePath, 'export function disableUpdate() { return ' + (process.argv[2] == 'disableUpdate'? 'true' : 'false') + ';}', 'utf8');
|