<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-08-29 17:33 GMT-06:00 David Cook <span dir="ltr"><<a href="mailto:dcook@prosentient.com.au" target="_blank">dcook@prosentient.com.au</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-AU"><div class="m_-1958146696605507498WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Thanks for the info, Jesse. I haven’t reviewed Bugzilla or Github, but I just have a couple of questions.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">If I understand correctly, we’ll be bundling the Javascript packages in with Koha for deployment, is that right?</span></p></div></div></blockquote><div><br></div><div>Correct. After being built, all of the necessary JS (our own transpiled code and its dependencies) will be bundled together.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-AU"><div class="m_-1958146696605507498WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">If that’s the case, will only the build machine will need Nodejs, npm, yarn, Gulp, Browserify, Babel, etc? If so, then the onus of these additional dependencies is really just for developers or people installing from source? The Debian packages would just the transpiled versions of the Javascript? I imagine that would satisfy the community’s desire to just use upstream packages from Debian?</span></p></div></div></blockquote><div><br></div><div>Correct.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-AU"><div class="m_-1958146696605507498WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">For those of us who do install from source, would this transpiling process be automated via the Makefile? </span></p></div></div></blockquote><div><br></div><div>It easily could be. In my original email, the global install (sudo npm install -g) of yarn was purely for convenience. The entire process could become:<br><br></div><div>$ sudo apt install nodejs npm # or koha-builddeps or koha-jsdeps (or koha-perldeps if we feel like being lazy)<br></div><div>$ make build-js<br><br></div><div>Where the Makefile took care of downloading yarn, installing all the JS dependencies, and building the files.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-AU"><div class="m_-1958146696605507498WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">David Cook<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Systems Librarian<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Prosentient Systems<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">72/330 Wattle St<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Ultimo, NSW 2007<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Australia<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Office: 02 9212 0899<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Direct: 02 8005 0595<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"> <a href="mailto:koha-devel-bounces@lists.koha-community.org" target="_blank">koha-devel-bounces@lists.koha-<wbr>community.org</a> [mailto:<a href="mailto:koha-devel-bounces@lists.koha-community.org" target="_blank">koha-devel-bounces@<wbr>lists.koha-community.org</a>] <b>On Behalf Of </b>Jesse<br><b>Sent:</b> Wednesday, 30 August 2017 7:27 AM<br><b>To:</b> <a href="mailto:koha-devel@lists.koha-community.org" target="_blank">koha-devel@lists.koha-<wbr>community.org</a><br><b>Subject:</b> [Koha-devel] Proposal for ES6 development on the staff client<u></u><u></u></span></p><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><div><div><div><div><div><div><div><div><div><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">As part of my work on bug 15522 <<a href="https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15522" target="_blank">https://bugs.koha-community.<wbr>org/bugzilla3/show_bug.cgi?id=<wbr>15522</a>>, I've been working with Preact (a React clone with a friendlier license). We've established that this needs ES6[1] in previous discussions on the mailing list and in IRC. From there, we found IE's many limitations meant we needed a transpiler[2] to to make use of these features.<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">Owen and I have been thinking about the easiest way to do this, and this is the lowest-friction process we've come up with to transpile ES6:<u></u><u></u></p></div><p class="MsoNormal">$ sudo apt-get install nodejs npm<u></u><u></u></p></div><p class="MsoNormal">$ sudo npm install -g yarn<u></u><u></u></p></div><p class="MsoNormal">$ yarn install<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">$ yarn build<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">Yarn is a somewhat faster version of npm, the de-facto JavaScript package manager. Normally, this would be a pointless addition, but the npm in the Debian repositories is 3 major versions out of date, and therefore not a great option. Many npm packages simply fail to install.<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">This is a constant problem with the JS packages in the Debian repos; most if not all of the tools that one might want either are completely unpackaged or woefully out of date. Packaging them ourselves means working our way through a number of dependencies (see [3] for an example). Any frontend build process worth our time cannot solely use packages from the upstream repos.<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">That aside, this build process will use Gulp, Browserify and Babel to take any files in koha-tmpl/intranet-tmpl/prog/<wbr>js/src, and compile them into a matching file in koha-tmpl/intranet-tmpl/prog/<wbr>js/built . This means that any new files will not have to be manually whitelisted.<u></u><u></u></p></div><p class="MsoNormal">You can see a working example at <a href="https://github.com/pianohacker/koha" target="_blank">https://github.com/<wbr>pianohacker/koha</a>, branch bz15522. I'm currently committing the built versions of the files, but this is purely for convenience of prototyping. The page in question is admin/<a href="http://policy.pl" target="_blank">policy.pl</a>, and the relevant code is at .../prog/js/src/admin/policy.<wbr>js .<u></u><u></u></p><div><div><div><div><div><div><div><div><div><div><div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">[1] ECMAScript 6, a semi-recent version of JavaScript with a large number of new features, including a nice class syntax, arrow functions, and destructuring assignment.<u></u><u></u></p></div><div><p class="MsoNormal">[2] A tool that transforms ES6 syntax (and the JSX syntax extension used by (P)react) into something that can be run by older browsers, including IE.<br>[3] <a href="https://wiki.debian.org/Javascript/Nodejs/Tasks/gulp" target="_blank">https://wiki.debian.org/<wbr>Javascript/Nodejs/Tasks/gulp</a><u></u><u></u></p></div></div></div></div></div></div></div></div></div></div></div></div><p class="MsoNormal"><br clear="all"><br>-- <u></u><u></u></p><div><p class="MsoNormal">Jesse Weaver<u></u><u></u></p></div></div></div></div></div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Jesse Weaver</div>
</div></div>