$ show fsouza/prettierd
prettierd is a daemonized wrapper around Prettier that avoids Node.js startup overhead by running Prettier as a persistent background process (using core_d.js). It provides a CLI interface that pipes file content to the daemon, which resolves the appropriate Prettier version (local or bundled), loads configuration (with support for .prettierrc, editorconfig, and environment-driven defaults), and returns formatted output. The architecture is a single daemon per working directory, managed through core_d. Key entry points are the shell script `bin/prettierd` and TypeScript modules `src/prettierd.ts` (CLI orchestration) and `src/service.ts` (formatting logic). The service module handles Prettier resolution, config precedence, argument parsing, and formatting/checking tasks. It supports TypeScript config files via Node.js experimental strip-types. The codebase is clean, well-structured TypeScript with strict compiler settings, and though it has no test suite, CI verifies build and daemon startup across multiple platforms and Node versions.
The LLM identified 1 files worth highlighting for reuse:
The central service module that extracts and formats files via Prettier. It contains reusable functions for resolving Prettier (local vs bundled), merging configuration with environment variables and CLI options, parsing CLI arguments into typed objects, and executing format/check tasks. This module could be extracted and used independently of the daemon framework, enabling programmatic integration of Prettier with similar configuration logic. It demonstrates clean separation of concerns, async/await patterns, and robust error handling.