From 80742786965f77105009e13c3e7dc28897972c05 Mon Sep 17 00:00:00 2001 From: kevcenteno Date: Thu, 12 Oct 2023 14:02:52 -0400 Subject: [PATCH] Add lastUpdated value to maxmind server ip address list --- .eslintrc.js | 2 +- package.json | 6 ++--- src/components/IpAddresses.tsx | 23 +++++++++++++------ .../feeds/createServerIpAddressesFeed.ts | 7 ++---- static/maxmind-server-ip-addresses.json | 3 ++- test/matchers/toHaveNoBrokenLinks.ts | 2 +- 6 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index f42d7ed33..1181b1265 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -228,7 +228,7 @@ module.exports = { 'as-needed', ], quotes: [ - 'warn', + 'error', 'single', ], 'react-hooks/exhaustive-deps': 'warn', diff --git a/package.json b/package.json index 4b67c8540..559bcef5c 100644 --- a/package.json +++ b/package.json @@ -189,9 +189,9 @@ "develop": "gatsby clean && GATSBY_URL=http://localhost:8000 gatsby develop", "fix": "run-p fix:*", "fix:content": "prettier --write '**/*.mdx' --embedded-language-formatting off", - "fix:json": "npm run lint:json --fix", - "fix:scripts": "npm run lint:scripts --fix", - "fix:styles": "npm run lint:styles --fix", + "fix:json": "npm run lint:json -- --fix", + "fix:scripts": "npm run lint:scripts -- --fix", + "fix:styles": "npm run lint:styles -- --fix", "lint": "run-p lint:*", "lint:configs": "eslint .*rc.js --no-ignore", "lint:content": "prettier --check '**/*.mdx' --embedded-language-formatting off", diff --git a/src/components/IpAddresses.tsx b/src/components/IpAddresses.tsx index f5fe9a948..c94926f77 100644 --- a/src/components/IpAddresses.tsx +++ b/src/components/IpAddresses.tsx @@ -2,15 +2,24 @@ import * as React from 'react'; import MaxMindIpAddresses from '../../static/maxmind-server-ip-addresses.json'; import Example from './Example'; +import { p as P } from './Mdx'; + +const lastUpdated = new Date(MaxMindIpAddresses.lastUpdated).toUTCString(); const IpAddresses: React.FC = () => ( - - {MaxMindIpAddresses.IPv4.join('\n')} - {'\n'} - {MaxMindIpAddresses.IPv6.join('\n')} - + <> + + {MaxMindIpAddresses.IPv4.join('\n')} + {'\n'} + {MaxMindIpAddresses.IPv6.join('\n')} + +

+ Last updated: + {lastUpdated} +

+ ); export default IpAddresses; diff --git a/src/gatsby/gatsby-config/feeds/createServerIpAddressesFeed.ts b/src/gatsby/gatsby-config/feeds/createServerIpAddressesFeed.ts index 82e034412..868c9703d 100644 --- a/src/gatsby/gatsby-config/feeds/createServerIpAddressesFeed.ts +++ b/src/gatsby/gatsby-config/feeds/createServerIpAddressesFeed.ts @@ -8,11 +8,9 @@ export default (): any => ({ nodes { IPv4 IPv6 + lastUpdated } } - file { - modifiedTime - } site { siteMetadata { siteUrl @@ -23,10 +21,9 @@ export default (): any => ({ serialize: (args: any) => { const { query } = args; const { allJson } = query; - const { modifiedTime } = query.file; const { siteUrl } = query.site.siteMetadata; - const date = new Date(modifiedTime); + const date = new Date(allJson.nodes[0].lastUpdated); return [ { diff --git a/static/maxmind-server-ip-addresses.json b/static/maxmind-server-ip-addresses.json index 5a8515ffd..16f1027b5 100644 --- a/static/maxmind-server-ip-addresses.json +++ b/static/maxmind-server-ip-addresses.json @@ -10,5 +10,6 @@ "2606:4700::6810:252f", "2606:4700:7::a29f:8616", "2606:4700:7::a29f:8716" - ] + ], + "lastUpdated": "2021-06-30T22:15:51.000-04:00" } diff --git a/test/matchers/toHaveNoBrokenLinks.ts b/test/matchers/toHaveNoBrokenLinks.ts index ba7a37fca..b6e21499d 100644 --- a/test/matchers/toHaveNoBrokenLinks.ts +++ b/test/matchers/toHaveNoBrokenLinks.ts @@ -10,7 +10,7 @@ const toHaveNoBrokenLinks = (brokenLinks: any[]): any => { Page: ${brokenLink.base.original} ${BR} Broken Link Url: ${brokenLink.url.original} ${BR} Broken Link Text: ${brokenLink.html.text} ${BR} - Broken Link Selector: ${brokenLink.html.selector} ${BR}` + Broken Link Selector: ${brokenLink.html.selector} ${BR}`; return list; });