32 lines
820 B
Bash
Executable File
32 lines
820 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Fail fast
|
|
set -euo pipefail
|
|
|
|
# Root directory (dir where the script lives, then go up)
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
SOURCE_DIR="$ROOT_DIR/modules"
|
|
TARGET_DIR="$ROOT_DIR/apps/server/dist/templates"
|
|
|
|
echo "[build-templates] Root: $ROOT_DIR"
|
|
echo "[build-templates] Source: $SOURCE_DIR"
|
|
echo "[build-templates] Target: $TARGET_DIR"
|
|
|
|
# Ensure target directory exists and is empty
|
|
rm -rf "$TARGET_DIR"
|
|
mkdir -p "$TARGET_DIR"
|
|
|
|
# Loop through each package
|
|
for module in "$SOURCE_DIR"/*; do
|
|
if [ -d "$module/templates" ]; then
|
|
module_name=$(basename "$module")
|
|
echo "→ Copying templates for module: $module_name"
|
|
|
|
mkdir -p "$TARGET_DIR/$module_name"
|
|
cp -R "$module/templates/." "$TARGET_DIR/$module_name/"
|
|
fi
|
|
done
|
|
|
|
echo "[build-templates] Completed."
|