48 lines
1.0 KiB
Bash
Executable File
48 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
run_step() {
|
|
local title="$1"
|
|
shift
|
|
|
|
echo
|
|
echo ">>> ${title}"
|
|
"$@"
|
|
}
|
|
|
|
ensure_node_modules() {
|
|
local dir="$1"
|
|
|
|
if [[ -d "$ROOT_DIR/$dir/node_modules" ]]; then
|
|
return 0
|
|
fi
|
|
|
|
local install_cmd="npm install"
|
|
if [[ -f "$ROOT_DIR/$dir/package-lock.json" ]]; then
|
|
install_cmd="npm ci"
|
|
fi
|
|
|
|
echo "Dependencies missing in $dir (node_modules not found). Bootstrapping with: ${install_cmd}"
|
|
run_step "${dir}: ${install_cmd}" bash -lc "cd '$ROOT_DIR/$dir' && ${install_cmd}"
|
|
}
|
|
|
|
run_npm_script() {
|
|
local dir="$1"
|
|
local script="$2"
|
|
|
|
ensure_node_modules "$dir"
|
|
run_step "${dir}: npm run ${script}" bash -lc "cd '$ROOT_DIR/$dir' && npm run ${script}"
|
|
}
|
|
|
|
run_npm_script "Yonexus.Protocol" check
|
|
run_npm_script "Yonexus.Protocol" test
|
|
run_npm_script "Yonexus.Server" check
|
|
run_npm_script "Yonexus.Server" test
|
|
run_npm_script "Yonexus.Client" check
|
|
run_npm_script "Yonexus.Client" test
|
|
|
|
echo
|
|
printf 'Yonexus v1 validation passed.\n'
|