@pob/pretty-pkg

7.0.0 • Public • Published

@pob/pretty-pkg

prettier and sort package.json

Install

npm install --save @pob/pretty-pkg

Usage

Bin

directly

yarn pretty-pkg package.json

with lint-staged

{
  "lint-staged": {
    "package.json": ["pretty-pkg"]
  }
}

Lib

overrideSync

const { overrideSync } = require('@pob/pretty-pkg');

overrideSync('package.json');

writeSync

const fs = require('fs');
const { writeSync } = require('@pob/pretty-pkg');

const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
writeSync(pkg, 'package.json');

default

const fs = require('fs');
const prettyPkg = require('@pob/pretty-pkg');

// parsing yourself
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
fs.writeFileSync(prettyPkg(pkg), 'package.json');

// let prettyPkg parse
const pkgContent = fs.readFileSync('package.json', 'utf-8');
fs.writeFileSync(prettyPkg(pkgContent), 'package.json');

Readme

Keywords

none

Package Sidebar

Install

npm i @pob/pretty-pkg

Weekly Downloads

243

Version

7.0.0

License

ISC

Unpacked Size

15.6 kB

Total Files

7

Last publish

Collaborators

  • churpeau