@chriswiegman/hugo-tools 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +28 -2
- package/package.json +2 -2
- package/src/book.mjs +616 -13
- package/src/book.test.mjs +621 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,29 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
|
6
6
|
and is generated by [Changie](https://github.com/miniscruff/changie).
|
|
7
7
|
|
|
8
|
+
## 0.3.0 - 2026-07-19
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* book: populate reference.isbn and reference.asin in book front matter, backfilling existing files and looking up ASIN via Open Library, Google Books, or a configured Amazon Product Advertising API
|
|
13
|
+
* book: add opt-in cover art fetching (--covers) — downloads cover images from Open Library or Google Books by ISBN, saves them under coversDir, and sets the cover front matter field
|
|
14
|
+
* book: flag books where Goodreads' "Read Count" exceeds the number of finished dates on file, since the CSV export only ever carries the most recent read date — a printed NOTE nudges you to add earlier read dates by hand
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* book: strip a UTF-8 byte-order mark from the Goodreads CSV if present, so exports saved with a BOM no longer fail column detection
|
|
19
|
+
|
|
20
|
+
## 0.2.2 - 2026-07-19
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* book: update rating from Goodreads only when it differs and Goodreads has an actual rating, so manually-set ratings in markdown aren't overwritten by an unrated (0) Goodreads entry
|
|
25
|
+
|
|
26
|
+
### Chores
|
|
27
|
+
|
|
28
|
+
* Update project dependencies.
|
|
29
|
+
* Fix no-console warnings during linting.
|
|
30
|
+
|
|
8
31
|
## 0.2.1 - 2026-07-04
|
|
9
32
|
|
|
10
33
|
### Chores
|
package/README.md
CHANGED
|
@@ -78,6 +78,7 @@ Or create `.hugo-tools.json` manually:
|
|
|
78
78
|
"notesDir": "content/notes",
|
|
79
79
|
"booksDir": "content/books",
|
|
80
80
|
"imagesDir": "assets/images",
|
|
81
|
+
"coversDir": "assets/images/books",
|
|
81
82
|
"vscodeDir": ".vscode"
|
|
82
83
|
}
|
|
83
84
|
```
|
|
@@ -243,16 +244,41 @@ Clipboard support (no-content-file mode): macOS (`pbcopy`), Windows (`clip`), Li
|
|
|
243
244
|
Imports books from a [Goodreads CSV export](https://www.goodreads.com/review/import) into Hugo content files under `booksDir`.
|
|
244
245
|
|
|
245
246
|
```sh
|
|
246
|
-
import-books path/to/goodreads_library_export.csv
|
|
247
|
+
import-books path/to/goodreads_library_export.csv [--covers]
|
|
247
248
|
```
|
|
248
249
|
|
|
249
250
|
**What it does:**
|
|
250
251
|
|
|
251
252
|
- Creates `content/books/<author-slug>/<title-slug>.md` for each book on your "read" shelf
|
|
252
|
-
- Front matter includes title, author, star rating, finish date(s),
|
|
253
|
+
- Front matter includes title, author, star rating, finish date(s), links to Amazon, Open Library, and Goodreads, a `reference: { isbn, asin }` block, and a `cover` field
|
|
253
254
|
- Any Goodreads review text becomes the file body
|
|
254
255
|
- Safe to re-run: existing files are matched by Goodreads ID or ISBN, finish dates are merged, and unchanged files are skipped
|
|
255
256
|
- If a book's title changed in Goodreads, the file is renamed automatically
|
|
257
|
+
- `reference.isbn`/`reference.asin` are backfilled onto existing files that are missing them — a value already in the file (e.g. entered by hand) is never overwritten
|
|
258
|
+
|
|
259
|
+
**Re-reads:** Goodreads' CSV export only ever contains the *most recent* "Date Read" for a book, even when its "Read Count" shows it was finished more than once. So if you re-read a book, the next export will carry the new completion date and it's automatically added to `finished` — nothing is ever overwritten or removed, dates only accumulate. What the export can't give you is *earlier* read dates for a book you'd already read more than once before you started tracking it here. When "Read Count" is higher than the number of dates already on file, the import prints a line like:
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
NOTE: king-stephen/the-gunslinger.md shows 3x read on Goodreads but only 1 date(s) on file — Goodreads only exports the latest read date, so add earlier ones to 'finished' by hand.
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
This is informational only — the file isn't touched, and nothing else about the import is blocked. Add the missing date(s) to the file's `finished:` list yourself; the note stops appearing once the counts match. A run's summary also reports how many books were flagged this way (`Rereads needing dates`).
|
|
266
|
+
|
|
267
|
+
**ASIN lookup:** Goodreads exports don't include an ASIN, so it's looked up per ISBN from Open Library, then Google Books, and left blank (`""`) if neither has one. To use the official Amazon Product Advertising API as a final fallback, add credentials to `.hugo-tools.json`:
|
|
268
|
+
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"amazonPaApi": {
|
|
272
|
+
"accessKey": "",
|
|
273
|
+
"secretKey": "",
|
|
274
|
+
"partnerTag": ""
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
This requires an approved Amazon Associates account with Product Advertising API access.
|
|
280
|
+
|
|
281
|
+
**Cover art:** off by default — pass `--covers` to fetch it. When enabled, each book's ISBN is looked up against Open Library's cover API, then Google Books, and left blank if neither has one. Downloaded images are saved to `coversDir` (default `assets/images/books/<author-slug>/<title-slug>.<ext>`) and the `cover` field is set to the corresponding Hugo URL path (e.g. `/images/books/king-stephen/it.jpg`). On existing files, only a blank `cover` field is backfilled — a cover already set (e.g. entered by hand) is never overwritten, and no network requests are made at all unless `--covers` is passed.
|
|
256
282
|
|
|
257
283
|
**To export from Goodreads:** Account → My Books → Import and Export → Export Library.
|
|
258
284
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chriswiegman/hugo-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A set of tools to make blogging easier with Hugo.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hugo",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@eslint/js": "^10.0.1",
|
|
48
48
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
49
49
|
"changie": "^1.25.0",
|
|
50
|
-
"eslint": "^10.
|
|
50
|
+
"eslint": "^10.7.0",
|
|
51
51
|
"globals": "^17.7.0"
|
|
52
52
|
}
|
|
53
53
|
}
|