aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-11-14 00:14:27 -0300
committerSebastian <sebasjm@gmail.com>2023-11-14 00:14:27 -0300
commitfeddec9b5493d01cdfd07f6aa8073cb14cb1a0ab (patch)
treef4f7c4a3f1e5383abcef07ce85ad08017233efbc
parentcd87d4c0b78525d428b10011446b6f510f9f6736 (diff)
build challenger
-rw-r--r--Makefile6
-rwxr-xr-xcontrib/copy-challenger-into-prebuilt.sh10
-rwxr-xr-xpackages/challenger-ui/build.mjs40
-rwxr-xr-xpackages/challenger-ui/create_must.sh15
-rw-r--r--packages/challenger-ui/package.json4
5 files changed, 73 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index e4a7abb54..3357747b9 100644
--- a/Makefile
+++ b/Makefile
@@ -60,6 +60,12 @@ aml-backoffice-prebuilt:
pnpm run --filter @gnu-taler/aml-backoffice-ui... build
./contrib/copy-aml-backoffice-into-prebuilt.sh
+.PHONY: challenger-prebuilt
+challenger-prebuilt:
+ pnpm install --frozen-lockfile --filter @gnu-taler/challenger-ui...
+ pnpm run --filter @gnu-taler/challenger-ui... build
+ ./contrib/copy-challenger-into-prebuilt.sh
+
.PHONY: demobank-prebuilt
demobank-prebuilt:
pnpm install --frozen-lockfile --filter @gnu-taler/demobank-ui...
diff --git a/contrib/copy-challenger-into-prebuilt.sh b/contrib/copy-challenger-into-prebuilt.sh
new file mode 100755
index 000000000..ebc39192c
--- /dev/null
+++ b/contrib/copy-challenger-into-prebuilt.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+[ ! -d prebuilt ] && git worktree add -f prebuilt prebuilt && exit 1
+
+find packages/challenger-ui/dist/prod/ -type f -printf '%P\n' | sort > prebuilt/challenger/bof
+
+while IFS= read -r file; do
+ cp packages/challenger-ui/dist/prod/$file prebuilt/challenger/$file
+done < prebuilt/challenger/bof
+
diff --git a/packages/challenger-ui/build.mjs b/packages/challenger-ui/build.mjs
new file mode 100755
index 000000000..548afe2e4
--- /dev/null
+++ b/packages/challenger-ui/build.mjs
@@ -0,0 +1,40 @@
+#!/usr/bin/env node
+/*
+ This file is part of GNU Taler
+ (C) 2022 Taler Systems S.A.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+import { build } from "@gnu-taler/web-util/build";
+
+await build({
+ type: "production",
+ source: {
+ js: ["src/main.js"],
+ assets: [{
+ base: "src",
+ files: [
+ "src/attempts-exhausted.html",
+ "src/enter-address-form.html",
+ "src/enter-tan-form.html",
+ "src/internal-error.html",
+ "src/invalid-pin.html",
+ "src/invalid-request.html",
+ "src/validation-unknown.html",
+ ]
+ }],
+ },
+ destination: "./dist/prod",
+ css: "postcss",
+});
+
diff --git a/packages/challenger-ui/create_must.sh b/packages/challenger-ui/create_must.sh
new file mode 100755
index 000000000..6a6c71719
--- /dev/null
+++ b/packages/challenger-ui/create_must.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+cd dist/prod
+for file in *.html; do
+
+ #remove the js reference used for dev
+ sed /main.js/d -i $file
+
+ #rename the extension to must template
+ mv $file ${file:0:-5}.must
+done
+
+#delete unsued files
+rm main.js main.js.map main.css.map
+
diff --git a/packages/challenger-ui/package.json b/packages/challenger-ui/package.json
index bfac108a7..e797b12db 100644
--- a/packages/challenger-ui/package.json
+++ b/packages/challenger-ui/package.json
@@ -7,7 +7,7 @@
"description": "UI for GNU Challenger.",
"type": "module",
"scripts": {
- "build": "./build.mjs",
+ "build": "./build.mjs && ./create_must.sh",
"check": "tsc",
"clean": "rm -rf dist lib",
"i18n:extract": "pogen extract",
@@ -45,4 +45,4 @@
"pogen": {
"domain": "aml-backoffice"
}
-} \ No newline at end of file
+}