Files
SpeedScope/deploy.sh
Jamie Wong 3172e61f05 Add a CLI to load the target file in your default browser (#88)
This PR add a CLI speedscope which load file given as an argument in your default browser. Expected usage looks like:

```
speedscope /path/to/profile
```

Note that since we're using base64 encoded strings as a transport for this, this won't work with multi-file profiles, like the Instruments .trace files. This could be augmented to support that by archiving the contents, but that can be handled in a different PR.

This PR also set up a viable model for integrating speedscope into other projects. By replicating the contents of `cli.js` in other languages, integration should be possible in other languages with no dependency upon node in any way. Distribution should consist of just HTML, JS, and CSS assets to be loaded in browser.

Test Plan:
- Ran the following to simulate a publish & subsequent installation:

```
$ npm pack
$ mv speedscope-0.1.0.tgz /tmp/
$ cd /tmp
$ tar -xvvf speedscope-0.1.0.tgz
$ cd package
$ npm install --only=production
$ ./cli.js
Opening file:///private/tmp/package/dist/release/index.html in your default browser
$ ./cli.js ~/code/speedscope/sample/profiles/Chrome/65/timeline.json
Creating temp file /var/folders/l0/qtd9z14973s2tw81vmzwkyp00000gp/T/speedscope-1531023992823-3880.js
Creating temp file /var/folders/l0/qtd9z14973s2tw81vmzwkyp00000gp/T/speedscope-1531023992823-3880.html
Opening file:///var/folders/l0/qtd9z14973s2tw81vmzwkyp00000gp/T/speedscope-1531023992823-3880.html in your default browser
```

Fixes #24
2018-07-07 21:33:02 -07:00

57 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
#
# type check, do a release build, then do a shallow clone of the
# repository into a temporary directory and copy the release build
# artifacts into there to commit & push to the gh-pages branch
# Fail on first error
set -e
OUTDIR=`pwd`/dist/release
echo $OUTDIR
./build-release.sh
# Create a shallow clone of the repository
TMPDIR=`mktemp -d -t speedscope-release`
echo "Entering $TMPDIR"
pushd "$TMPDIR"
git clone --depth 1 git@github.com:jlfwong/speedscope.git -b gh-pages
# Copy the build artifacts into the shallow clone
pushd speedscope
rm -rf *
cp -R "$OUTDIR"/* .
# Set the CNAME record
echo www.speedscope.app > CNAME
# Set up a handler to run on Ctrl+C
trap ctrl_c INT
function ctrl_c() {
read -p "Commit release? [yes/no]: "
if [[ $REPLY =~ ^yes$ ]]
then
git add --all
git commit -m 'Release'
git push origin HEAD:gh-pages
popd
rm -rf "$TMPDIR"
exit 0
else
echo "Aborting release."
popd
rm -rf "$TMPDIR"
exit 1
fi
}
# Start a local server for verification of the build
echo
echo
echo "Build complete. Starting server on http://localhost:4444/"
echo "Hit Ctrl+C to complete or cancel the release"
echo
echo
python -m SimpleHTTPServer 4444 .