@pob/pretty-pkg

    3.1.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');

    Keywords

    none

    Install

    npm i @pob/pretty-pkg

    DownloadsWeekly Downloads

    25

    Version

    3.1.0

    License

    ISC

    Unpacked Size

    9.24 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar