Remove orphaned .js files
Remove orphaned .js files
Found with this small bash utility script, https://justin.abrah.ms/js/finding_unused_requirejs_imports.html. There will be some false-positives (tests, utility scripts, dynamic imports)
~/Downloads/finding_unused_requirejs_imports.sh . > ~/Downloads/finding_unused_requirejs_imports1.txt
#/bin/bash
echo "$@"
JS_FILES=$(find "$@" -name "*.js" -not -path "./node_modules/*")
for FILE in $JS_FILES; do
short_name=`basename $FILE`
filename="${short_name%.*}"
git grep --quiet $filename 1>/dev/null
if [ "$?" == "1" ]; then
echo "Should delete: $FILE"
fi
done;
Edited by Eric Eastwood