Detect-It-Easy/autotools/dbcompiler/node_modules_clean.sh
2026-05-09 19:27:17 +03:00

20 lines
522 B
Bash

#!/bin/bash
TARGET_DIR="node_licenses"
mkdir -p "$TARGET_DIR"
echo "[1/3] Copying licenses..."
while IFS= read -r -d '' f; do
pkg_name=$(basename "$(dirname "$f")")
fname=$(basename "$f")
cp "$f" "$TARGET_DIR/${pkg_name}_${fname}.txt"
done < <(find node_modules -type f \( -iname "*LICENSE*" -o -iname "*LICENCE*" -o -iname "*COPYING*" \) -print0)
echo "[2/3] Licenses saved in /$TARGET_DIR/"
echo "[3/3] Running modclean..."
npx modclean -n default:safe -r
echo "Done! Offline-ready and legally safe."