Add a way of generating a self-contained zip-file

This commit is contained in:
Jamie Wong
2018-08-22 18:50:25 -07:00
parent 3193b34c46
commit a5c3184880
3 changed files with 54 additions and 1 deletions
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
# Prepare a mock installation of speedscope to test it before the actual npm
# publish
set -euxo pipefail
SRCDIR=`pwd`
TMPDIR=`mktemp -d -t speedscope-test-installation`
# Untar the package
pushd "$TMPDIR"
PACKEDNAME=`npm pack speedscope | tail -n1`
tar -xvvf "$PACKEDNAME"
# Zip the parts we care about
ZIPNAME=`basename $PACKEDNAME .tgz`.zip
mkdir speedscope
mv package/dist/release/** speedscope
cp "$SRCDIR"/LICENSE speedscope
echo "This is a self-contained release of https://github.com/jlfwong/speedscope." > speedscope/README
echo "To use it, open index.html in Chrome or Firefox." >> speedscope/README
zip "$ZIPNAME" speedscope/**
# Switch back to the repository root
popd
mv "$TMPDIR"/"$ZIPNAME" dist/release/"$ZIPNAME"
# Clean up
rm -rf "$TMPDIR"
set +x
echo "Created dist/release/$ZIPNAME"