electron/script/generate-version-json.js
Samuel Attard e9cb85bea6
build: add import/order eslint rule (#44106)
build: add import/order eslint rule (#44085)

* build: add import/order eslint rule

* chore: run lint:js --fix
2024-10-02 20:52:01 -07:00

29 lines
628 B
JavaScript

const semver = require('semver');
const fs = require('node:fs');
const outputPath = process.argv[2];
const currentVersion = process.argv[3];
const parsed = semver.parse(currentVersion);
let prerelease = '';
if (parsed.prerelease && parsed.prerelease.length > 0) {
prerelease = parsed.prerelease.join('.');
}
const {
major,
minor,
patch
} = parsed;
fs.writeFileSync(outputPath, JSON.stringify({
full_version: currentVersion,
major,
minor,
patch,
prerelease,
prerelease_number: prerelease ? parsed.prerelease[parsed.prerelease.length - 1] : '0',
has_prerelease: prerelease === '' ? 0 : 1
}, null, 2));