Restructuring

cpsdqs/unified-input
cpsdqs 7 years ago
parent e923fa1746
commit acae3992f5
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 7
      .eslintignore
  2. 2
      .gitignore
  3. 4
      README.md
  4. 13
      _dev_router.php
  5. 45
      build.sh
  6. 0
      css/.gitkeep
  7. 2
      dump_js_lang.php
  8. 0
      js/.gitkeep
  9. 0
      js/appcommon.js
  10. 0
      js/debug_screen.js
  11. 0
      js/lang.js
  12. 0
      js/lib/chibi.js
  13. 0
      js/lib/keymaster.js
  14. 0
      js/lib/polyfills.js
  15. 0
      js/modal.js
  16. 0
      js/notif.js
  17. 0
      js/soft_keyboard.js
  18. 0
      js/td/WebAudio.d.ts
  19. 0
      js/term.js
  20. 0
      js/term_conn.js
  21. 0
      js/term_input.js
  22. 0
      js/term_screen.js
  23. 0
      js/term_upload.js
  24. 0
      js/utils.js
  25. 0
      js/wifi.js
  26. 2
      server.sh

@ -1,9 +1,8 @@
# possibly minified output # possibly minified output
js out/**/*
out
# libraries # libraries
jssrc/lib js/lib/*
# php generated file # php generated file
jssrc/lang.js js/lang.js

2
.gitignore vendored

@ -1,6 +1,4 @@
_env.php _env.php
js/*
css/*
out/* out/*
!.gitkeep !.gitkeep
node_modules/ node_modules/

@ -12,7 +12,7 @@ PHP is used to build the HTML files and apply substitutions.
## Development ## Development
JavaScript source files can be found in the `jssrc/` folder, SASS JavaScript source files can be found in the `js/` folder, SASS
files in the `sass/` folder. files in the `sass/` folder.
Fontello (icon font) is maintained in the `fontello/` folder. To update Fontello, replace Fontello (icon font) is maintained in the `fontello/` folder. To update Fontello, replace
@ -20,7 +20,7 @@ the `fontello.zip` file and run `unpack.sh` in the same folder. This will extrac
from the zip file and put them into the `sass/` folder to be included with the other styles. from the zip file and put them into the `sass/` folder to be included with the other styles.
To test you changes (after building JS and CSS), run a PHP local server in the project To test you changes (after building JS and CSS), run a PHP local server in the project
directory using the `server.sh` script or by a command like `php -S 0.0.0.0:2000`. directory using the `server.sh` script or by a command like `php -S 0.0.0.0:2000 _dev_router.php`.
Template substitutions (that are normally done by the ESPTerm's webserver) applied to the Template substitutions (that are normally done by the ESPTerm's webserver) applied to the
files fior testing can be defined in `_debug_replacements.php`. files fior testing can be defined in `_debug_replacements.php`.

@ -0,0 +1,13 @@
<?php
if (preg_match('/\\/(?:js|css)/', $_SERVER["REQUEST_URI"])) {
$path = pathinfo($_SERVER["REQUEST_URI"]);
if ($path["extension"] == "js") {
header("Content-Type: application/javascript");
} else if ($path["extension"] == "css") {
header("Content-Type: text/css");
}
readfile("out" . $_SERVER["REQUEST_URI"]);
} else {
return false;
}

@ -1,29 +1,40 @@
#!/bin/bash #!/bin/bash
cd $(dirname $0)
rm -r out/*
mkdir out/js
mkdir out/css
echo 'Generating lang.js...'
php ./dump_js_lang.php
echo 'Packing JS...' echo 'Packing JS...'
npm run babel -- -o js/app.js --source-maps jssrc/lib \ npm run babel -- -o out/js/app.js --source-maps js/lib \
jssrc/lib/chibi.js \ js/lib/chibi.js \
jssrc/lib/keymaster.js \ js/lib/keymaster.js \
jssrc/lib/polyfills.js \ js/lib/polyfills.js \
jssrc/utils.js \ js/utils.js \
jssrc/modal.js \ js/modal.js \
jssrc/notif.js \ js/notif.js \
jssrc/appcommon.js \ js/appcommon.js \
jssrc/lang.js \ js/lang.js \
jssrc/wifi.js \ js/wifi.js \
jssrc/term_* \ js/term_* \
jssrc/debug_screen.js \ js/debug_screen.js \
jssrc/soft_keyboard.js \ js/soft_keyboard.js \
jssrc/term.js js/term.js
echo 'Building CSS...' echo 'Building CSS...'
npm run sass -- --output-style compressed sass/app.scss css/app.css npm run sass -- --output-style compressed sass/app.scss out/css/app.css
echo 'Building HTML...' echo 'Building HTML...'
rm out/*
php ./dump_js_lang.php
php ./compile_html.php php ./compile_html.php
echo 'Copying resources...'
cp -r img out/img
echo 'ESPTerm front-end ready' echo 'ESPTerm front-end ready'

@ -15,7 +15,7 @@ foreach ($selected as $key) {
$out[$key] = $_messages[$key]; $out[$key] = $_messages[$key];
} }
file_put_contents(__DIR__. '/jssrc/lang.js', file_put_contents(__DIR__. '/js/lang.js',
"// Generated from PHP locale file\n" . "// Generated from PHP locale file\n" .
'let _tr = ' . json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE) . ";\n\n" . 'let _tr = ' . json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE) . ";\n\n" .
"function tr (key) { return _tr[key] || '?' + key + '?' }\n" "function tr (key) { return _tr[key] || '?' + key + '?' }\n"

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
xterm -e "php -S 0.0.0.0:2000" xterm -e "php -S 0.0.0.0:2000" _dev_router.php

Loading…
Cancel
Save