4in1_ws_web/deploy/util/build_js.sh
2025-05-15 04:51:23 +03:00

29 lines
581 B
Bash
Executable File

#!/bin/sh
DIR=$(cd "$(dirname "$(readlink -f "$0")")" && pwd)
. "$DIR/build_common.sh"
# suckless version of webpack
# watch and learn, bitches!
build_chunk() {
name="$1"
output="$OUTDIR/$name.js"
not_first=0
for file in "$INDIR/$name"/*.js; do
# insert newline before out comment
[ "$not_first" = "1" ] && echo "" >> "$output"
echo "/* $(basename "$file") */" >> "$output"
cat "$file" >> "$output"
not_first=1
done
}
TARGETS="common admin"
input_args "$@"
check_args
for f in $TARGETS; do
build_chunk "$f"
done