Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Git commit hash on the website #346

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
/packages/*/.env.development.local
/packages/*/.env.test.local
/packages/*/.env.production.local
/packages/demo-wallet-client/src/generated

npm-debug.log*
yarn-debug.log*
Expand Down
7 changes: 4 additions & 3 deletions packages/demo-wallet-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@
},
"scripts": {
"install-if-package-changed": "git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD | grep --quiet yarn.lock && yarn install || exit 0",
"start": "webpack serve --open --config webpack.dev.js",
"build": "NODE_ENV=production webpack --config webpack.prod.js",
"start": "yarn git-info && webpack serve --open --config webpack.dev.js",
"build": "yarn git-info && NODE_ENV=production webpack --config webpack.prod.js",
"prepare": "cd ../../ && husky install packages/demo-wallet-client/.husky",
"pre-commit": "concurrently 'pretty-quick --staged' 'lint-staged' 'tsc --noEmit'"
"pre-commit": "concurrently 'pretty-quick --staged' 'lint-staged' 'tsc --noEmit'",
"git-info": "rm -rf src/generated/ && mkdir src/generated/ && echo \"export const gitInfo = { commitHash: \\\"$(git rev-parse --short HEAD)\\\", version: \\\"$(git describe --tags --always)\\\" };\" > src/generated/gitInfo.ts"
},
"eslintConfig": {
"extends": [
Expand Down
14 changes: 14 additions & 0 deletions packages/demo-wallet-client/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@
right: 0;
overflow: auto;
}

// Commit hash
.Footer__commitHash {
order: -1;
flex: 1;
text-align: center;
font-size: 0.7rem;
line-height: 1rem;
color: var(--pal-text-tertiary);
}

.Layout__rightSide--inline {
flex: 1;
}
}

// Logs
Expand Down
4 changes: 4 additions & 0 deletions packages/demo-wallet-client/src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { TextLink, Layout, Modal } from "@stellar/design-system";
import { ConfigurationModal } from "components/ConfigurationModal";
import { CSS_MODAL_PARENT_ID } from "demo-wallet-shared/build/constants/settings";
import { useRedux } from "hooks/useRedux";
import { gitInfo } from "../generated/gitInfo";

export const Footer = () => {
const [configModalVisible, setConfigModalVisible] = useState(false);
Expand All @@ -19,6 +20,9 @@ export const Footer = () => {
gitHubLink="https://github.com/stellar/stellar-demo-wallet"
hideTopBorder
>
{gitInfo?.commitHash ? (
<div className="Footer__commitHash">{`Commit hash: ${gitInfo.commitHash}`}</div>
) : null}
{account.isAuthenticated && (
<div>
<TextLink onClick={() => setConfigModalVisible(true)}>
Expand Down
Loading