1.0.0 • Published 8 years ago

package-meta v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

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

ArgumentDefaultDescription
cwdprocess.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'
1.0.0

8 years ago