7ca2bb5f9c
* build: determine electron version from tags not files * build: make electron_version dependent on packed-refs and git HEAD * build: do not delete electron/.git * build: do not revert a commit we didn't make * build: gen version file instead of just writing it * build: update cache and ninja targets * build: copy resource.h to generated electron.rc * build: electron_win32_resources should be public deps * build: also copy the icon
29 lines
652 B
JavaScript
29 lines
652 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const semver = require('semver');
|
|
|
|
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));
|