feat: simplify footer informations

This commit is contained in:
wpetit 2023-08-31 22:22:13 -06:00
parent 3fef770522
commit 980f37c4eb
2 changed files with 5 additions and 12 deletions

View File

@ -1,5 +1,6 @@
import React, { FunctionComponent } from "react";
import style from "./style.module.css";
import { formatDate } from "../../util/date";
declare var __BUILD__: any;
@ -8,6 +9,7 @@ export interface FooterProps {
}
const Footer: FunctionComponent<FooterProps> = ({ ...props}) => {
console.log(__BUILD__)
return (
<div className={`container ${style.footer} ${props.class ? props.class : ''}`}>
<div className="columns">
@ -16,9 +18,8 @@ const Footer: FunctionComponent<FooterProps> = ({ ...props}) => {
Propulsé par <a className="has-text-primary" href="https://forge.cadoles.com/wpetit/guesstimate">Guesstimate</a> et publié sous licence <a className="has-text-primary" href="https://www.gnu.org/licenses/agpl-3.0.txt">AGPL-3.0</a>.
</p>
<p className="has-text-right is-size-7">
Version: {__BUILD__.version} -
Réf.: {__BUILD__.gitRef ? __BUILD__.gitRef : '??'} -
Date de construction: {__BUILD__.buildDate ? __BUILD__.buildDate : '??'}
Réf.: {__BUILD__.gitRef ? __BUILD__.gitRef : '??'} |
Date de construction: {__BUILD__.buildDate ? formatDate(__BUILD__.buildDate) : '??'}
</p>
</div>
</div>

View File

@ -11,6 +11,7 @@ module.exports = {
entry: [
path.join(__dirname, './src/index.js')
],
devtool: env.NODE_ENV === 'production' ? 'source-map' : 'eval',
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].[hash].js',
@ -76,7 +77,6 @@ module.exports = {
}),
new webpack.DefinePlugin({
__BUILD__: JSON.stringify({
version: getCurrentVersion(),
gitRef: getCurrentGitRef(),
buildDate: new Date(),
})
@ -84,14 +84,6 @@ module.exports = {
]
};
function getCurrentVersion() {
let version
try {
version = exec("git describe --always 2>/dev/null")
} catch(err) {}
return version ? version : "0.0.0";
}
function getCurrentGitRef() {
return exec("git log -n 1 --pretty='format:%h'").toString()
}