$ show jontewks/puppeteer-heroku-buildpack
This repository is a Heroku buildpack designed to enable Puppeteer (a Node.js library for controlling headless Chrome/Chromium) to run on Heroku dynos. It installs the necessary system-level dependencies (shared libraries, fonts) required for Chromium to function in Heroku's Linux container environment. The buildpack consists of two scripts: bin/detect, which simply returns 'Puppeteer' to signal applicability, and bin/compile, which handles the core logic of detecting the Heroku stack, installing appropriate APT packages via apt-get with caching, setting up environment variables (LD_LIBRARY_PATH, etc.), and rewriting pkg-config files to ensure the installed libraries are discoverable by the application. The buildpack demonstrates solid engineering practices for Heroku buildpacks, including stack-aware dependency caching to speed up subsequent builds, proper environment variable propagation for downstream buildpacks, and clean separation of concerns. While the functionality is niche and the code is not exceptionally innovative, it is well-structured, maintainable, and solves a specific problem effectively. The repository has been updated to support recent Heroku stacks (heroku-22, heroku-24, heroku-26), indicating ongoing maintenance.
The LLM identified 1 files worth highlighting for reuse:
The bin/compile script is the core reusable component. It implements a pattern for Heroku buildpacks that need to install system APT packages with stack-aware caching. Key features: detects Heroku stack to select appropriate package lists, caches APT downloads based on stack to avoid repeated installs, installs .debs into the build directory, sets up environment variables (LD_LIBRARY_PATH, LIBRARY_PATH, etc.) for the application and subsequent buildpacks, and rewrites pkg-config files to point to the correct installation paths. This pattern is reusable for other buildpacks requiring APT dependencies with minimal changes (just updating the package list and environment variables).