Simplify JSONResume Makefile targets & add PDF generation

- Remove broken jsonresume-preview & jsonresume-export targets (Node 22 incompatible)
- Add jsonresume-pdf target for 4 favorite themes (kendall, modern-plain, one, onepage-plus)
- Include puppeteer in jsonresume-themes install
- Gitignore node_modules & npm files
This commit is contained in:
Russell Ballestrini 2025-12-15 09:21:34 -05:00
parent b5232587c2
commit c647048f9d
2 changed files with 37 additions and 22 deletions

5
.gitignore vendored
View file

@ -77,3 +77,8 @@ vars.fish
blog-multi-mower/
webwords/
venv/
# Node.js / JSONResume
node_modules/
package.json
package-lock.json

View file

@ -1,4 +1,4 @@
.PHONY: html help clean regenerate serve devserver publish pygments jsonresume jsonresume-themes jsonresume-preview jsonresume-export jsonresume-all-html
.PHONY: html help clean regenerate serve devserver publish pygments jsonresume jsonresume-themes jsonresume-pdf
BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
@ -13,10 +13,8 @@ help:
@echo ' make venv setup virtual environment '
@echo ' make resume (re)generate the resume PDF '
@echo ' make jsonresume copy JSONResume to output '
@echo ' make jsonresume-themes install resume-cli & 30 themes '
@echo ' make jsonresume-preview THEME=x preview with theme (default: even) '
@echo ' make jsonresume-export THEME=x export HTML with theme '
@echo ' make jsonresume-all-html export resume as HTML in all themes'
@echo ' make jsonresume-themes install 30 jsonresume themes '
@echo ' make jsonresume-pdf generate PDFs for favorite themes '
@echo ' make cover-letters (re)generate cover letter PDFs '
@echo ' make html (re)generate the web site '
@echo ' make clean remove the generated files '
@ -66,26 +64,14 @@ JSONRESUME_THEMES = classy cora dark-classy-responsive elegant eloquent even kar
onepage-plus printclassy projects rnord rocketspacer sceptile simplyelegant stackoverflow \
stackoverflow-ru straightforward tan-responsive techlead timeline-fixed waterfall
jsonresume-themes:
@echo "Installing resume-cli & 30 tested themes..."
npm install resume-cli $(addprefix jsonresume-theme-,$(JSONRESUME_THEMES)) --legacy-peer-deps
@echo "Done! Preview with: make jsonresume-preview THEME=even"
# Preview JSONResume with a theme (default: even)
THEME ?= even
RESUME_FILE ?= content/pages/russell.ballestrini.resume.json
jsonresume-preview:
@echo "Previewing $(RESUME_FILE) with theme: $(THEME)"
npx resume serve --theme $(THEME) --resume $(RESUME_FILE)
# Export JSONResume to HTML with a theme
jsonresume-export:
@mkdir -p output/uploads
@echo "Exporting $(RESUME_FILE) with theme: $(THEME)"
npx resume export output/uploads/russell.ballestrini.resume.html --theme $(THEME) --resume $(RESUME_FILE)
@echo "Exported to output/uploads/russell.ballestrini.resume.html"
jsonresume-themes:
@echo "Installing 30 jsonresume themes..."
npm install $(addprefix jsonresume-theme-,$(JSONRESUME_THEMES)) puppeteer --legacy-peer-deps
@echo "Done! Run: make jsonresume-pdf"
# Export JSONResume as HTML in all themes (uses direct node render to avoid resume-cli issues)
# Export JSONResume as HTML in all themes
jsonresume-all-html:
@mkdir -p output/uploads/jsonresume-themes
@echo "Generating HTML for all themes..."
@ -101,6 +87,30 @@ jsonresume-all-html:
@echo "HTML files saved to output/uploads/jsonresume-themes/"
@echo "Open in browser & print to PDF"
# Favorite JSONResume themes for PDF export
JSONRESUME_PDF_THEMES = kendall modern-plain one onepage-plus
# Generate PDFs for favorite themes using puppeteer
jsonresume-pdf: jsonresume-all-html
@mkdir -p output/uploads
@echo "Generating PDFs for favorite themes..."
@node -e " \
const puppeteer = require('puppeteer'); \
const themes = '$(JSONRESUME_PDF_THEMES)'.split(' '); \
(async () => { \
const browser = await puppeteer.launch({headless: 'new'}); \
for (const theme of themes) { \
const page = await browser.newPage(); \
await page.goto('file://$(CURDIR)/output/uploads/jsonresume-themes/russell.ballestrini.' + theme + '.html', {waitUntil: 'networkidle0'}); \
await page.pdf({path: '$(CURDIR)/output/uploads/russell.ballestrini.' + theme + '.pdf', format: 'A4'}); \
console.log(' Created: russell.ballestrini.' + theme + '.pdf'); \
await page.close(); \
} \
await browser.close(); \
})(); \
"
@echo "PDFs saved to output/uploads/"
cover-letter:
@if [ -z "$(FILE)" ]; then \
echo "Usage: make cover-letter FILE=filename-without-extension"; \