#!/bin/sh -x
rm -rf node_modules
npm install phantomjs
version=`grep version node_modules/phantomjs/package.json | tail -1 | sed -e 's;.*: ";;' -e 's;".*;;'`
date=`date '+%Y%m%d'`
tar -cv \
    --exclude node_modules/phantomjs/lib/phantom/bin/phantomjs \
    --exclude node_modules/phantomjs-server/node_modules/phantomjs/lib/phantom \
    -f - node_modules | gzip -9 >node-phantomjs-$version-$date.tar.gz
rm -rf node_modules
