🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

package-meta

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

package-meta

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

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

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'

FAQs

Package last updated on 16 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts