mirror of
https://github.com/revoltchat/revite.git
synced 2025-04-21 15:57:38 -05:00
More version information in settings.
This commit is contained in:
parent
29bb93f399
commit
8845900779
3 changed files with 23 additions and 3 deletions
|
@ -19,6 +19,20 @@ function getGitRevision() {
|
|||
}
|
||||
}
|
||||
|
||||
function getGitBranch() {
|
||||
try {
|
||||
const rev = readFileSync('.git/HEAD').toString().trim();
|
||||
if (rev.indexOf(':') === -1) {
|
||||
return 'DETACHED';
|
||||
} else {
|
||||
return rev.split('/').pop();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to get Git branch.');
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
|
||||
function getVersion() {
|
||||
return readFileSync('VERSION').toString();
|
||||
}
|
||||
|
@ -55,6 +69,7 @@ export default defineConfig({
|
|||
}),
|
||||
replace({
|
||||
__GIT_REVISION__: getGitRevision(),
|
||||
__GIT_BRANCH__: getGitBranch(),
|
||||
__APP_VERSION__: getVersion(),
|
||||
preventAssignment: true
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue