JSPM

package-json-io

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1833
  • Score
    100M100P100Q110126F
  • License MIT

Read and update package.json files

Package Exports

  • package-json-io

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (package-json-io) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

package-json-io

Read and update package.json files.

Build status js-standard-style

Installation

npm install package-json-io

Usage

var pkg = require('package-json-io')

// read and parse the package.json file in current directory
pkg.read(function (err, data) {
  data.license = 'MIT'

  // update the package.json file in the current directory with a new license
  pkg.update(data, function (err) {
    if (err) throw err
  })
})

API

read([file], callback)

Will read the package.json file in the current working directory unless the optinal file argument specifies another file.

Will call the callback with an optinal error argument and the data from the parsed package.json file.

update([file], data, callback)

Will replace the package.json file in the current working directory (unless the optinal file argument specifies another file) with the provided data object.

Will call the callback when done with an optional error argument.

License

MIT