uswds / uswds-compile

Simple Gulp 5 functions for copying USWDS static assets and transforming USWDS Sass into browser-readable CSS.
Other
20 stars 13 forks source link

Support nodejs not end of life #39

Closed danizen closed 2 years ago

danizen commented 2 years ago

Government institutions tend to update their tool suites a little slower than maybe we ought to. I have software I maintain to customize the front-end of https://catalog.nlm.nih.gov/ which will not work with Node 16+, and so I have Node 14 in my path. @uswds/uswds-compile doesn't work with this because "replaceAll" is not a function:

(medmarc) C:\Users\davisda4\Tools>node Welcome to Node.js v14.18.3. Type ".help" for more information.

var mystring = "asljdljjasdauo duasi ds groot is as person, groot"; undefined console.log(mystring) asljdljjasdauo duasi ds groot is as person, groot undefined console.log(mystring.replaceAll("groot", "Groot")) Uncaught TypeError: mystring.replaceAll is not a function

danizen commented 2 years ago

The failure occurs in fonts - https://github.com/uswds/uswds-compile/blob/develop/gulpfile.js#L113, but would occur in other tasks as well. That is just the first one.

danizen commented 2 years ago

I have tested now the workaround of using Node 16.3.2 which NLM OCCS/STB desktop support does install for us. It is not the default, and Node 12 (which is EOL) is still installed in my environment. The reason I think assuring backwards support is important is that developers in government may not even have admin rights to their PC. I used to, but no longer do.

danizen commented 2 years ago

I have updated our build to 3.0.1 - https://github.com/NLM-OCCS/nlm-uswds/. Note that I had to put some environment specific language there about Node 16+ in order to assure that anyone else could build this where I am.

thisisdano commented 2 years ago

This seems reasonable. Let's see what we can do.

mejiaj commented 2 years ago

Looks like replaceAll was introduced in Node v15 and 14 will be supported until April/May 2023. We could try using replace() instead.

image

Source - NodeJS Releases page