some build script tuning, exclude demo script for prod build

cpsdqs/unified-input
Ondřej Hruška 7 years ago
parent b219447e4f
commit 9488becd81
  1. 8
      _build_css.sh
  2. 16
      _build_js.sh
  3. 15
      js/term_conn.js

@ -3,5 +3,11 @@ source "_build_common.sh"
echo 'Building CSS...'
if [[ $ESP_PROD ]]; then
stylearg=compressed
else
stylearg=expanded
fi
mkdir -p out/css
npm run sass -- --output-style compressed sass/app.scss "out/css/app.$FRONT_END_HASH.css"
npm run sass -- --output-style ${stylearg} sass/app.scss "out/css/app.$FRONT_END_HASH.css"

@ -5,8 +5,20 @@ mkdir -p out/js
echo 'Generating lang.js...'
php ./dump_js_lang.php
if [[ $ESP_DEMO ]]; then
demofile=js/demo.js
else
demofile=
fi
echo 'Processing JS...'
npm run babel -- -o "out/js/app.$FRONT_END_HASH.js" --source-maps js/lib \
if [[ $ESP_PROD ]]; then
smarg=
else
smarg=--source-maps
fi
npm run babel -- -o "out/js/app.$FRONT_END_HASH.js" ${smarg} js/lib \
js/lib/chibi.js \
js/lib/keymaster.js \
js/lib/polyfills.js \
@ -14,7 +26,7 @@ npm run babel -- -o "out/js/app.$FRONT_END_HASH.js" --source-maps js/lib \
js/modal.js \
js/notif.js \
js/appcommon.js \
js/demo.js \
$demofile \
js/lang.js \
js/wifi.js \
js/term_* \

@ -67,7 +67,11 @@ window.Conn = function (screen) {
function doSend (message) {
if (_demo) {
window.demoInterface.input(message)
if (typeof demoInterface !== 'undefined') {
demoInterface.input(message)
} else {
console.log(`TX: ${JSON.stringify(message)}`)
}
return true // Simulate success
}
if (xoff) {
@ -90,9 +94,12 @@ window.Conn = function (screen) {
function init () {
if (window._demo) {
console.log('Demo mode!')
demoInterface.init(screen)
showPage()
if (typeof demoInterface === 'undefined') {
alert('Demoing non-demo demo!') // this will catch mistakes when deploying to the website
} else {
demoInterface.init(screen)
showPage()
}
return
}

Loading…
Cancel
Save