write-pretty-file
Version:
Write file and automatically format it with your projects prettier config
27 lines (18 loc) • 590 B
Markdown
Write file and format it with prettier
- :nail_care: Formats with prettier
- :wrench: Uses your projects config
- :file_folder: Creates directories if needed
- :clipboard: If a prettier config is not found, uses prettier defaults instead
- :mailbox: Automatically stringifies objects
```ts
import writePrettyFile from 'write-pretty-file'
await writePrettyFile('hello/world.json', { hello: 'world' })
await writePrettyFile('hello/world.ts', 'export default function (){}')
```
```console
npm install write-pretty-file
```