Improve Node.js dependency installation logic in CI workflow
This commit is contained in:
+12
-2
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# Detection logic:
|
||||
# 1. Python: if requirements.txt exists → install deps, lint, test.
|
||||
# 2. Node/JS: if package.json exists → npm ci, lint, test, build.
|
||||
# 2. Node/JS: if package.json exists → install deps, lint, test, build.
|
||||
# 3. Neither detected → print a message and exit 0 (never fail).
|
||||
#
|
||||
# Controlled by .ci/config.env:
|
||||
@@ -198,7 +198,17 @@ jobs:
|
||||
|
||||
- name: Install Node dependencies
|
||||
if: env.HAS_NODE == 'true'
|
||||
run: npm ci
|
||||
run: |
|
||||
# Prefer deterministic install when lockfile is healthy.
|
||||
# Fallback to npm install if lockfile is out-of-sync.
|
||||
if [ -f package-lock.json ]; then
|
||||
if ! npm ci; then
|
||||
echo "npm ci failed; falling back to npm install"
|
||||
npm install
|
||||
fi
|
||||
else
|
||||
npm install
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# Step 9: Node.js — Lint (only if "lint" script exists in package.json)
|
||||
|
||||
Reference in New Issue
Block a user