fix: add dep checks (node/npm), auto-install npm deps in all scripts
This commit is contained in:
parent
2883de9792
commit
24d500a7b5
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,7 +58,9 @@ else
|
|||
fi
|
||||
|
||||
# TypeScript check (noEmit)
|
||||
if [ ! -d "$ROOT/node_modules" ]; then
|
||||
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" $?
|
||||
|
|
@ -56,9 +68,10 @@ if [ ! -d "$ROOT/node_modules" ]; then
|
|||
(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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue