Bower is a modern web development tool to make installing, updating and managing JavaScript dependencies easy and is a good best-practice tool to use. As such, we should make use of Bower and begin putting our external library dependencies under the control of bower. We can start with something very simple; using bower to manage requirejs. This patch will switch to using a bower install version of requirejs that is the same version of requirejs we are already using.
Created attachment 55139 [details] [review] Bug 17241 - Start using Bower for installing and managing Koha's JavaScript Dependencies
Created attachment 55140 [details] [review] Bug 17241 - Replace existing version of requirejs with bower installed requirejs Test Plan: 1) Apply this patch set 2) Enable the advancedMARCeditor system preference 3) Attempt to edit a MARC record using the advanced editor 4) The editor should continue to load and function as previously
Also, if you want to play with Bower, installing it on Debian is pretty trivial: sudo apt-get install nodejs npm sudo ln -s /usr/bin/nodejs /usr/bin/node # Most node packages look for node, not nodejs sudo npm install bower -g Because we have separate lib directories on the staff and opac side, they will need to be managed separately ( unless we decide to unify them at some point ). This patch starts with the staff side.
Agreed that Bower is indeed a useful tool. In our case, does it offer any significant benefit over using npm to manage JS deps? Just asking the question, I'm a long time user of Bower and, while I don't love it, it does the job perfectly adequately. (First ever comment - hurrah!)
Would Bower supplement Webpack, or work with it somehow? If the latter, in what way does it build on what Webpack does?
Bower and npm both enable the management of JS packages and their dependencies, so one of those would be what we use to actually get and maintain the packages. Webpack, as I understand it, would enable us to pack up all our JS packages in an easily deliverable form (e.g. concatenated & minified). So, as I understand it, a front-end build process would require one of either Bower or npm AND Webpack.
https://www.quora.com/Why-use-Bower-when-there-is-npm makes for an interesting read around this exact topic
Created attachment 68160 [details] [review] Bug 17241 - Start using Bower for installing and managing Koha's JavaScript Dependencies
Created attachment 68161 [details] [review] Bug 17241 - Replace existing version of requirejs with bower installed requirejs Test Plan: 1) Apply this patch set 2) Enable the advancedMARCeditor system preference 3) Attempt to edit a MARC record using the advanced editor 4) The editor should continue to load and function as previously Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
This works nicely and I am signing off in order to get some attention to this. - How would using Bower change our processes? - What would be the next steps? - Add as a topic to next dev meeting? Also adding Owen in CC
Thinks this needs more discussion. Please put it on the agenda of a dev meeting. Why should we use it in view of the arguments listed in comment7's link ?
(In reply to Martin Renvoize from comment #7) > https://www.quora.com/Why-use-Bower-when-there-is-npm makes for an > interesting read around this exact topic That argument assumes we are using something like webpack, which we do not.
(In reply to Marcel de Rooy from comment #11) > Thinks this needs more discussion. > Please put it on the agenda of a dev meeting. Agree with Marcel, I think we need to talk about possible next steps.
Hi, Does now that we use Yarn [1] changes something in regard to this proposal? https://wiki.koha-community.org/wiki/Working_with_staff_client_SCSS [1] and looking at the instructions, and package.json, it seems that npm and gulp are also there as dependencies.
Looks like the developers of Bower are are recommending that people not choose Bower: "As you might have noticed, we started recommending Yarn as an alternative to Bower for new front-end projects" https://bower.io/blog/2017/how-to-migrate-away-from-bower/ I think that makes this bug "wontfix," but I do think we need to formulate a plan that achieves the goals of this bug using some other process.
Agreed. I imagine Yarn is probably the way to go. (In reply to Owen Leonard from comment #15) > Looks like the developers of Bower are are recommending that people not > choose Bower: > > "As you might have noticed, we started recommending Yarn as an alternative > to Bower for new front-end projects" > https://bower.io/blog/2017/how-to-migrate-away-from-bower/ > > I think that makes this bug "wontfix," but I do think we need to formulate a > plan that achieves the goals of this bug using some other process.