2021-08-11 21:41:29 +00:00
|
|
|
import * as child_process from 'child_process';
|
2017-12-24 02:45:34 +00:00
|
|
|
|
|
|
|
let version = "Unknown";
|
2018-03-30 22:34:39 +00:00
|
|
|
let gitHash = null;
|
2017-12-24 02:45:34 +00:00
|
|
|
|
|
|
|
try {
|
2021-08-11 21:41:29 +00:00
|
|
|
version = "v" + require("../package.json").version;
|
2017-12-24 02:45:34 +00:00
|
|
|
} catch (error) {
|
2018-03-30 22:34:39 +00:00
|
|
|
// The log service isn't set up by the time we require this file
|
|
|
|
console.error("version", error);
|
2017-12-24 02:45:34 +00:00
|
|
|
}
|
|
|
|
|
2018-03-30 22:34:39 +00:00
|
|
|
try {
|
2021-08-11 21:41:29 +00:00
|
|
|
gitHash = child_process
|
2021-09-01 23:01:01 +00:00
|
|
|
.execSync('git rev-parse --short HEAD')
|
|
|
|
.toString().trim()
|
2018-03-30 22:34:39 +00:00
|
|
|
} catch (error) {
|
|
|
|
// The log service isn't set up by the time we require this file
|
|
|
|
console.error("version", error);
|
|
|
|
}
|
|
|
|
|
|
|
|
export const CURRENT_VERSION = version + (gitHash ? "-" + gitHash : "");
|