You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HelenaExpressApp/scripts/remove_bloat.sh

79 lines
2.3 KiB
Bash

#!/bin/bash
# This script removes some stuff in `www/node_modules` that the app doesn't need to run.
# It removes about 6MB from the build size.
echo "Removing bloat in node_modules..."
set -e
DIR="$(pwd)/www/node_modules"
cd $DIR
rm -rf {buffer-from,concat-stream,csscolorparser,dom7,earcut,geojson-vt,gl-matrix}
rm -rf {grid-index,ieee754,inherits,kdbush,@mapbox,minimist ,murmurhash-js,path-to-regexp,pbf}
rm -rf {potpack,protocol-buffers-schema,quickselect,readable-stream,resolve-protobuf-schema,rw}
rm -rf {safe-buffer,ssr-window,string_decoder,supercluster,template7,text-encoding,tinyqueue}
rm -rf {ts-custom-error,typedarray,util-deprecate,vt-pbf}
# Make npm stop complaining that these don't exist by actually removing them
rm -rf .bin/*
cd $DIR
cd @fortawesome/fontawesome-pro
rm -rf {js,less,metadata,scss,sprites,svgs}
find css -type f -not -name 'all.min.css' -delete
find webfonts -type f -not -name '*.woff*' -delete
find . -type f -name '*.tgz' -delete # for some reason it's packaging an 18MB tarball sometimes
cd $DIR
cd @zxing/library
rm -rf {esm,esm5}
rm -f umd/index.min.js.map
cd $DIR
cd bwip-js
rm -rf {bin,examples,src,barcode.ps,demo.html,stb_truetype.h}
rm -rf dist/bwip-js.js
rm -rf dist/node-bwipjs.js
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 jsbarcode
rm -rf .dockerignore .eslintignore .eslintrcautomation bower.json CONTRIBUTING.md docker-compose.yml Dockerfile example gulpfile.js jsbarcode.d.ts README.md src test .travis.yml
rm -rf {automation,bin}
rm -rf dist/barcodes
rm -rf dist/JsBarcode.all.js
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 maplibre-gl
rm -rf {build,flow-typed,src}
find dist -type f -not -name 'mapbox-gl.css' -not -name 'mapbox-gl.js' -delete
rm -rf dist/style-spec
cd $DIR
echo "Cleanup finished"