[Koha-devel] Proposal for ES6 development on the staff client

David Cook dcook at prosentient.com.au
Wed Aug 30 01:33:21 CEST 2017


Thanks for the info, Jesse. I haven’t reviewed Bugzilla or Github, but I just have a couple of questions.

 

If I understand correctly, we’ll be bundling the Javascript packages in with Koha for deployment, is that right?

 

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? 

 

For those of us who do install from source, would this transpiling process be automated via the Makefile? 

 

David Cook

Systems Librarian

Prosentient Systems

72/330 Wattle St

Ultimo, NSW 2007

Australia

 

Office: 02 9212 0899

Direct: 02 8005 0595

 

From: koha-devel-bounces at lists.koha-community.org [mailto:koha-devel-bounces at lists.koha-community.org] On Behalf Of Jesse
Sent: Wednesday, 30 August 2017 7:27 AM
To: koha-devel at lists.koha-community.org
Subject: [Koha-devel] Proposal for ES6 development on the staff client

 

 

As part of my work on bug 15522 <https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15522>, 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.

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:

$ sudo apt-get install nodejs npm

$ sudo npm install -g yarn

$ yarn install

$ yarn build

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.

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.

That aside, this build process will use Gulp, Browserify and Babel to take any files in koha-tmpl/intranet-tmpl/prog/js/src, and compile them into a matching file in koha-tmpl/intranet-tmpl/prog/js/built . This means that any new files will not have to be manually whitelisted.

You can see a working example at https://github.com/pianohacker/koha, 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/policy.pl <http://policy.pl> , and the relevant code is at .../prog/js/src/admin/policy.js .

 

[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.

[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.
[3] https://wiki.debian.org/Javascript/Nodejs/Tasks/gulp



-- 

Jesse Weaver

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20170830/942ed560/attachment-0001.html>


More information about the Koha-devel mailing list