swc/crates/swc_ecma_minifier/scripts/inputs/remove-useless.sh
Donny/강동윤 74fd353053
fix(es/minifier): Fix bugs (#3238)
swc_ecma_minifier:
 - `collapse_vars`: Respect `mutated`. (Closes #2679)
 - Add a test for https://github.com/vercel/next.js/issues/31084.
2022-01-12 16:57:54 +09:00

57 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eu
dir="${1-"./inputs/"}"
echo "Removing useless files in $dir"
find $dir -type f \( \
-name "*.map" -o \
-name "*.html" -o \
-name "*.xml" -o \
-name "*.aac" -o \
-name "*.avif" -o \
-name "*.ogg" -o \
-name "*.mp3" -o \
-name "*.mp4" -o \
-name "*.wav" -o \
-name "*.bat" -o \
-name "*.cur" -o \
-name "*.db" -o \
-name "*.diff" -o \
-name "*.donotoptimizepng" -o \
-name "*.gif" -o \
-name "*.svg" -o \
-name "*.css" -o \
-name "*.png" -o \
-name "*.json" -o \
-name "*.woff" -o \
-name "*.woff2" -o \
-name "*.otf" -o \
-name "*.ttf" -o \
-name "*.eot" -o \
-name "*.flow" -o \
-name "*.md" -o \
-name "*.less" -o \
-name "*.sass" -o \
-name "*.scss" -o \
-name "*.ico" -o \
-name "*.sh" -o \
-name "*.jpg" -o \
-name "*.webp" -o \
-name "*.jpeg" -o \
-name "*.gz" -o \
-name "*.gzip" -o \
-name "*.zip" -o \
-name "*.woff" -o \
-name "*.wasm" -o \
-name "*.wast" -o \
-name "*.tsbuildinfo" \
\) \
-delete
echo "Removing empty directories in $dir"
find $dir -type d -empty -delete
echo "Reducing js files in $dir"