2019-06-20 00:31:55 +03:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
const semver = require('semver');
|
|
|
|
|
|
|
|
const outputPath = process.argv[2];
|
2022-10-25 09:44:43 +03:00
|
|
|
const currentVersion = process.argv[3];
|
2019-06-20 00:31:55 +03:00
|
|
|
|
|
|
|
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({
|
2022-10-25 09:44:43 +03:00
|
|
|
full_version: currentVersion,
|
2019-06-20 00:31:55 +03:00
|
|
|
major,
|
|
|
|
minor,
|
|
|
|
patch,
|
|
|
|
prerelease,
|
2022-10-25 09:44:43 +03:00
|
|
|
prerelease_number: prerelease ? parsed.prerelease[parsed.prerelease.length - 1] : '0',
|
2019-06-20 00:31:55 +03:00
|
|
|
has_prerelease: prerelease === '' ? 0 : 1
|
|
|
|
}, null, 2));
|