pidgin/nest

c76fb0834ef9
Parents cb101196c33a
Children 19933bb48ed5
Update the update-lastmod.js file to use date from file

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.

Testing Done:
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.

Reviewed at https://reviews.imfreedom.org/r/640/
--- a/Dockerfile Tue May 04 22:01:16 2021 -0500
+++ b/Dockerfile Tue May 04 22:13:33 2021 -0500
@@ -2,7 +2,7 @@
# setup up our node environment
#####################################################################
-FROM node:10-buster-slim as node-update-date
+FROM node:14-buster-slim as node-update-date
WORKDIR /nest/
COPY package-lock.json package.json ./
RUN apt-get update && \
@@ -38,7 +38,7 @@
# setup up our node environment
#####################################################################
-FROM node:10-buster-slim as node-build
+FROM node:14-buster-slim as node-build
WORKDIR /nest/
COPY package-lock.json package.json ./
RUN npm ci --production && \
--- a/tools/update-lastmod.js Tue May 04 22:01:16 2021 -0500
+++ b/tools/update-lastmod.js Tue May 04 22:13:33 2021 -0500
@@ -34,7 +34,9 @@
getFrontMatter(file),
])
const lastmod = commits[0].date
- const date = commits[commits.length - 1].date
+ // If the md file has a date, use that. If it does not grab the date from
+ // the first commit.
+ const date = attributes.date ?? commits[commits.length - 1].date
const newFrontString = yaml
.dump({ ...attributes, lastmod, date }, yamlDumpSettings)
.trim()