ha-frontend-cdce8p/script/build_frontend
Paulus Schoutsen a4afc2e37a
Polymer 3 modulize (#1154)
* Version bump to 20180510.1

* Fix hass util

* Fix translations

* Bye paper-time-input

* Add webpack config

* Add webpack to package.json

* Fix translation import

* Disable web animations polyfill bad import

* Disable importHref import

* Update webpack config to build authorize.js

* Build translations json

* Build frontend correctly

* Run eslint --fix

* Load markdown JS on demand (#1155)

* Add HTML imports (#1160)

* Fix localize (#1161)

* Fix Roboto in build (#1162)

* Load web animations polyfill (#1163)

* P3: Fix chart js (#1164)

* P3: Fix Chart JS

* Update timeline package

* P3: panel resolver (#1165)

* WIP

* Initial importing of panels

* Fix panel resolver

* Fix automation and script editor (#1166)

* Expose Polymer and Polymer.Element on window (#1167)

* Remove unused import

* eslint --fix

* Es5 build (#1168)

* Build for ES5

* Fix build_frontend

* Remove stale comment

* Migrate to use paper-material-styles (#1170)

* Send parsed date to history/logbook (#1171)

* Fork app storage behavior (#1172)

* Add paper input with type time (#1173)

* Fix authorize

* Lint

* Sort imports

* Lint

* Remove eslint-html

* Do not lint authorize.html

* Fix polymer lint

* Try chrome 62 for wct

* P3: Add patched iconset (#1175)

* Add patched iconset

* Lint

* Test with latest Chrome again

* Use less window.hassUtil

* Teporarily use my fecha fork

* Import correct intl.messageFormat

* Update wct-browser-legacy to 1.0.0

* Include polyfill in right place

* Fix IntlMessageFormat

* Fix test not having a global scope

* Rollup <_<

* Fork app-localize-behavior

* Disable wct tests

* Lint
2018-05-15 13:31:47 -04:00

58 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
# Builds the frontend for production
# Stop on errors
set -e
cd "$(dirname "$0")/.."
OUTPUT_DIR=hass_frontend
OUTPUT_DIR_ES5=hass_frontend_es5
rm -rf $OUTPUT_DIR $OUTPUT_DIR_ES5
cp -r public $OUTPUT_DIR
mkdir $OUTPUT_DIR_ES5
cp -r public/__init__.py $OUTPUT_DIR_ES5/
# Build frontend
BUILD_DEV=0 ./node_modules/.bin/gulp
NODE_ENV=production webpack -p
BUILD_DEV=0 ./node_modules/.bin/gulp authorize authorize-es5
# Copy frontend to output
cp build/core.js $OUTPUT_DIR
cp build/webpack/* $OUTPUT_DIR
cp build-es5/core.js $OUTPUT_DIR_ES5
cp build-es5/webpack/* $OUTPUT_DIR_ES5
cp build-es5/compatibility.js $OUTPUT_DIR_ES5
# Translations
cp -r build-translations/output $OUTPUT_DIR/translations
# Local Roboto
cp -r node_modules/@polymer/font-roboto-local/fonts $OUTPUT_DIR
# Polyfill web components
cp node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js $OUTPUT_DIR
cp node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js $OUTPUT_DIR_ES5
# Icons
script/update_mdi.py
# Leaflet
mkdir $OUTPUT_DIR/images/leaflet
cp node_modules/leaflet/dist/leaflet.css $OUTPUT_DIR/images/leaflet
cp -r node_modules/leaflet/dist/images $OUTPUT_DIR/images/leaflet/
./node_modules/.bin/gulp compress
# Generate the __init__ file
echo "VERSION = '`git rev-parse HEAD`'" >> $OUTPUT_DIR/__init__.py
echo "CREATED_AT = `date +%s`" >> $OUTPUT_DIR/__init__.py
echo "VERSION = '`git rev-parse HEAD`'" >> $OUTPUT_DIR_ES5/__init__.py
echo "CREATED_AT = `date +%s`" >> $OUTPUT_DIR_ES5/__init__.py
# Generate the MD5 hash of the new frontend
./node_modules/.bin/gulp gen-index-html
./node_modules/.bin/gulp gen-index-html-es5