@simbo/call-prettier
v1.0.2
Published
A utility for finding and calling Prettier on files using their contextual settings.
Maintainers
Readme
Call Prettier
A lightweight utility for finding and invoking the Prettier binary on files, using the appropriate contextual settings of your project.
It ensures that the correct Prettier instance is executed, whether installed locally or globally.
Features
Locates the correct Prettier binary (local
node_modules/.binfirst, then global)Calls Prettier in
writeorcheckmodeSupports custom working directories
Respects or ignores
.prettierignoredepending on optionsFully typed with TypeScript
Built on top of
execafor reliable process execution
Installation
Install @simbo/call-prettier from the npm registry:
npm i [-D] @simbo/call-prettierUsage
For a complete API reference, see the documentation.
import { callPrettier } from '@simbo/call-prettier';
await callPrettier('src/**/*.ts', {
mode: 'check', // defaults to 'write'
workingDir: process.cwd(), // optional
disableIgnores: false, // optional
});