write-pretty-file
Write file and format it with prettier
✨ Features
- 💅 Formats with prettier
- 🔧 Uses your projects config
- 📁 Creates directories if needed
- 📋 If a prettier config is not found, uses prettier defaults instead
- 📫 Automatically stringifies objects
Usage
import writePrettyFile from 'write-pretty-file'
await writePrettyFile('hello/world.json', { hello: 'world' })
await writePrettyFile('hello/world.ts', 'export default function (){}')
📦 Install
npm install write-pretty-file