diff --git a/.gitignore b/.gitignore index 2940f9c1..9c3f3171 100644 --- a/.gitignore +++ b/.gitignore @@ -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* diff --git a/packages/demo-wallet-client/package.json b/packages/demo-wallet-client/package.json index e6876407..1686ce0c 100644 --- a/packages/demo-wallet-client/package.json +++ b/packages/demo-wallet-client/package.json @@ -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": [ diff --git a/packages/demo-wallet-client/src/App.scss b/packages/demo-wallet-client/src/App.scss index 50d5a5b2..ae594a5b 100644 --- a/packages/demo-wallet-client/src/App.scss +++ b/packages/demo-wallet-client/src/App.scss @@ -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 diff --git a/packages/demo-wallet-client/src/components/Footer.tsx b/packages/demo-wallet-client/src/components/Footer.tsx index 4bfb489f..8f540d94 100644 --- a/packages/demo-wallet-client/src/components/Footer.tsx +++ b/packages/demo-wallet-client/src/components/Footer.tsx @@ -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); @@ -19,6 +20,9 @@ export const Footer = () => { gitHubLink="https://github.com/stellar/stellar-demo-wallet" hideTopBorder > + {gitInfo?.commitHash ? ( +
{`Commit hash: ${gitInfo.commitHash}`}
+ ) : null} {account.isAuthenticated && (
setConfigModalVisible(true)}>