Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

write-pretty-file

sajmoni130MIT0.2.0TypeScript support: included

Write file and automatically format it with your projects prettier config

write-file, prettier

readme

write-pretty-file

Write file and format it with prettier

✨ Features

  • :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

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