mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-01 20:13:51 +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 MuiDrawer from "@mui/material/Drawer";
|
||||||
import List from "@mui/material/List";
|
import List from "@mui/material/List";
|
||||||
import Divider from "@mui/material/Divider";
|
import Divider from "@mui/material/Divider";
|
||||||
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
||||||
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
||||||
import ListItem from "@mui/material/ListItem";
|
import ListItem from "@mui/material/ListItem";
|
||||||
@ -337,7 +338,11 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
|||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
{!open ? <ChevronRightIcon color="primary" /> : <ChevronLeftIcon color="primary" />}
|
{!open ? <ChevronRightIcon color="primary" /> : <ChevronLeftIcon color="primary" />}
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary={<Typography>Bitburner v{CONSTANTS.VersionString}</Typography>} />
|
<ListItemText primary={
|
||||||
|
<Tooltip title={__COMMIT_HASH__}>
|
||||||
|
<Typography>Bitburner v{CONSTANTS.VersionString}</Typography>
|
||||||
|
</Tooltip>
|
||||||
|
} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<Divider />
|
<Divider />
|
||||||
<List>
|
<List>
|
||||||
|
@ -77,7 +77,7 @@ export class Terminal implements ITerminal {
|
|||||||
commandHistory: string[] = [];
|
commandHistory: string[] = [];
|
||||||
commandHistoryIndex = 0;
|
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
|
// True if a Coding Contract prompt is opened
|
||||||
contractOpen = false;
|
contractOpen = false;
|
||||||
@ -555,7 +555,7 @@ export class Terminal implements ITerminal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clear(): void {
|
clear(): void {
|
||||||
this.outputHistory = [new Output(`Bitburner v${CONSTANTS.VersionString}`, "primary")];
|
this.outputHistory = [new Output(`Bitburner v${CONSTANTS.VersionString} (${__COMMIT_HASH__})`, "primary")];
|
||||||
TerminalEvents.emit();
|
TerminalEvents.emit();
|
||||||
TerminalClearEvents.emit();
|
TerminalClearEvents.emit();
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ export function LoadingScreen(): React.ReactElement {
|
|||||||
<CircularProgress size={150} color="primary" />
|
<CircularProgress size={150} color="primary" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<Typography variant="h3">Loading Bitburner v{CONSTANTS.VersionString}</Typography>
|
<Typography variant="h3">Loading Bitburner v{CONSTANTS.VersionString} ({__COMMIT_HASH__})</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
{show && (
|
{show && (
|
||||||
<Grid item>
|
<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 {
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
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
|
// In dev mode, use a faster method of create sourcemaps
|
||||||
// while keeping lines/columns accurate
|
// while keeping lines/columns accurate
|
||||||
isDevServer &&
|
isDevServer &&
|
||||||
|
Loading…
Reference in New Issue
Block a user