Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
Last active January 9, 2018 14:47
Show Gist options
  • Save pesterhazy/7fc7e020afa040bef6b11f06b62d2821 to your computer and use it in GitHub Desktop.
Save pesterhazy/7fc7e020afa040bef6b11f06b62d2821 to your computer and use it in GitHub Desktop.
Re-natal: deep clean build artifacts
#!/usr/bin/env bash
set -euo pipefail && cd "$(dirname "${BASH_SOURCE[0]}")/.."
# When you're down and out
# When you're on the street
# When evening falls so hard, I will comfort you
# I will clean your build artifacts
# Disclaimer: use at your own risk
pidkill() {
set +e
x=$(lsof -i ":$1" -sTCP:LISTEN -P -n -F p | grep '^p' | sed 's/^p//' | head -1)
if [[ "$x" != "" ]]; then
echo "Killing PID $x listening on port $1..."
kill "$x"
fi
set -e
}
# remove everything, just to be shure
rm -rf target
rm -rf ios/build
rm -rf "$HOME/Library/Developer/Xcode/DerivedData"
lein clean
re-natal use-figwheel
pidkill 8081 # kill packager
# delete react native packager cache
find "$TMPDIR" -depth 1 -name 'react-*' -delete
if which watchman; then
watchman watch-del-all
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment