2015-02-22 17:33:01 -08:00
|
|
|
# Builds the frontend for production
|
2015-02-08 23:33:19 -08:00
|
|
|
|
2015-09-17 00:35:26 -07:00
|
|
|
cd "$(dirname "$0")/.."
|
2015-01-17 14:32:33 -08:00
|
|
|
|
2016-07-13 23:05:40 -07:00
|
|
|
cd homeassistant/components/frontend/www_static/home-assistant-polymer
|
2015-07-12 20:43:07 -07:00
|
|
|
npm run frontend_prod
|
2015-02-05 22:36:23 -08:00
|
|
|
|
2015-07-12 20:43:07 -07:00
|
|
|
cp bower_components/webcomponentsjs/webcomponents-lite.min.js ..
|
|
|
|
cp build/frontend.html ..
|
2016-05-15 16:38:05 -07:00
|
|
|
gzip build/frontend.html -c -k -9 > ../frontend.html.gz
|
2016-07-12 00:10:05 -07:00
|
|
|
cp build/partial-map.html ..
|
|
|
|
gzip build/partial-map.html -c -k -9 > ../partial-map.html.gz
|
2016-07-12 09:15:58 -07:00
|
|
|
cp build/dev-tools.html ..
|
|
|
|
gzip build/dev-tools.html -c -k -9 > ../dev-tools.html.gz
|
2016-05-28 18:38:46 -07:00
|
|
|
cp build/_core_compiled.js ../core.js
|
|
|
|
gzip build/_core_compiled.js -c -k -9 > ../core.js.gz
|
2014-11-12 00:36:20 -08:00
|
|
|
|
2016-05-27 21:45:38 -07:00
|
|
|
node script/sw-precache.js
|
|
|
|
cp build/service_worker.js ..
|
|
|
|
gzip build/service_worker.js -c -k -9 > ../service_worker.js.gz
|
|
|
|
|
2014-11-12 00:36:20 -08:00
|
|
|
# Generate the MD5 hash of the new frontend
|
2015-07-12 20:43:07 -07:00
|
|
|
cd ../..
|
2016-03-12 10:52:48 -08:00
|
|
|
echo '"""DO NOT MODIFY. Auto-generated by build_frontend script."""' > version.py
|
2015-01-22 05:22:40 +00:00
|
|
|
if [ $(command -v md5) ]; then
|
2016-05-28 18:38:46 -07:00
|
|
|
echo 'CORE = "'`md5 -q www_static/core.js`'"' >> version.py
|
|
|
|
echo 'UI = "'`md5 -q www_static/frontend.html`'"' >> version.py
|
2016-07-12 00:10:05 -07:00
|
|
|
echo 'MAP = "'`md5 -q www_static/partial-map.html`'"' >> version.py
|
2016-07-12 09:15:58 -07:00
|
|
|
echo 'DEV = "'`md5 -q www_static/dev-tools.html`'"' >> version.py
|
2015-01-22 05:22:40 +00:00
|
|
|
elif [ $(command -v md5sum) ]; then
|
2016-05-28 18:38:46 -07:00
|
|
|
echo 'CORE = "'`md5sum www_static/core.js | cut -c-32`'"' >> version.py
|
|
|
|
echo 'UI = "'`md5sum www_static/frontend.html | cut -c-32`'"' >> version.py
|
2016-07-12 00:10:05 -07:00
|
|
|
echo 'MAP = "'`md5sum www_static/partial-map.html | cut -c-32`'"' >> version.py
|
2016-07-12 09:15:58 -07:00
|
|
|
echo 'DEV = "'`md5sum www_static/dev-tools.html | cut -c-32`'"' >> version.py
|
2015-01-22 05:22:40 +00:00
|
|
|
else
|
2015-04-14 23:55:08 -04:00
|
|
|
echo 'Could not find an MD5 utility'
|
2015-01-22 05:22:40 +00:00
|
|
|
fi
|