From 18d7a3e7b18a1554c7e5b8cebee903e4eef4f93b Mon Sep 17 00:00:00 2001 From: David Ashby Date: Wed, 11 Oct 2023 21:37:28 -0400 Subject: [PATCH] add this fancy recent changes module --- Dockerfile | 2 +- css/site.css | 10 +++ index.html | 199 ++++++++++++++++++++++++++++----------------------- index.js | 24 +++++++ 4 files changed, 145 insertions(+), 90 deletions(-) diff --git a/Dockerfile b/Dockerfile index a2deb1d..e6d83b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20-slim AS builder +FROM node:20 AS builder COPY . /src WORKDIR /src diff --git a/css/site.css b/css/site.css index 15c5e95..5721fc9 100644 --- a/css/site.css +++ b/css/site.css @@ -161,6 +161,16 @@ ul.nav li a:hover { line-height: 22px; text-align: justify; } +#info details { + font-size: 15px; + padding: 4px; + line-height: 22px; + text-align: justify; +} +#info details summary { + text-decoration: underline; + cursor: pointer; +} #Stores { margin: 0 auto; diff --git a/index.html b/index.html index 9ae2064..5114f3c 100644 --- a/index.html +++ b/index.html @@ -1,8 +1,8 @@ - @@ -31,7 +31,7 @@ media="screen" rel="stylesheet" type="text/css" - href="/css/site.css?1678239113605" + href="/css/site.css?1697074571690" />

- There are currently 111 stores indexed + There are currently 114 stores indexed on this page. Last updated - March 7, 2023. + October 11, 2023.

