Bug 26228 - Update gulpfile to work with Node.js v12
Summary: Update gulpfile to work with Node.js v12
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-17 14:24 UTC by Tomás Cohen Arazi
Modified: 2023-07-25 16:26 UTC (History)
8 users (show)

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


Attachments
Bug 26228: Update gulpfile to work with Node.js v12 (75.12 KB, patch)
2020-08-17 15:24 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 26228: Update gulpfile to work with Node.js v12 (76.34 KB, patch)
2020-08-17 15:37 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 26228: Update gulpfile to work with Node.js v12 (76.40 KB, patch)
2020-08-17 15:54 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 26228: Update gulpfile to work with Node.js v12 (76.46 KB, patch)
2020-08-17 16:10 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2020-08-17 14:24:55 UTC
Node.js v8 has gone EOL on december 2019. We need to shift the required version to v12, but we rely on old gulp and friends that need to be updated.
Comment 1 Tomás Cohen Arazi 2020-08-17 15:24:52 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi 2020-08-17 15:28:19 UTC
I'm not on the Node.js camp but I rewrote the gulpfile.js following the Gulp v4 docs and it is pretty trivial.
It works 'as it used to', so not a big deal IMHO.
I removed the try/catch block that actually hides problems (if gulp cannot be loaded it will actually explode saying so, so...).

TODO: gulp-util says it is deprecated and should be avoided. It's been like that for a while. They recommend minimist, but I didn't manage to make it work with our yarn build setup. Worth doing some short research on the subject.
Comment 3 Tomás Cohen Arazi 2020-08-17 15:37:08 UTC
Created attachment 108403 [details] [review]
Bug 26228: Update gulpfile to work with Node.js v12

This patch makes the gulpfile work with gulp v4 on Node v12. To test it,
make sure your dev env has Node.js v12.

It also replaces the use of 'gulp-util' (deprecated) by 'minimist' as
recommended on their site.

On both KTD and KohaDevBox edit your sources.list so the node line
points to 'node_12.x' instead of 'node_8.x'.

Once that's done:
1. On your clone run:
   $ yarn install
   $ npm install -E
2. Build the CSS:
   $ yarn build
   $ yarn build --view opac
=> SUCCESS: Things build correctly
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi 2020-08-17 15:38:05 UTC
(In reply to Tomás Cohen Arazi from comment #2)
> TODO: gulp-util says it is deprecated and should be avoided. It's been like
> that for a while. They recommend minimist, but I didn't manage to make it
> work with our yarn build setup. Worth doing some short research on the
> subject.

^^ dealt with. We now use 'minimist'.
Comment 5 Jonathan Druart 2020-08-17 15:46:28 UTC
yarn build displays this warning:
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
Comment 6 Jonathan Druart 2020-08-17 15:46:42 UTC
yarn install, not yarn build
Comment 7 Owen Leonard 2020-08-17 15:54:41 UTC
Created attachment 108407 [details] [review]
Bug 26228: Update gulpfile to work with Node.js v12

This patch makes the gulpfile work with gulp v4 on Node v12. To test it,
make sure your dev env has Node.js v12.

It also replaces the use of 'gulp-util' (deprecated) by 'minimist' as
recommended on their site.

On both KTD and KohaDevBox edit your sources.list so the node line
points to 'node_12.x' instead of 'node_8.x'.

Once that's done:
1. On your clone run:
   $ yarn install
   $ npm install -E
2. Build the CSS:
   $ yarn build
   $ yarn build --view opac
=> SUCCESS: Things build correctly
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 8 Jonathan Druart 2020-08-17 16:10:26 UTC
Created attachment 108411 [details] [review]
Bug 26228: Update gulpfile to work with Node.js v12

This patch makes the gulpfile work with gulp v4 on Node v12. To test it,
make sure your dev env has Node.js v12.

It also replaces the use of 'gulp-util' (deprecated) by 'minimist' as
recommended on their site.

On both KTD and KohaDevBox edit your sources.list so the node line
points to 'node_12.x' instead of 'node_8.x'.

Once that's done:
1. On your clone run:
   $ yarn install
   $ npm install -E
2. Build the CSS:
   $ yarn build
   $ yarn build --view opac
=> SUCCESS: Things build correctly
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Jonathan Druart 2020-08-18 15:48:31 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 10 Aleisha Amohia 2020-09-09 04:17:51 UTC
backported to 20.05.x for 20.05.04 (doing comment for Lucas)
Comment 11 Aleisha Amohia 2020-09-09 04:18:11 UTC
backported to 19.11.x for 19.11.10
Comment 12 Victor Grousset/tuxayo 2020-09-20 17:24:25 UTC
>    This patch makes the gulpfile work with gulp v4 on Node v12. To test it,
>    make sure your dev env has Node.js v12.

>     On both KTD and KohaDevBox edit your sources.list so the node line
>    points to 'node_12.x' instead of 'node_8.x'.

IIUC this means KTD needs also a patch to use node 12 to avoid having to do such a manual operation at every start of the environment.
Is that correct?
Comment 13 Victor Grousset/tuxayo 2020-09-20 17:33:09 UTC
Previous message ↑ in the context of backporting to 19.05.x but also to know if for the other branches, SCSS compilation is now more complicated than before.