aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rwxr-xr-xpackages/anastasis-webui/clean_and_build.sh15
-rw-r--r--packages/anastasis-webui/package.json4
-rw-r--r--packages/anastasis-webui/src/components/menu/NavigationBar.tsx4
-rw-r--r--packages/anastasis-webui/src/components/menu/SideBar.tsx6
4 files changed, 18 insertions, 11 deletions
diff --git a/packages/anastasis-webui/clean_and_build.sh b/packages/anastasis-webui/clean_and_build.sh
index 25e7bd998..dd8d0d196 100755
--- a/packages/anastasis-webui/clean_and_build.sh
+++ b/packages/anastasis-webui/clean_and_build.sh
@@ -10,14 +10,17 @@ cp \
src/scss/fonts/materialdesignicons-webfont-4.9.95.woff2 \
dist/fonts
+VERSION=$(jq -r .version package.json)
+GIT_HASH=$(git rev-parse --short HEAD)
+
function build_css() {
pnpm exec sass -I . ./src/scss/main.scss dist/main.css
}
function build_js() {
- pnpm exec esbuild --log-level=error --bundle $1 --outdir=dist --target=es6 --loader:.svg=dataurl --format=iife --sourcemap --jsx-factory=h --jsx-fragment=Fragment --platform=browser
+ pnpm exec esbuild --log-level=error --define:process.env.__VERSION__=\"${VERSION}\" --define:process.env.__GIT_HASH__=\"${GIT_HASH}\" --bundle $1 --outdir=dist --target=es6 --loader:.svg=dataurl --format=iife --sourcemap --jsx-factory=h --jsx-fragment=Fragment --platform=browser --minify
}
-function bundle() {
+function bundle_html() {
cat html/$1.html \
| sed -e '/ANASTASIS_SCRIPT_CONTENT/ {' -e 'r dist/main.js' -e 'd' -e '}' \
| sed -e '/ANASTASIS_STYLE_CONTENT/ {' -e 'r dist/main.css' -e 'd' -e '}' \
@@ -27,12 +30,13 @@ function bundle() {
function cleanup {
trap - SIGHUP SIGINT SIGTERM SIGQUIT
echo -n "Cleaning up... "
+ wait
kill -- -$$
exit 1
}
trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT
-
+set -e
echo compile
build_css &
build_js src/main.ts &
@@ -45,9 +49,8 @@ wait -n
pnpm run --silent test -- -R dot
echo html
-bundle ui
-bundle ui-dev
-
+bundle_html ui
+bundle_html ui-dev
if [ "WATCH" == "$1" ]; then
diff --git a/packages/anastasis-webui/package.json b/packages/anastasis-webui/package.json
index 949440bc7..df50a8a8c 100644
--- a/packages/anastasis-webui/package.json
+++ b/packages/anastasis-webui/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@gnu-taler/anastasis-webui",
- "version": "0.0.2",
+ "version": "0.2.99",
"license": "MIT",
"scripts": {
"build": "./clean_and_build.sh",
@@ -49,4 +49,4 @@
"typescript": "^4.5.4",
"ws": "7.4.5"
}
-} \ No newline at end of file
+}
diff --git a/packages/anastasis-webui/src/components/menu/NavigationBar.tsx b/packages/anastasis-webui/src/components/menu/NavigationBar.tsx
index ca5191da7..42b7a23e2 100644
--- a/packages/anastasis-webui/src/components/menu/NavigationBar.tsx
+++ b/packages/anastasis-webui/src/components/menu/NavigationBar.tsx
@@ -49,14 +49,14 @@ export function NavigationBar({ onMobileMenu, title }: Props): VNode {
>
Report a bug
</a>
- <a
+ {/* <a
style={{
alignSelf: "center",
padding: "0.5em",
}}
>
Settings
- </a>
+ </a> */}
{/* <a
role="button"
class="navbar-burger"
diff --git a/packages/anastasis-webui/src/components/menu/SideBar.tsx b/packages/anastasis-webui/src/components/menu/SideBar.tsx
index 45d447d3c..7cc65a62d 100644
--- a/packages/anastasis-webui/src/components/menu/SideBar.tsx
+++ b/packages/anastasis-webui/src/components/menu/SideBar.tsx
@@ -28,6 +28,10 @@ interface Props {
mobile?: boolean;
}
+const VERSION: string = process.env.__VERSION__ || "dev";
+const GIT_HASH: string | undefined = process.env.__GIT_HASH__;
+const VERSION_WITH_HASH = GIT_HASH ? `${VERSION}-${GIT_HASH}` : VERSION;
+
export function Sidebar({ mobile }: Props): VNode {
// const config = useConfigContext();
const config = { version: "none" };
@@ -57,7 +61,7 @@ export function Sidebar({ mobile }: Props): VNode {
class="is-size-7 has-text-right"
style={{ lineHeight: 0, marginTop: -10 }}
>
- Version {process.env.__VERSION__} ({config.version})
+ Version {VERSION_WITH_HASH}
</div>
</div>
</div>