#!/bin/bash


function uglifyjs(){
  docker run -v $PWD:/file smithmicro/uglifyjs /file/$1
}

version_num=$1

if [ "$version_num" == "" ]
then
	echo "Usage: $0 version_number"
	exit 1
fi

echo "Will create files for release v$version_num."
echo "Press enter to continue"
read blah


# Check uglifyjs is present
#echo "foo" | uglifyjs > /dev/null

#if [ !  "$?" == "0" ] 
#then
#	echo "Uglifyjs doesn't seem to be working, do you need to do 'sudo apt-get install node-uglify'?"
#	exit 1
#fi

# Otherwise, do the minification
cd resources/embed/
uglifyjs embed.js > embed.min.js
cp embed.min.js versions/embed.$version_num.min.js

echo "Release complete, please check git status, commit and then upload the release"


