mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-27 00:17:32 +01:00
Merge pull request #1952 from MartinFournier/feature/git-commit-version
Fix #1880: Show git commit of bundled app
This commit is contained in:
commit
55d386a504
2
src/@types/global.d.ts
vendored
Normal file
2
src/@types/global.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
// Defined by webpack on startup or compilation
|
||||
declare const __COMMIT_HASH__: string;
|
@ -6,6 +6,7 @@ import makeStyles from "@mui/styles/makeStyles";
|
||||
import MuiDrawer from "@mui/material/Drawer";
|
||||
import List from "@mui/material/List";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
||||
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
||||
import ListItem from "@mui/material/ListItem";
|
||||
@ -337,7 +338,11 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
<ListItemIcon>
|
||||
{!open ? <ChevronRightIcon color="primary" /> : <ChevronLeftIcon color="primary" />}
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={<Typography>Bitburner v{CONSTANTS.VersionString}</Typography>} />
|
||||
<ListItemText primary={
|
||||
<Tooltip title={__COMMIT_HASH__}>
|
||||
<Typography>Bitburner v{CONSTANTS.VersionString}</Typography>
|
||||
</Tooltip>
|
||||
} />
|
||||
</ListItem>
|
||||
<Divider />
|
||||
<List>
|
||||
|
@ -77,7 +77,7 @@ export class Terminal implements ITerminal {
|
||||
commandHistory: string[] = [];
|
||||
commandHistoryIndex = 0;
|
||||
|
||||
outputHistory: (Output | Link | RawOutput)[] = [new Output(`Bitburner v${CONSTANTS.VersionString}`, "primary")];
|
||||
outputHistory: (Output | Link | RawOutput)[] = [new Output(`Bitburner v${CONSTANTS.VersionString} (${__COMMIT_HASH__})`, "primary")];
|
||||
|
||||
// True if a Coding Contract prompt is opened
|
||||
contractOpen = false;
|
||||
@ -555,7 +555,7 @@ export class Terminal implements ITerminal {
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.outputHistory = [new Output(`Bitburner v${CONSTANTS.VersionString}`, "primary")];
|
||||
this.outputHistory = [new Output(`Bitburner v${CONSTANTS.VersionString} (${__COMMIT_HASH__})`, "primary")];
|
||||
TerminalEvents.emit();
|
||||
TerminalClearEvents.emit();
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ export function LoadingScreen(): React.ReactElement {
|
||||
<CircularProgress size={150} color="primary" />
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Typography variant="h3">Loading Bitburner v{CONSTANTS.VersionString}</Typography>
|
||||
<Typography variant="h3">Loading Bitburner v{CONSTANTS.VersionString} ({__COMMIT_HASH__})</Typography>
|
||||
</Grid>
|
||||
{show && (
|
||||
<Grid item>
|
||||
|
@ -42,6 +42,13 @@ module.exports = (env, argv) => {
|
||||
};
|
||||
}
|
||||
|
||||
// Get the current commit hash to inject into the app
|
||||
// https://stackoverflow.com/a/38401256
|
||||
const commitHash = require('child_process')
|
||||
.execSync('git rev-parse --short HEAD')
|
||||
.toString()
|
||||
.trim();
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
@ -105,6 +112,9 @@ module.exports = (env, argv) => {
|
||||
},
|
||||
},
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
__COMMIT_HASH__: JSON.stringify(commitHash)
|
||||
}),
|
||||
// In dev mode, use a faster method of create sourcemaps
|
||||
// while keeping lines/columns accurate
|
||||
isDevServer &&
|
||||
|
Loading…
Reference in New Issue
Block a user