From 60a2c9e1bf7adaa7edf45528c52caec7cc3ec811 Mon Sep 17 00:00:00 2001 From: plocket <52798256+plocket@users.noreply.github.com> Date: Sun, 29 Jan 2023 17:37:28 -0500 Subject: [PATCH 1/2] Bundle app files with node script --- .../webapp/static/app/bundle_app.mjs | 232 ++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 docassemble_webapp/docassemble/webapp/static/app/bundle_app.mjs diff --git a/docassemble_webapp/docassemble/webapp/static/app/bundle_app.mjs b/docassemble_webapp/docassemble/webapp/static/app/bundle_app.mjs new file mode 100644 index 000000000..348b99cf7 --- /dev/null +++ b/docassemble_webapp/docassemble/webapp/static/app/bundle_app.mjs @@ -0,0 +1,232 @@ +/** +* Copying code from server.py to help local development of app folder +* to run on the command line: +* npm install fs +* node docassemble_webapp/docassemble/webapp/static/app/bundle_app.mjs +* su www-data +* source /usr/share/docassemble/local3.10/bin/activate +* pip install --no-deps --no-index --upgrade --force-reinstall ./docassemble_base ./docassemble_webapp ./docassemble && exit +*/ + +// Must `npm install` all libs used in here. Can't do that from inside here. +import fs from 'fs'; +import * as cp from 'child_process'; + +// Destination will be created or overwritten by default. +// No minification. That can be done at the very end with a command like +// minify docassemble_webapp/docassemble/webapp/static/app/app.js > docassemble_webapp/docassemble/webapp/static/app/app.min.js +fs.copyFileSync('docassemble_webapp/docassemble/webapp/static/app/app.js', 'docassemble_webapp/docassemble/webapp/static/app/app.min.js'); +// Q: Are there any other things that need to be copied over? +fs.copyFileSync('docassemble_webapp/docassemble/webapp/static/app/app.css', 'docassemble_webapp/docassemble/webapp/static/app/app.min.css'); + +// wget -q -O docassemble_webapp/docassemble/webapp/static/app/bundle.css http://localhost/bundle.css +// @app.route('/bundle.css', methods=['GET']) +// def css_bundle(): +// // ... +// for parts in [['bootstrap-fileinput', 'css', 'fileinput.min.css'], ['labelauty', 'source', 'jquery-labelauty.min.css'], ['bootstrap-combobox', 'css', 'bootstrap-combobox.min.css'], ['bootstrap-slider', 'dist', 'css', 'bootstrap-slider.min.css'], ['app', 'app.min.css']]: +// // ... +function css_bundle() { + /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ + let container_path = `docassemble_webapp/docassemble/webapp/static/`; + let target_path = `${ container_path }app/bundle.css`; + let filepaths = [ + `${ container_path }bootstrap-fileinput/css/fileinput.min.css`, + `${ container_path }labelauty/source/jquery-labelauty.min.css`, + `${ container_path }bootstrap-combobox/css/bootstrap-combobox.min.css`, + `${ container_path }bootstrap-slider/dist/css/bootstrap-slider.min.css`, + `${ container_path }app/app.min.css`, + ]; + bundle( target_path, filepaths ); +}; + +// wget -q -O docassemble_webapp/docassemble/webapp/static/app/playgroundbundle.css http://localhost/playgroundbundle.css +// @app.route('/playgroundbundle.css', methods=['GET']) +// def playground_css_bundle(): +// // ... +// for parts in [['codemirror', 'lib', 'codemirror.css'], ['codemirror', 'addon', 'search', 'matchesonscrollbar.css'], ['codemirror', 'addon', 'display', 'fullscreen.css'], ['codemirror', 'addon', 'scroll', 'simplescrollbars.css'], ['codemirror', 'addon', 'hint', 'show-hint.css'], ['app', 'pygments.min.css'], ['bootstrap-fileinput', 'css', 'fileinput.min.css']]: +// // ... +function playground_css_bundle() { + /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ + let container_path = `docassemble_webapp/docassemble/webapp/static/`; + let target_path = `${ container_path }app/playgroundbundle.css`; + let filepaths = [ + `${ container_path }codemirror/lib/codemirror.css`, + `${ container_path }codemirror/addon/search/matchesonscrollbar.css`, + `${ container_path }codemirror/addon/display/fullscreen.css`, + `${ container_path }codemirror/addon/scroll/simplescrollbars.css`, + `${ container_path }codemirror/addon/hint/show-hint.css`, + `${ container_path }app/pygments.min.css`, + `${ container_path }bootstrap-fileinput/css/fileinput.min.css`, + ]; + bundle( target_path, filepaths ); +}; + +//wget -q -O docassemble_webapp/docassemble/webapp/static/app/bundle.js http://localhost/bundle.js +// @app.route('/bundle.js', methods=['GET']) +// def js_bundle(): +// // ... +// for parts in [['app', 'jquery.min.js'], ['app', 'jquery.validate.min.js'], ['app', 'additional-methods.min.js'], ['app', 'jquery.visible.min.js'], ['bootstrap', 'js', 'bootstrap.bundle.min.js'], ['bootstrap-slider', 'dist', 'bootstrap-slider.min.js'], ['labelauty', 'source', 'jquery-labelauty.min.js'], ['bootstrap-fileinput', 'js', 'plugins', 'piexif.min.js'], ['bootstrap-fileinput', 'js', 'fileinput.min.js'], ['bootstrap-fileinput', 'themes', 'fas', 'theme.min.js'], ['app', 'app.min.js'], ['bootstrap-combobox', 'js', 'bootstrap-combobox.min.js'], ['app', 'socket.io.min.js']]: +// // ... +function js_bundle() { + /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ + let container_path = `docassemble_webapp/docassemble/webapp/static/`; + let target_path = `${ container_path }app/bundle.js`; + let filepaths = [ + `${ container_path }app/jquery.min.js`, + `${ container_path }app/jquery.validate.min.js`, + `${ container_path }app/additional-methods.min.js`, + `${ container_path }app/jquery.visible.min.js`, + `${ container_path }bootstrap/js/bootstrap.bundle.min.js`, + `${ container_path }bootstrap-slider/dist/bootstrap-slider.min.js`, + `${ container_path }labelauty/source/jquery-labelauty.min.js`, + `${ container_path }bootstrap-fileinput/js/plugins/piexif.min.js`, + `${ container_path }bootstrap-fileinput/js/fileinput.min.js`, + `${ container_path }bootstrap-fileinput/themes/fas/theme.min.js`, + `${ container_path }app/app.min.js`, + `${ container_path }bootstrap-combobox/js/bootstrap-combobox.min.js`, + `${ container_path }app/socket.io.min.js`, + ]; + let extra_start = ``; //`//test4\n`; + bundle( target_path, filepaths, extra_start ); +}; + + +// wget -q -O docassemble_webapp/docassemble/webapp/static/app/playgroundbundle.js http://localhost/playgroundbundle.js +// @app.route('/playgroundbundle.js', methods=['GET']) +// def playground_js_bundle(): +// // ... +// for parts in [['areyousure', 'jquery.are-you-sure.js'], ['codemirror', 'lib', 'codemirror.js'], ['codemirror', 'addon', 'search', 'searchcursor.js'], ['codemirror', 'addon', 'scroll', 'annotatescrollbar.js'], ['codemirror', 'addon', 'search', 'matchesonscrollbar.js'], ['codemirror', 'addon', 'display', 'fullscreen.js'], ['codemirror', 'addon', 'edit', 'matchbrackets.js'], ['codemirror', 'addon', 'hint', 'show-hint.js'], ['codemirror', 'mode', 'yaml', 'yaml.js'], ['codemirror', 'mode', 'python', 'python.js'], ['yamlmixed', 'yamlmixed.js'], ['codemirror', 'mode', 'markdown', 'markdown.js'], ['bootstrap-fileinput', 'js', 'plugins', 'piexif.min.js'], ['bootstrap-fileinput', 'js', 'fileinput.min.js'], ['bootstrap-fileinput', 'themes', 'fas', 'theme.min.js']]: +// // ... +function playground_js_bundle() { + /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ + let container_path = `docassemble_webapp/docassemble/webapp/static/`; + let target_path = `${ container_path }app/playgroundbundle.js`; + let filepaths = [ + `${ container_path }areyousure/jquery.are-you-sure.js`, + `${ container_path }codemirror/lib/codemirror.js`, + `${ container_path }codemirror/addon/search/searchcursor.js`, + `${ container_path }codemirror/addon/scroll/annotatescrollbar.js`, + `${ container_path }codemirror/addon/search/matchesonscrollbar.js`, + `${ container_path }codemirror/addon/display/fullscreen.js`, + `${ container_path }codemirror/addon/edit/matchbrackets.js`, + `${ container_path }codemirror/addon/hint/show-hint.js`, + `${ container_path }codemirror/mode/yaml/yaml.js`, + `${ container_path }codemirror/mode/python/python.js`, + `${ container_path }yamlmixed/yamlmixed.js`, + `${ container_path }codemirror/mode/markdown/markdown.js`, + `${ container_path }bootstrap-fileinput/js/plugins/piexif.min.js`, + `${ container_path }bootstrap-fileinput/js/fileinput.min.js`, + `${ container_path }bootstrap-fileinput/themes/fas/theme.min.js`, + ]; + bundle( target_path, filepaths ); +}; + + +// wget -q -O docassemble_webapp/docassemble/webapp/static/app/adminbundle.js http://localhost/adminbundle.js +// @app.route('/adminbundle.js', methods=['GET']) +// def js_admin_bundle(): +// // ... +// for parts in [['app', 'jquery.min.js'], ['bootstrap', 'js', 'bootstrap.bundle.min.js']]: +// // ... +function js_admin_bundle() { + /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ + let container_path = `docassemble_webapp/docassemble/webapp/static/`; + let target_path = `${ container_path }app/adminbundle.js`; + let filepaths = [ + `${ container_path }app/jquery.min.js`, + `${ container_path }bootstrap/js/bootstrap.bundle.min.js`, + ]; + bundle( target_path, filepaths ); +}; + +// wget -q -O docassemble_webapp/docassemble/webapp/static/app/bundlewrapjquery.js http://localhost/bundlewrapjquery.js +// @app.route('/bundlewrapjquery.js', methods=['GET']) +// def js_bundle_wrap(): +// base_path = pkg_resources.resource_filename(pkg_resources.Requirement.parse('docassemble.webapp'), os.path.join('docassemble', 'webapp', 'static')) +// output = '(function($) {' +// for parts in [['app', 'jquery.validate.min.js'], ['app', 'additional-methods.min.js'], ['app', 'jquery.visible.js'], ['bootstrap', 'js', 'bootstrap.bundle.min.js'], ['bootstrap-slider', 'dist', 'bootstrap-slider.min.js'], ['bootstrap-fileinput', 'js', 'plugins', 'piexif.min.js'], ['bootstrap-fileinput', 'js', 'fileinput.min.js'], ['bootstrap-fileinput', 'themes', 'fas', 'theme.min.js'], ['app', 'app.min.js'], ['labelauty', 'source', 'jquery-labelauty.min.js'], ['bootstrap-combobox', 'js', 'bootstrap-combobox.min.js'], ['app', 'socket.io.min.js']]: +// // ... +// output += '})(jQuery);' +function js_bundle_wrap() { + /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ + let container_path = `docassemble_webapp/docassemble/webapp/static/`; + let target_path = `${ container_path }app/bundlewrapjquery.js`; + let filepaths = [ + `${ container_path }app/jquery.validate.min.js`, + `${ container_path }app/additional-methods.min.js`, + `${ container_path }app/jquery.visible.js`, + `${ container_path }bootstrap/js/bootstrap.bundle.min.js`, + `${ container_path }bootstrap-slider/dist/bootstrap-slider.min.js`, + `${ container_path }bootstrap-fileinput/js/plugins/piexif.min.js`, + `${ container_path }bootstrap-fileinput/js/fileinput.min.js`, + `${ container_path }bootstrap-fileinput/themes/fas/theme.min.js`, + `${ container_path }app/app.min.js`, + `${ container_path }labelauty/source/jquery-labelauty.min.js`, + `${ container_path }bootstrap-combobox/js/bootstrap-combobox.min.js`, + `${ container_path }app/socket.io.min.js`, + ]; + let extra_start = `(function($) {\n`; + let extra_end = `})(jQuery);`; + bundle( target_path, filepaths, extra_start, extra_end ); +}; + + +// wget -q -O docassemble_webapp/docassemble/webapp/static/app/bundlenojquery.js http://localhost/bundlenojquery.js +// @app.route('/bundlenojquery.js', methods=['GET']) +// def js_bundle_no_query(): +// // ... +// for parts in [['app', 'jquery.validate.min.js'], ['app', 'additional-methods.min.js'], ['app', 'jquery.visible.min.js'], ['bootstrap', 'js', 'bootstrap.bundle.min.js'], ['bootstrap-slider', 'dist', 'bootstrap-slider.min.js'], ['bootstrap-fileinput', 'js', 'plugins', 'piexif.min.js'], ['bootstrap-fileinput', 'js', 'fileinput.min.js'], ['bootstrap-fileinput', 'themes', 'fas', 'theme.min.js'], ['app', 'app.min.js'], ['labelauty', 'source', 'jquery-labelauty.min.js'], ['bootstrap-combobox', 'js', 'bootstrap-combobox.min.js'], ['app', 'socket.io.min.js']]: +// // ... +function js_bundle_no_query() { + /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ + let container_path = `docassemble_webapp/docassemble/webapp/static/`; + let target_path = `${ container_path }app/bundlenojquery.js`; + let filepaths = [ + `${ container_path }app/jquery.validate.min.js`, + `${ container_path }app/additional-methods.min.js`, + `${ container_path }app/jquery.visible.min.js`, + `${ container_path }bootstrap/js/bootstrap.bundle.min.js`, + `${ container_path }bootstrap-slider/dist/bootstrap-slider.min.js`, + `${ container_path }bootstrap-fileinput/js/plugins/piexif.min.js`, + `${ container_path }bootstrap-fileinput/js/fileinput.min.js`, + `${ container_path }bootstrap-fileinput/themes/fas/theme.min.js`, + `${ container_path }app/app.min.js`, + `${ container_path }labelauty/source/jquery-labelauty.min.js`, + `${ container_path }bootstrap-combobox/js/bootstrap-combobox.min.js`, + `${ container_path }app/socket.io.min.js`, + ]; + bundle( target_path, filepaths ); +}; + + +function bundle( pathToOverwrite, pathsToBundle, extra_start='', extra_end='' ) { + fs.writeFileSync( pathToOverwrite, `` ); + for ( let filepath of pathsToBundle ) { + let contents = fs.readFileSync( filepath ); + fs.appendFileSync( pathToOverwrite, `\n${ extra_start }${ contents }${ extra_end }`); + } +}; // Ends bundle() + + +// Bundle everything +css_bundle(); +playground_css_bundle(); +js_bundle(); +playground_js_bundle(); +js_admin_bundle(); +js_bundle_wrap(); +js_bundle_no_query(); + + +console.log(`Done bundling ".../app"`); + + +// su www-data +// source /usr/share/docassemble/local3.10/bin/activate +// pip install --no-deps --no-index --upgrade --force-reinstall ./docassemble_base ./docassemble_webapp ./docassemble && exit + +// let result = cp.execSync('su www-data');//, {env: {'PATH': '/tmp/docassemble'}}); +// console.log( result ); +// cp.execSync('source /usr/share/docassemble/local3.10/bin/activate'); +// cp.execSync('pip install --no-deps --no-index --upgrade --force-reinstall ./docassemble_base ./docassemble_webapp ./docassemble && exit'); + From e11b9a292d354c458fdbeb5751fc69da3ccfb8a5 Mon Sep 17 00:00:00 2001 From: plocket <52798256+plocket@users.noreply.github.com> Date: Wed, 1 Feb 2023 09:11:45 -0500 Subject: [PATCH 2/2] Allow compiling files without restarting server for local deving --- .../app/{bundle_app.mjs => bundle_webapp.js} | 85 ++++--------------- 1 file changed, 17 insertions(+), 68 deletions(-) rename docassemble_webapp/docassemble/webapp/static/app/{bundle_app.mjs => bundle_webapp.js} (57%) diff --git a/docassemble_webapp/docassemble/webapp/static/app/bundle_app.mjs b/docassemble_webapp/docassemble/webapp/static/app/bundle_webapp.js similarity index 57% rename from docassemble_webapp/docassemble/webapp/static/app/bundle_app.mjs rename to docassemble_webapp/docassemble/webapp/static/app/bundle_webapp.js index 348b99cf7..cabb34b66 100644 --- a/docassemble_webapp/docassemble/webapp/static/app/bundle_app.mjs +++ b/docassemble_webapp/docassemble/webapp/static/app/bundle_webapp.js @@ -1,30 +1,26 @@ -/** -* Copying code from server.py to help local development of app folder -* to run on the command line: -* npm install fs -* node docassemble_webapp/docassemble/webapp/static/app/bundle_app.mjs -* su www-data -* source /usr/share/docassemble/local3.10/bin/activate -* pip install --no-deps --no-index --upgrade --force-reinstall ./docassemble_base ./docassemble_webapp ./docassemble && exit +/** Help with local development in the webapp/static dir by copying code from server.py. +* If a file is added to the server.py lists, it needs to be added here too. +* +* To run on the command line in your running docker container: +docker exec -it your_docker_container_name /bin/bash +cd /tmp/docassemble +node docassemble_webapp/docassemble/webapp/static/app/bundle_webapp.js +su www-data +source /usr/share/docassemble/local3.10/bin/activate +pip install --no-deps --no-index --upgrade --force-reinstall ./docassemble_base ./docassemble_webapp ./docassemble ./docassemble_demo && exit +supervisorctl start reset +* +* Then wait for the server to restart. You can pip install fewer of those +* directories if you know what you're doing. */ +let fs = require('fs'); -// Must `npm install` all libs used in here. Can't do that from inside here. -import fs from 'fs'; -import * as cp from 'child_process'; - -// Destination will be created or overwritten by default. // No minification. That can be done at the very end with a command like // minify docassemble_webapp/docassemble/webapp/static/app/app.js > docassemble_webapp/docassemble/webapp/static/app/app.min.js fs.copyFileSync('docassemble_webapp/docassemble/webapp/static/app/app.js', 'docassemble_webapp/docassemble/webapp/static/app/app.min.js'); -// Q: Are there any other things that need to be copied over? fs.copyFileSync('docassemble_webapp/docassemble/webapp/static/app/app.css', 'docassemble_webapp/docassemble/webapp/static/app/app.min.css'); -// wget -q -O docassemble_webapp/docassemble/webapp/static/app/bundle.css http://localhost/bundle.css // @app.route('/bundle.css', methods=['GET']) -// def css_bundle(): -// // ... -// for parts in [['bootstrap-fileinput', 'css', 'fileinput.min.css'], ['labelauty', 'source', 'jquery-labelauty.min.css'], ['bootstrap-combobox', 'css', 'bootstrap-combobox.min.css'], ['bootstrap-slider', 'dist', 'css', 'bootstrap-slider.min.css'], ['app', 'app.min.css']]: -// // ... function css_bundle() { /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ let container_path = `docassemble_webapp/docassemble/webapp/static/`; @@ -39,12 +35,7 @@ function css_bundle() { bundle( target_path, filepaths ); }; -// wget -q -O docassemble_webapp/docassemble/webapp/static/app/playgroundbundle.css http://localhost/playgroundbundle.css // @app.route('/playgroundbundle.css', methods=['GET']) -// def playground_css_bundle(): -// // ... -// for parts in [['codemirror', 'lib', 'codemirror.css'], ['codemirror', 'addon', 'search', 'matchesonscrollbar.css'], ['codemirror', 'addon', 'display', 'fullscreen.css'], ['codemirror', 'addon', 'scroll', 'simplescrollbars.css'], ['codemirror', 'addon', 'hint', 'show-hint.css'], ['app', 'pygments.min.css'], ['bootstrap-fileinput', 'css', 'fileinput.min.css']]: -// // ... function playground_css_bundle() { /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ let container_path = `docassemble_webapp/docassemble/webapp/static/`; @@ -61,12 +52,7 @@ function playground_css_bundle() { bundle( target_path, filepaths ); }; -//wget -q -O docassemble_webapp/docassemble/webapp/static/app/bundle.js http://localhost/bundle.js // @app.route('/bundle.js', methods=['GET']) -// def js_bundle(): -// // ... -// for parts in [['app', 'jquery.min.js'], ['app', 'jquery.validate.min.js'], ['app', 'additional-methods.min.js'], ['app', 'jquery.visible.min.js'], ['bootstrap', 'js', 'bootstrap.bundle.min.js'], ['bootstrap-slider', 'dist', 'bootstrap-slider.min.js'], ['labelauty', 'source', 'jquery-labelauty.min.js'], ['bootstrap-fileinput', 'js', 'plugins', 'piexif.min.js'], ['bootstrap-fileinput', 'js', 'fileinput.min.js'], ['bootstrap-fileinput', 'themes', 'fas', 'theme.min.js'], ['app', 'app.min.js'], ['bootstrap-combobox', 'js', 'bootstrap-combobox.min.js'], ['app', 'socket.io.min.js']]: -// // ... function js_bundle() { /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ let container_path = `docassemble_webapp/docassemble/webapp/static/`; @@ -90,13 +76,7 @@ function js_bundle() { bundle( target_path, filepaths, extra_start ); }; - -// wget -q -O docassemble_webapp/docassemble/webapp/static/app/playgroundbundle.js http://localhost/playgroundbundle.js // @app.route('/playgroundbundle.js', methods=['GET']) -// def playground_js_bundle(): -// // ... -// for parts in [['areyousure', 'jquery.are-you-sure.js'], ['codemirror', 'lib', 'codemirror.js'], ['codemirror', 'addon', 'search', 'searchcursor.js'], ['codemirror', 'addon', 'scroll', 'annotatescrollbar.js'], ['codemirror', 'addon', 'search', 'matchesonscrollbar.js'], ['codemirror', 'addon', 'display', 'fullscreen.js'], ['codemirror', 'addon', 'edit', 'matchbrackets.js'], ['codemirror', 'addon', 'hint', 'show-hint.js'], ['codemirror', 'mode', 'yaml', 'yaml.js'], ['codemirror', 'mode', 'python', 'python.js'], ['yamlmixed', 'yamlmixed.js'], ['codemirror', 'mode', 'markdown', 'markdown.js'], ['bootstrap-fileinput', 'js', 'plugins', 'piexif.min.js'], ['bootstrap-fileinput', 'js', 'fileinput.min.js'], ['bootstrap-fileinput', 'themes', 'fas', 'theme.min.js']]: -// // ... function playground_js_bundle() { /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ let container_path = `docassemble_webapp/docassemble/webapp/static/`; @@ -122,12 +102,7 @@ function playground_js_bundle() { }; -// wget -q -O docassemble_webapp/docassemble/webapp/static/app/adminbundle.js http://localhost/adminbundle.js // @app.route('/adminbundle.js', methods=['GET']) -// def js_admin_bundle(): -// // ... -// for parts in [['app', 'jquery.min.js'], ['bootstrap', 'js', 'bootstrap.bundle.min.js']]: -// // ... function js_admin_bundle() { /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ let container_path = `docassemble_webapp/docassemble/webapp/static/`; @@ -139,14 +114,7 @@ function js_admin_bundle() { bundle( target_path, filepaths ); }; -// wget -q -O docassemble_webapp/docassemble/webapp/static/app/bundlewrapjquery.js http://localhost/bundlewrapjquery.js // @app.route('/bundlewrapjquery.js', methods=['GET']) -// def js_bundle_wrap(): -// base_path = pkg_resources.resource_filename(pkg_resources.Requirement.parse('docassemble.webapp'), os.path.join('docassemble', 'webapp', 'static')) -// output = '(function($) {' -// for parts in [['app', 'jquery.validate.min.js'], ['app', 'additional-methods.min.js'], ['app', 'jquery.visible.js'], ['bootstrap', 'js', 'bootstrap.bundle.min.js'], ['bootstrap-slider', 'dist', 'bootstrap-slider.min.js'], ['bootstrap-fileinput', 'js', 'plugins', 'piexif.min.js'], ['bootstrap-fileinput', 'js', 'fileinput.min.js'], ['bootstrap-fileinput', 'themes', 'fas', 'theme.min.js'], ['app', 'app.min.js'], ['labelauty', 'source', 'jquery-labelauty.min.js'], ['bootstrap-combobox', 'js', 'bootstrap-combobox.min.js'], ['app', 'socket.io.min.js']]: -// // ... -// output += '})(jQuery);' function js_bundle_wrap() { /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ let container_path = `docassemble_webapp/docassemble/webapp/static/`; @@ -170,13 +138,7 @@ function js_bundle_wrap() { bundle( target_path, filepaths, extra_start, extra_end ); }; - -// wget -q -O docassemble_webapp/docassemble/webapp/static/app/bundlenojquery.js http://localhost/bundlenojquery.js // @app.route('/bundlenojquery.js', methods=['GET']) -// def js_bundle_no_query(): -// // ... -// for parts in [['app', 'jquery.validate.min.js'], ['app', 'additional-methods.min.js'], ['app', 'jquery.visible.min.js'], ['bootstrap', 'js', 'bootstrap.bundle.min.js'], ['bootstrap-slider', 'dist', 'bootstrap-slider.min.js'], ['bootstrap-fileinput', 'js', 'plugins', 'piexif.min.js'], ['bootstrap-fileinput', 'js', 'fileinput.min.js'], ['bootstrap-fileinput', 'themes', 'fas', 'theme.min.js'], ['app', 'app.min.js'], ['labelauty', 'source', 'jquery-labelauty.min.js'], ['bootstrap-combobox', 'js', 'bootstrap-combobox.min.js'], ['app', 'socket.io.min.js']]: -// // ... function js_bundle_no_query() { /** WARNING: If you change the file list in here, you have to change it in ...app/server.py as well. */ let container_path = `docassemble_webapp/docassemble/webapp/static/`; @@ -205,8 +167,7 @@ function bundle( pathToOverwrite, pathsToBundle, extra_start='', extra_end='' ) let contents = fs.readFileSync( filepath ); fs.appendFileSync( pathToOverwrite, `\n${ extra_start }${ contents }${ extra_end }`); } -}; // Ends bundle() - +}; // Bundle everything css_bundle(); @@ -217,16 +178,4 @@ js_admin_bundle(); js_bundle_wrap(); js_bundle_no_query(); - -console.log(`Done bundling ".../app"`); - - -// su www-data -// source /usr/share/docassemble/local3.10/bin/activate -// pip install --no-deps --no-index --upgrade --force-reinstall ./docassemble_base ./docassemble_webapp ./docassemble && exit - -// let result = cp.execSync('su www-data');//, {env: {'PATH': '/tmp/docassemble'}}); -// console.log( result ); -// cp.execSync('source /usr/share/docassemble/local3.10/bin/activate'); -// cp.execSync('pip install --no-deps --no-index --upgrade --force-reinstall ./docassemble_base ./docassemble_webapp ./docassemble && exit'); - +console.log(`Done bundling ".../webapp/static" files`);