diff --git a/scripts/build.sh b/scripts/build.sh index 7ada6b3..2adce83 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -15,6 +15,24 @@ report() { echo "=== verstak-sdk build ===" +# ── Dependency checks ── +echo "[deps]" +if ! command -v node &>/dev/null; then + echo " ❌ node: not found" + FAILED=1 +else + echo " ✅ node $(node --version)" +fi +if ! command -v npm &>/dev/null; then + echo " ❌ npm: not found" + FAILED=1 +fi +if [ "$FAILED" -ne 0 ]; then + echo "" + echo "❌ build failed — missing core dependencies" + exit 1 +fi + # Install dependencies if needed if [ ! -d "$ROOT/node_modules" ]; then if [ -f "$ROOT/package-lock.json" ]; then diff --git a/scripts/check.sh b/scripts/check.sh index d881a41..da4df44 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -15,6 +15,16 @@ report() { echo "=== verstak-sdk check ===" +# ── Dependency checks ── +if ! command -v node &>/dev/null; then + echo " ❌ node: not found" + FAILED=1 +fi +if ! command -v npm &>/dev/null; then + echo " ❌ npm: not found" + FAILED=1 +fi + # Validate that all JSON schemas are valid JSON echo "[schema validation]" if command -v python3 &>/dev/null; then @@ -48,17 +58,20 @@ else fi # TypeScript check (noEmit) -if [ ! -d "$ROOT/node_modules" ]; then - if [ -f "$ROOT/package-lock.json" ]; then - (cd "$ROOT" && npm ci --no-audit --no-fund) - report "npm ci" $? - else - (cd "$ROOT" && npm install --no-audit --no-fund) - report "npm install" $? +echo "[typescript]" +if [ "$FAILED" -eq 0 ]; then + if [ ! -d "$ROOT/node_modules" ]; then + if [ -f "$ROOT/package-lock.json" ]; then + (cd "$ROOT" && npm ci --no-audit --no-fund) + report "npm ci" $? + else + (cd "$ROOT" && npm install --no-audit --no-fund) + report "npm install" $? + fi fi + (cd "$ROOT" && npx tsc --noEmit) + report "tsc --noEmit" $? fi -(cd "$ROOT" && npx tsc --noEmit) -report "tsc --noEmit" $? echo "" if [ "$FAILED" -eq 0 ]; then diff --git a/scripts/test.sh b/scripts/test.sh index c32dcc0..5dccfbc 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -15,6 +15,21 @@ report() { echo "=== verstak-sdk test ===" +# ── Dependency checks ── +if ! command -v node &>/dev/null; then + echo " ❌ node: not found" + FAILED=1 +fi +if ! command -v npm &>/dev/null; then + echo " ❌ npm: not found" + FAILED=1 +fi +if [ "$FAILED" -ne 0 ]; then + echo "" + echo "❌ tests failed — missing core dependencies" + exit 1 +fi + # Install deps if missing if [ ! -d "$ROOT/node_modules" ]; then if [ -f "$ROOT/package-lock.json" ]; then