diff --git a/.gitignore b/.gitignore index 07a7ed1..2f273d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -y.js +dist/ +ytcg-*.tar.xz diff --git a/make_dist.sh b/make_dist.sh new file mode 100755 index 0000000..3efb2f3 --- /dev/null +++ b/make_dist.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +echo -e "Making \033[0;31mYTCget\033[0m dist..." + +if [ -d "./dist" ]; then + echo -en "Cleaning \033[0;31m./dist/\033[0m directory..." + rm -rf "./dist/*" + echo " Complete!" + + echo -n "Copying static files..." + cp ./src/youtubeID.js ./dist/youtubeID.js + cp ./src/ytcg.js ./dist/ytcg.js + echo " Complete!" + + echo -n "Minifying files..." + minify-html ./src/styles.css -o ./dist/styles.css + minify-html \ + --do-not-minify-doctype \ + --keep-closing-tags \ + --keep-spaces-between-attributes \ + --keep-html-and-head-opening-tags \ + ./src/index.html -o ./dist/index.html + + GIT_COMMIT_HASH=$(git rev-parse --short HEAD) + sed -i -- "s/{GIT_COMMIT_HASH}/$GIT_COMMIT_HASH/g" ./dist/index.html + echo " Complete!" + + echo -en "Making \033[0;31mytcg-$GIT_COMMIT_HASH.tar.xz\033[0m file..." + tar -cJf "ytcg-$GIT_COMMIT_HASH.tar.xz" ./dist/* + echo " Complete!" +else + echo -e "Make \033[0;31m./dist/\033[0m directory." + mkdir "./dist/" +fi