Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 464ef88

Browse files
committedMay 17, 2024·
Add commit sha to version information
1 parent 291d309 commit 464ef88

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed
 

‎.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ module.exports = {
263263
'UserParentalControlPage': 'writable',
264264
'Windows': 'readonly',
265265
// Build time definitions
266+
__COMMIT_SHA__: 'readonly',
266267
__JF_BUILD_VERSION__: 'readonly',
267268
__PACKAGE_JSON_NAME__: 'readonly',
268269
__PACKAGE_JSON_VERSION__: 'readonly',

‎src/controllers/dashboard/dashboard.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,12 @@ function refreshActiveRecordings(view, apiClient) {
208208

209209
function reloadSystemInfo(view, apiClient) {
210210
view.querySelector('#buildVersion').innerText = __JF_BUILD_VERSION__;
211-
view.querySelector('#webVersion').innerText = __PACKAGE_JSON_VERSION__;
211+
212+
let webVersion = __PACKAGE_JSON_VERSION__;
213+
if (__COMMIT_SHA__) {
214+
webVersion += ` (${__COMMIT_SHA__})`;
215+
}
216+
view.querySelector('#webVersion').innerText = webVersion;
212217

213218
queryClient
214219
.fetchQuery(getSystemInfoQuery(toApi(apiClient)))

‎src/global.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export declare global {
1515
'viewshow': CustomEvent;
1616
}
1717

18+
const __COMMIT_SHA__: string;
1819
const __JF_BUILD_VERSION__: string;
1920
const __PACKAGE_JSON_NAME__: string;
2021
const __PACKAGE_JSON_VERSION__: string;

‎src/index.jsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ function loadCoreDictionary() {
6060

6161
function init() {
6262
// Log current version to console to help out with issue triage and debugging
63-
console.log(`${__PACKAGE_JSON_NAME__} version ${__PACKAGE_JSON_VERSION__} build ${__JF_BUILD_VERSION__}`);
63+
console.info(
64+
`[${__PACKAGE_JSON_NAME__}]
65+
version: ${__PACKAGE_JSON_VERSION__}
66+
commit: ${__COMMIT_SHA__}
67+
build: ${__JF_BUILD_VERSION__}`);
6468

6569
// This is used in plugins
6670
window.Events = Events;

‎webpack.common.js

+10
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ const LibarchiveWasm = [
2323
];
2424

2525
const DEV_MODE = process.env.NODE_ENV !== 'production';
26+
let COMMIT_SHA = '';
27+
try {
28+
COMMIT_SHA = require('child_process')
29+
.execSync('git describe --always --dirty')
30+
.toString()
31+
.trim();
32+
} catch (err) {
33+
console.warn('Failed to get commit sha. Is git installed?', err);
34+
}
2635

2736
const NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/;
2837

@@ -48,6 +57,7 @@ const config = {
4857
},
4958
plugins: [
5059
new DefinePlugin({
60+
__COMMIT_SHA__: JSON.stringify(COMMIT_SHA),
5161
__JF_BUILD_VERSION__: JSON.stringify(
5262
process.env.WEBPACK_SERVE ?
5363
'Dev Server' :

0 commit comments

Comments
 (0)
Please sign in to comment.