Bug 17241 - Start using Bower for installing and managing Koha's JavaScript Dependencies
Summary: Start using Bower for installing and managing Koha's JavaScript Dependencies
Status: CLOSED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Kyle M Hall
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-02 14:35 UTC by Kyle M Hall
Modified: 2022-11-11 10:33 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 17241 - Start using Bower for installing and managing Koha's JavaScript Dependencies (1.15 KB, patch)
2016-09-02 14:38 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 17241 - Replace existing version of requirejs with bower installed requirejs (101.98 KB, patch)
2016-09-02 14:38 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 17241 - Start using Bower for installing and managing Koha's JavaScript Dependencies (1.15 KB, patch)
2017-10-15 10:32 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 17241 - Replace existing version of requirejs with bower installed requirejs (102.03 KB, patch)
2017-10-15 10:32 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall 2016-09-02 14:35:14 UTC
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.
Comment 1 Kyle M Hall 2016-09-02 14:38:08 UTC
Created attachment 55139 [details] [review]
Bug 17241 - Start using Bower for installing and managing Koha's JavaScript Dependencies
Comment 2 Kyle M Hall 2016-09-02 14:38:16 UTC
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
Comment 3 Kyle M Hall 2016-09-02 14:43:33 UTC
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.
Comment 4 Andrew Isherwood 2016-10-12 08:00:33 UTC
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!)
Comment 5 Owen Leonard 2016-10-12 12:44:49 UTC
Would Bower supplement Webpack, or work with it somehow? If the latter, in what way does it build on what Webpack does?
Comment 6 Andrew Isherwood 2016-10-13 08:31:04 UTC
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.
Comment 7 Martin Renvoize 2016-10-19 08:30:00 UTC
https://www.quora.com/Why-use-Bower-when-there-is-npm makes for an interesting read around this exact topic
Comment 8 Katrin Fischer 2017-10-15 10:32:04 UTC
Created attachment 68160 [details] [review]
Bug 17241 - Start using Bower for installing and managing Koha's JavaScript Dependencies
Comment 9 Katrin Fischer 2017-10-15 10:32:08 UTC
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>
Comment 10 Katrin Fischer 2017-10-15 10:33:31 UTC
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
Comment 11 Marcel de Rooy 2018-01-05 07:37:00 UTC
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 ?
Comment 12 Kyle M Hall 2018-01-24 14:31:10 UTC
(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.
Comment 13 Katrin Fischer 2018-02-08 07:00:00 UTC
(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.
Comment 14 Victor Grousset/tuxayo 2019-04-10 12:27:45 UTC
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.
Comment 15 Owen Leonard 2019-04-10 12:38:52 UTC
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.
Comment 16 Kyle M Hall 2019-04-10 14:40:39 UTC
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.