Merge pull request #5 from PR0M3TH3AN/codex/update-shell-scripts-for-error-handling

Improve dependency checks for flyer scripts
This commit is contained in:
thePR0M3TH3AN
2025-06-17 19:03:17 -04:00
committed by GitHub
3 changed files with 38 additions and 4 deletions

View File

@@ -1,6 +1,17 @@
#!/bin/bash #!/bin/bash
set -e set -euo pipefail
require_cmd() {
command -v "$1" >/dev/null 2>&1 || {
echo "Error: required command '$1' not found" >&2
exit 1
}
}
for cmd in jq node javascript-obfuscator html-minifier-terser; do
require_cmd "$cmd"
done
CONFIG_PATH="src/config.json" CONFIG_PATH="src/config.json"
FROM_PDF="" FROM_PDF=""
@@ -32,9 +43,6 @@ while [[ $# -gt 0 ]]; do
esac esac
done done
# Ensure jq is installed
command -v jq >/dev/null 2>&1 || { echo "jq is required" >&2; exit 1; }
# Helper function to update config # Helper function to update config
update_config_interactive() { update_config_interactive() {
read -rp "Name: " name read -rp "Name: " name

View File

@@ -1,5 +1,18 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
require_cmd() {
command -v "$1" >/dev/null 2>&1 || {
echo "Error: required command '$1' not found" >&2
exit 1
}
}
for cmd in javascript-obfuscator html-minifier-terser node; do
require_cmd "$cmd"
done
# Input and output file names # Input and output file names
input_file="index-master.html" input_file="index-master.html"
output_file="index.html" output_file="index.html"

View File

@@ -1,5 +1,18 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
require_cmd() {
command -v "$1" >/dev/null 2>&1 || {
echo "Error: required command '$1' not found" >&2
exit 1
}
}
for cmd in javascript-obfuscator html-minifier-terser node; do
require_cmd "$cmd"
done
# Input and output file names # Input and output file names
input_file="nostr-master.html" input_file="nostr-master.html"
output_file="nostr.html" output_file="nostr.html"