package-meta
v1.0.0
Published
Generate json file subset of key value pairs from package.json
Downloads
4
Readme
package-meta
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'
|