#!/bin/bash # This script removes some stuff in `www/node_modules` that the app doesn't need to run. echo "Removing bloat in node_modules..." set -e DIR="$(pwd)/www/node_modules" cd $DIR rm -rf array-parallel rm -rf codemirror rm -rf codemirror-spell-checker rm -rf dom7 rm -rf matches-selector rm -rf path-to-regexp rm -rf ssr-window rm -rf template7 rm -rf throttleit rm -rf tiny-emitter rm -rf typo-js rm -rf .bin cd $DIR cd @fortawesome/fontawesome-free rm -rf {js,less,metadata,scss,sprites,svgs} find css -type f -not -name 'all.min.css' -delete cd $DIR cd jquery rm -rf src rm -rf external cd $DIR cd framework7 rm -rf components rm -rf lazy-components rm -rf less rm -rf modules rm -rf utils rm -f framework7.* rm -f framework7-lite.* find css -type f -not -name 'framework7.bundle.min.css' -delete find js -type f -not -name 'framework7.bundle.min.js' -delete cd $DIR cd jquery rm -rf src rm -rf external find dist -type f -not -name 'jquery.min.js' -delete cd $DIR cd material-design-icons # Remove everything except the icon font and license, but also exclude the # current and parent folder (. , ..) so rm won't complain about refusing # to delete the whole filesystem find . -maxdepth 1 -not -name '.' -not -name 'LICENSE' -not -name 'iconfont' -exec rm -rf {} \; cd $DIR cd marked rm -rf {bin,lib,man,src} cd $DIR cd shufflejs rm -rf src find dist -type f -not -name 'shuffle.min.js' -delete cd $DIR echo "Cleanup finished"