#!/bin/sh -x
rm -rf node_modules
npm install mosca --ignore-scripts
# rm -rf node_modules/mosca/node_modules/bunyan/node_modules/dtrace-provider/build
# rm -rf node_modules/mosca/node_modules/hiredis/build
# rm -rf node_modules/mosca/node_modules/websocket-stream/node_modules/ws/node_modules/bufferutil/build
# rm -rf node_modules/mosca/node_modules/websocket-stream/node_modules/ws/node_modules/utf-8-validate/build
# rm -rf node_modules/mosca/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build
# rm -rf node_modules/mosca/node_modules/leveldown/build
# rm -rf node_modules/mosca/node_modules/ascoltatori/node_modules/qlobber-fsq/node_modules/buffertools/build
# rm -rf node_modules/mosca/node_modules/ascoltatori/node_modules/qlobber-fsq/node_modules/fs-ext/build
version=`grep '"version":' node_modules/mosca/package.json  | head -1 | sed -e 's;.*: ";;' -e 's;".*;;'`
date=`date '+%Y%m%d'`
tar cvf - node_modules | gzip -9 >mosca-$version-$date.tar.gz
rm -rf node_modules
