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.

62 lines
2.0 KiB

# This script removes some stuff in `www/node_modules` that the app doesn't need to run.
# It makes the build under 6MB, and prevents zip64-related crashes.
echo "Removing bloat in node_modules..."
set -e
cd $DIR
rm -rf {buffer-from,concat-stream,csscolorparser,dom7,earcut,geojson-vt,gl-matrix,get-stream}
rm -rf {grid-index,htm,ieee754,inherits,kdbush,@mapbox,mapbox-gl,minimist,murmurhash-js,path-to-regexp,pbf}
rm -rf {potpack,protocol-buffers-schema,quickselect,readable-stream,resolve-protobuf-schema,rw}
rm -rf {safe-buffer,skeleton-elements,ssr-window,string_decoder,supercluster,swiper,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 '*.woff2' -delete
find . -type f -name '*.tgz' -delete # for some reason it's packaging an 18MB tarball sometimes
rm webfonts/fa-thin-100.woff2
rm webfonts/fa-light-300.woff2
rm webfonts/fa-brands-400.woff2
cd $DIR
cd @zxing/library
rm -rf {esm,esm5,,}
rm -f umd/
cd $DIR
cd framework7
rm -rf {bundle,cjs,components,core,esm,less,lite,lite-bundle,modules,types,shared}
find . -type f -not -name 'framework7-bundle.min.js' -not -name 'framework7-bundle.min.css' -not -name 'LICENSE' -not -name 'package.json' -delete
cd $DIR
cd template7
rm -rf src
find . -type f -not -name "LICENSE" -not -name "package.json" -not -name "template7.min.js" -delete
cd $DIR
cd jquery
rm -rf src
rm -rf external
rm {AUTHORS.txt,bower.json,}
find dist -type f -not -name 'jquery.min.js' -delete
cd $DIR
cd maplibre-gl
rm -rf {build,flow-typed,src}
find . -name "" -delete
find dist -type f -not -name 'maplibre-gl.css' -not -name 'maplibre-gl.js' -delete
rm -rf dist/style-spec
cd $DIR
echo "Cleanup finished"