Skip to content

Commit

Permalink
Update version number to include commit SHA
Browse files Browse the repository at this point in the history
  • Loading branch information
afterdusk committed Apr 25, 2021
1 parent d8b13dd commit b1a473d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"env": "REACT_APP_VERSION=$npm_package_version REACT_APP_GIT_SHA=`git rev-parse --short HEAD`",
"start": "yarn run env react-scripts start",
"build": "yarn run env react-scripts build",
"test": "yarn run env react-scripts test",
"eject": "react-scripts eject",
"pretty": "prettier --write",
"lint": "eslint --fix",
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
name="description"
content="Floating-point converter for FP32, FP64, FP16, bfloat16 and TensorFloat-32"
/>
<meta name="ui-version" content="%REACT_APP_GIT_SHA%">
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
Expand Down
17 changes: 11 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Footer = styled.footer`
font-size: 1rem;
`;

const VersionNumber = styled.p`
const VersionNumber = styled.div`
font-size: 1.4rem;
`;

Expand All @@ -60,7 +60,7 @@ type TextWithLinkProps = {
url: string;
};

const FooterTextWithLink: FC<TextWithLinkProps> = (
const TextWithLink: FC<TextWithLinkProps> = (
props: TextWithLinkProps
): ReactElement => (
<Text>
Expand All @@ -86,16 +86,21 @@ const App: FC = (): ReactElement => {
<Format {...Constants.TF32} />
<Divider />
<Footer>
<VersionNumber>{"Version " + Constants.VERSION_NUMBER}</VersionNumber>
<FooterTextWithLink
<VersionNumber>
<TextWithLink
{...Constants.BUILD_SOURCE_TEXT}
url={Constants.BUILD_SOURCE_URL}
/>
</VersionNumber>
<TextWithLink
{...Constants.UI_ACKNOWLEDGEMENT_TEXT}
url={Constants.UI_ACKNOWLEDGEMENT_URL}
/>
<FooterTextWithLink
<TextWithLink
{...Constants.BIGNUM_ACKNOWLEDGEMENT_TEXT}
url={Constants.BIGNUM_ACKNOWLEDGEMENT_URL}
/>
<FooterTextWithLink
<TextWithLink
{...Constants.ISSUES_CONTRIBUTION_TEXT}
url={Constants.ISSUES_CONTRIBUTION_URL}
/>
Expand Down
7 changes: 6 additions & 1 deletion src/Constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// app
export const VERSION_NUMBER = "0.0";
export const APP_TITLE = "IEEE 754-Style Floating-Point Converter";
export const POSITIVE_INFINITY_STRING = "infinity";
export const NEGATIVE_INFINITY_STRING = "-infinity";
Expand All @@ -25,6 +24,12 @@ export const ISSUES_CONTRIBUTION_TEXT = {
link: "GitHub repo",
post: ". Contributions are also welcome 😊",
};
export const BUILD_SOURCE_URL = `https://github.com/afterdusk/flop/tree/${process.env.REACT_APP_GIT_SHA}`;
export const BUILD_SOURCE_TEXT = {
pre: `Version ${process.env.REACT_APP_VERSION}, Build `,
link: `${process.env.REACT_APP_GIT_SHA}`,
post: "",
};

// styling
export const BACKGROUND_COLOR = "#0e171c";
Expand Down

0 comments on commit b1a473d

Please sign in to comment.