package-meta

1.0.0 • Public • Published

package-meta Build Status npm

Generate json file subset of key value pairs from package.json

Problem

In a browserify/webpack/etc environment, it's possible that a developer may erroneously include the entirety of package.json in the client side assets because they need to get some simple value like the package name or version.

Solution

Create a subset of the key value pairs from package.json and save it as a new file which can be required. This should be during your prepublish step by adding a script to your package.json "prepublish": "node bin/package-meta keys=name,version"

Arguments

Argument Default Description
cwd process.cwd() The current working directory from which the package.json file is read and the new meta file is written
keys '' A comma separated list of keys of fields to extract
out 'package-meta.json' The name of the new file to save the extracted data. Can be a relative path like './meta/package.json'

Readme

Keywords

none

Package Sidebar

Install

npm i package-meta

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • snyamathi