Skip to content

Refactor PDF build into three named commands with reviewer tracking - #270

Merged
mikemaccana merged 5 commits into
mainfrom
claude/keen-thompson-jrypmb
Oct 5, 2026
Merged

mikemaccana merged 5 commits into
mainfrom
claude/keen-thompson-jrypmb

Conversation

@mikemaccana

Copy link
Copy Markdown
Collaborator

Replace the single build-pdf command with three purpose-specific commands: build-pdf-digital for the finished book with cover and links, build-pdf-print for the KDP interior without cover or links, and build-pdf-draft for advance review copies. This makes the build process clearer and eliminates environment variable combinations.

Key changes:

  • Add --reviewer "<name>" flag to build-pdf.mjs to replace the REVIEWER_NAME environment variable, making reviewer tracking explicit in the command line
  • Enforce that draft builds require --reviewer and final builds refuse it, preventing accidental misconfigurations
  • Generate descriptive filenames that include build type labels (e.g., (draft, reviewer-name), (print interior)) so multiple builds coexist in build/ without overwriting
  • Define three npm scripts in package.json:
    • build-pdf-digital: FINAL=1 node scripts/build-pdf.mjs (finished book)
    • build-pdf-print: FINAL=1 NO_COVER=1 NO_LINKS=1 node scripts/build-pdf.mjs (KDP interior)
    • build-pdf-draft: node scripts/build-pdf.mjs (advance copy, requires --reviewer)
  • Update documentation in PRINT-SPECIFICATION.md, README.md, and CLAUDE.md to reflect the new command structure
  • Update scripts/resize-cover.mjs to read page count from the print interior build specifically
  • Update scripts/preview-page.mjs to clarify it works with the digital edition

The refactoring makes the three distinct build purposes explicit in the command names rather than hidden in environment variable combinations, and moves reviewer identification from an environment variable to a required command-line flag for draft builds.

https://claude.ai/code/session_01KtTPqhYezQFvpkDqQFUUVT

Mike MacCana added 5 commits October 5, 2026 18:17
build-pdf-print is the KDP interior (final, no cover, no links),
build-pdf-digital the finished book for screens (final, cover and links),
and build-pdf-draft an advance copy that now requires --reviewer, which
replaces REVIEWER_NAME. Each writes its own file in build/, so the print
interior and each reviewer's copy no longer overwrite the digital edition.
resize-cover reads its page count from the print interior, the file
actually uploaded; preview reads the digital edition, which is now the
pre-push build.

Claude-Session: https://claude.ai/code/session_01KtTPqhYezQFvpkDqQFUUVT
"Print" read as both the book Amazon prints and a page run off an office
printer. The KDP build is now build-pdf-paperback, writing the paperback
interior, and the page size it is laid out at is --size trim.

Claude-Session: https://claude.ai/code/session_01KtTPqhYezQFvpkDqQFUUVT
build-pdf-paperback now runs resize-cover straight after the interior, so
one command produces both files KDP takes and the spine is always sized
from the interior just built. resize-cover still runs alone for --paper
cream or --pages.

Claude-Session: https://claude.ai/code/session_01KtTPqhYezQFvpkDqQFUUVT
Nothing ran or documented it. Rendering a page of a built PDF to PNG is
what npm run preview does, finding the page by a phrase rather than a
number that drifts between builds.

Claude-Session: https://claude.ai/code/session_01KtTPqhYezQFvpkDqQFUUVT
@mikemaccana
mikemaccana merged commit f795025 into main Oct 5, 2026
1 check passed
@mikemaccana
mikemaccana deleted the claude/keen-thompson-jrypmb branch October 13, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant