Update the update-lastmod.js file to use date from file

Review Request #640 — Created May 4, 2021 and submitted

Information

pidgin/nest
default
86d70d85b922

Reviewers

The update-lastmod file was taking the first commit for the specific file and replacing the "date" attribute with the date of the commit. This fix sets the date as the attribute date if it exists and if it doesn't uses the first commit date.

  1. Build docker container
  2. Run docker container
  3. Run the update-lastmod.js script with node and verified that the files with dates stayed the same and ones without used the first commit.
Description From Last Updated

I like the usage of the Nullish coalescing operator to make things simpler compared to what I had implemented originally. …

sorvivalsorvival
sorvival
  1. 
      
  2. tools/update-lastmod.js (Diff revision 1)
     
     
    Show all issues

    I like the usage of the Nullish coalescing operator to make things simpler compared to what I had implemented originally.
    However, if I build the docker image as specified in the Dockerfile I get a syntax error "Unexpected token '?'".

    After searching around for a bit I believe we get this error because in the docker image we are using the debian buster based image of nodejs which includes node 12 but the Nullish coalescing operator became part of the standard in node 14.

    So either we define this logic in a different way or we change the base image to use the node 14 version of the debian based docker image. IMO we should just switch to a more recent docker image which uses node 14, even more so considering that node 14 is the latest LTS version of node. I did a quick test and everything still works as it should by just moving to node:14-buster-slim.

    1. Thanks for catching that. I had left the docker container running and was just testing it running the script, which worked with my local node 14x. I've pushed an update to the Dockerfile to bump it to the suggested node:14-buster-slim. I also tested it locally by rebuilding the container with the new image and it all worked as expected.

  3. 
      
alanhoskins@gmail.com
sorvival
  1. Ship It!
  2. 
      
grim
  1. Ship It!
  2. 
      
grim
Review request changed
Status:
Completed