+
+ Recent Changes + +
@@ -159,7 +170,7 @@ 1804 Books - 320 W 37th Street, New York + 320 W 37th St, New York 192 Books @@ -167,7 +178,7 @@ Adanne - 234 Water Street, Brooklyn + 234 Water St, Brooklyn Aeon Bookstore @@ -183,7 +194,7 @@ Archestratus - 160 Huron St, Brooklyn + 164 Huron St, Brooklyn Argosy Books @@ -191,24 +202,24 @@ Astoria Bookshop - 31-29 31st St, Astoria + 36-19 30th St, Astoria - Avoid The Day Bookstore & Cafe - 99-04 A Rockaway Beach Blvd, Rockaway Park - - Berl's Brooklyn Poetry Shop 126A Front St, Brooklyn - + Better Read Than Dead 867 Broadway, Brooklyn - + Better Read Than Dead & Burly Coffee 90 Kosciuszko St, Brooklyn + + Black Spring Books + 672 Driggs Ave, Brooklyn + Bluestockings Cooperative 116 Suffolk Street, New York @@ -275,7 +286,7 @@ Burnt Books - 1014 Manhattan Ave, Brooklyn + 157 Huron St, Brooklyn Cafe con Libros @@ -283,7 +294,7 @@ Catland - 987 Flushing Ave, Brooklyn + 985 Flushing Ave, Brooklyn Chartwell Booksellers @@ -307,7 +318,7 @@ Dear Friend Books - 343A Tompkins Avenue, Brooklyn + 343A Tompkins Ave, Brooklyn Desert Island Comics @@ -330,62 +341,60 @@ 686 Fulton St, Brooklyn - - Greenlight Bookstore (Prospect Lefferts Gardens) - - 632 Flatbush Ave, Brooklyn - - Here's A Book Store 1964 Coney Island Ave, Brooklyn - + Hey Kids! Comics 157 Huron St, Brooklyn - + Housing Works Bookstore Café 126 Crosby St, New York - + Human Relations Books 1067 Flushing Ave, Brooklyn - + Idlewild Books 170 7th Avenue S, New York - + James Cummins Bookseller 699 Madison Ave, 7th Floor, New York - + Joanne Hendricks Cookbooks 488 Greenwich St, New York - + Karma Bookstore 136 East Third St, New York - + Kew & Willow Books 81-63 Lefferts Boulevard, New York - + Kinokunya 1073 Avenue of the Americas, New York - + Kitchen Arts & Letters 1435 Lexington Ave, New York - + Leaves Bookstore 140 Nassau Ave, Brooklyn - + Left Bank Books - 41 Perry Street, New York + 41 Perry St, New York + + + Lofty Pigeon Books + 743 Church Ave, Brooklyn Logos Bookstore @@ -397,7 +406,7 @@ McNally Jackson Books - 52 Prince St, New York + 134 Prince St, New York McNally Jackson Books City Point @@ -437,173 +446,185 @@ P&T Knitwear - 180 Orchard Street, New York + 180 Orchard St, New York + Passageway Books + 150 9th Ave, New York + + Pillow-Cat Books 328 East 9th St, New York - + Posman Books Chelsea Market 75 9th Avenue, New York - - POWERHOUSE @ IC - 220 36th Street, Building #2, Brooklyn - + POWERHOUSE @ IC + 220 36th St, Building #2, Brooklyn + + POWERHOUSE Arena 28 Adams St, Brooklyn - + POWERHOUSE on 8th 1111 8th Ave, Brooklyn - + Printed Matter 231 11th Ave, New York - + Printed Matter St. Marks 38 St. Marks Pl, New York - + Quest Bookshop 240 E 53rd St, New York - - Quimby's Bookstore - 536 Metropolitan Avenue, Brooklyn - + Quimby's Bookstore + 536 Metropolitan Ave, Brooklyn + + Recirculation 876 Riverside Dr, New York - + Respect For Life Books-N-Things 537 Nostrand Ave, Brooklyn - + Revolution Books 437 Malcolm X Blvd, New York - + Rizzoli Bookstore 1133 Broadway, New York - + Shakespeare & Company 939 Lexington Ave, New York - + Shakespeare & Company (Upper West Side) 2020 Broadway, New York - + Sister's Uptown Bookstore 1942 Amsterdam Ave, New York - + Spoonbill & Sugartown, Booksellers 218 Bedford Ave, Brooklyn - + Standards Manual 212 Franklin Street, Brooklyn - + Strand Bookstore 828 Broadway, New York - + Sweet Pickle Books 47 Orchard St, New York - + + Taylor & Co. Books + 1021 Cortelyou Rd, Brooklyn + + Terrace Books 242 Prospect Park West, Brooklyn - + The Austin Book Shop 104-29 Jamaica Ave, Richmond Hill - + The Book Cellar 1465 York Ave, New York - + The Center for Fiction 15 Lafayette Ave, Brooklyn - + The Corner Bookstore 1313 Madison Ave, New York - + The Drama Book Shop 266 W 39th St, New York - + The Lit. Bar 131 Alexander Ave, Bronx - + The Mysterious Bookshop 58 Warren St, New York - - The Strand At Columbus Ave - 450 Columbus Avenue, New York - - - The Word Is Change - 368 Tompkins Avenue, Brooklyn - + The Ripped Bodice + 218 5th Ave, Brooklyn + + + The Strand At Columbus Ave + 450 Columbus Ave, New York + + + The Word Is Change + 368 Tompkins Ave, Brooklyn + + Three Lives & Company 238 West 10th St, New York - + Topos Bookstore Cafe 788 Woodward Ave, Brooklyn - + Troubled Sleep Books 129 6th Ave, Brooklyn - + Turn The Page... Again 39-15a Bell Blvd, Flushing - + Unnameable Books 600 Vanderbilt Ave, Brooklyn - + Ursus Books 50 East 78th St, Suite 1C, New York - + Westsider Rare & Used Books 2246 Broadway, New York - + Westsider Records 233 West 72nd St, New York - + Word Bookstore 126 Franklin St, Brooklyn - + Word Up Books 2113 Amsterdam Ave, New York - + Yu and Me Books - 44 Mulberry St, New York + 115 Delancey St Stall #11, New York diff --git a/index.js b/index.js index 78a6ee2..de0f7e3 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,29 @@ import { load } from "cheerio"; import { readFile, writeFile } from "fs"; +import process from "child_process"; import stores from "./stores.json" assert { type: "json" }; +function GetRecentChanges() { + const res = process + .execSync('git log -4 --pretty=format:"%ct %s"') + .toString(); + return res.split("\n"); +} + +function ChangeLog(logs) { + let res = "\n"; + logs.forEach((l, i) => { + const s = l.split(" "); + const date = new Date(s[0] * 1000).toLocaleDateString("en-US", { + year: "numeric", + month: "long", + day: "numeric", + }); + res = res + `
  • ${date} - ${s.slice(1).join(" ")}
  • \n`; + }); + return res; +} + function TableViewTemplate(rows) { let table = ""; rows.forEach((row, key) => { @@ -20,6 +42,7 @@ function TableRowTemplate({ rowNumber, name, address, city }) { } readFile("./index.html", function (err, data) { + const changeList = GetRecentChanges(); if (err) { throw err; } @@ -40,6 +63,7 @@ readFile("./index.html", function (err, data) { day: "numeric", }) ); + $("#changesList").html(ChangeLog(changeList)); const cssurl = $("link[type='text/css']").attr("href").split("?")[0]; $("link[type='text/css']").attr("href", cssurl + "?" + new Date().getTime()); writeFile("./index.html", $.html(), (err) => {