How vjgit-369/mastering-playwright-automation works
Purpose and Entry Points
This is a production publishing repository for *Mastering Playwright Automation*, not a Playwright application. It maintains the book source and compiles distributable DOCX, PDF/paperback, EPUB, and Kindle EPUB artifacts. Primary build entry points are scripts/build-book.ps1, scripts/build-book.bat, and scripts/build-manuscript.js; final KDP deliverables reside in release/amazon-kdp/.
Canonical Content Assembly
The canonical editorial source is Markdown, split into frontmatter, ordered chapters, appendix, and backmatter. Ordering and compilation intent are centralized outside the manuscript rather than inferred solely from filenames.
• manuscript/frontmatter/
• manuscript/chapters/chapter-01.md
• publishing/book-order.txt
publishing/book-metadata.yaml supplies publication metadata across output formats.
Compiler Orchestration
The Node.js compiler is the central control boundary. scripts/compiler/build.js coordinates reading source, merging it into a book representation, QA, and format-specific generators. scripts/compiler/book-reader.js and scripts/compiler/manuscript-merger.js form the source-to-composite-manuscript stage.
• scripts/compiler/build.js
• scripts/compiler/book-reader.js
• scripts/compiler/manuscript-merger.js
Content Quality Gates
Two QA layers validate the source/manuscript before or during rendering: general content checks and manuscript-specific checks; file validation protects expected inputs/outputs. These are internal build gates rather than runtime services.
• scripts/compiler/content-qa.js
• scripts/compiler/manuscript-qa.js
• scripts/compiler/file-validator.js
Format Rendering Pipelines
Format generators consume the assembled manuscript and emit publication artifacts. DOCX has both document and template generation; EPUB and Kindle are separate targets; PDF supports both a general generator and a 7x10 paperback-specific generator.
• scripts/compiler/docx-generator.js
• scripts/compiler/epub-generator.js
• scripts/compiler/kindle-generator.js
• scripts/compiler/pdf-generator-7x10.js
EPUB output is validated with the bundled Java-based EPUBCheck distribution through scripts/compiler/validate-epub.js and tools/epubcheck/epubcheck.jar.
Presentation and Asset Boundary
Markdown structure is transformed by Lua filters, while TeX themes/templates define PDF and paperback visual design. This separates editorial content from output-specific layout. Reusable source diagrams are Draw.io files, with exported artwork available for rendering.
• scripts/filters/paperback-structure.lua
• publishing/paperback/paperback-template-7x10.tex
• publishing/paperback/theme-7x10/theme-7x10.tex
• assets/diagrams/
Publishing and Release
Publishing metadata, KDP copy, cover specifications, and marketing material are maintained as release-adjacent inputs. The release directory contains generated, upload-ready Amazon KDP files, including paperback PDF, cover PDF, DOCX, EPUB, and Kindle EPUB.
• publishing/KDP_METADATA.md
• publishing/cover/cover-spec.md
• release/amazon-kdp/
Material runtimes are Node.js for compilation, TeX/PDF tooling for print production, Lua/Pandoc-style filters, and Java for EPUBCheck. The only explicit external distribution target is Amazon KDP; no hosted application or backend service is present.
Main entry points: build.js Compiler orchestrator · book-reader.js Book reader · pdf-generator-7x10.js 7x10 PDF generator · validate-epub.js EPUB validation
Components 20
Editorial Source
- Markdown manuscript · Frontmatter, ordered chapters, appendix, and backmatter.
- Chapter source
manuscript/chapters/chapter-01.md - Book order · Defines compilation order independently of filenames.
publishing/book-order.txt - Book metadata · Shared publication metadata for output formats.
publishing/book-metadata.yaml - Diagram assets · Reusable source diagrams and exported art.
Build Compiler
- Build entry points · PowerShell, batch, and Node build commands.
scripts/build-book.ps1 - Compiler orchestrator · Coordinates assembly, QA, and generators.
scripts/compiler/build.js - Book reader
scripts/compiler/book-reader.js - Manuscript merger · Builds the composite manuscript.
scripts/compiler/manuscript-merger.js - Content QA gates · General and manuscript-specific source checks.
scripts/compiler/content-qa.js - File validation · Protects required build inputs and outputs.
scripts/compiler/file-validator.js
Rendering & Validation
- DOCX generator · Produces document and template output.
scripts/compiler/docx-generator.js - EPUB generator
scripts/compiler/epub-generator.js - Kindle generator
scripts/compiler/kindle-generator.js - 7x10 PDF generator · Produces paperback-specific PDF.
scripts/compiler/pdf-generator-7x10.js - EPUB validation · Runs bundled EPUBCheck against EPUB output.
scripts/compiler/validate-epub.js - EPUBCheck
tools/epubcheck/epubcheck.jar - Paperback layout · Filters and TeX themes separate print design from editorial content.
scripts/filters/paperback-structure.lua
Release Inputs & Delivery
- KDP release inputs · KDP copy, cover specifications, and marketing inputs.
publishing/KDP_METADATA.md - Amazon KDP deliverables · Upload-ready paperback, cover, DOCX, EPUB, and Kindle EPUB files.
Connections 23
- Build entry points → Compiler orchestrator: invokes
- Markdown manuscript → Book reader: reads
- Chapter source → Book reader: reads
- Book order → Book reader: orders
- Book metadata → Compiler orchestrator: supplies metadata
- Book reader → Manuscript merger: source sections
- Manuscript merger → Content QA gates: composite manuscript
- Compiler orchestrator → File validation: checks files
- Content QA gates → Compiler orchestrator: quality gate
- File validation → Compiler orchestrator: validation gate
- Compiler orchestrator → DOCX generator: renders
- Compiler orchestrator → EPUB generator: renders
- Compiler orchestrator → Kindle generator: renders
- Compiler orchestrator → 7x10 PDF generator: renders
- Diagram assets → Compiler orchestrator: artwork input
- Paperback layout → 7x10 PDF generator: applies layout
- EPUB generator → EPUB validation: validates
- EPUBCheck → EPUB validation: executes
- KDP release inputs → Amazon KDP deliverables: release context
- DOCX generator → Amazon KDP deliverables: publishes
- EPUB validation → Amazon KDP deliverables: approved EPUB
- Kindle generator → Amazon KDP deliverables: publishes
- 7x10 PDF generator → Amazon KDP deliverables: publishes