npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

propagate-replacement-fields

v1.3.0

Published

CLI tool to declare node modules replacements everywhere

Downloads

5

Readme

Propagate Replacement Fields

Take a package.json field and copy paste its contents to all package.json of modules inside /node_modules

So let's imagine you have these replacement modules (e.g. for browserify) in your project's package.json:

  "browser": {
    "stream": "stream-browserify",
    "os": "os-browserify"
  }

Or in your React Native project:

  "react-native": {
    "crypto": "react-native-crypto",
    "tcp": "react-native-tcp",
    "fs": false
  }

And you want those to be present also in the package.json for each module installed in your project's /node_modules. This is sometimes needed, specially for eccentric React Native projects using Node.js specific stuff.

So that's when you use propagate-replacement-fields, like this:

npm install --save-dev propagate-replacement-fields
./node_modules/.bin/propagate-replacement-fields --field=browser

And then that field "browser" from your project's package.json will be cloned also into the dependencies installed in node_modules.

Note, if you want to specify where is the source package.json, you can pass its path to --source:

./node_modules/.bin/propagate-replacement-fields --field=browser --source=../over-there

Similarly, if you want to specify where is the destination node_modules, you can pass its path to --destination (no need to specify the last part, "/node_modules"):

./node_modules/.bin/propagate-replacement-fields --field=browser --destination=./over-here

install

npm install propagate-replacement-fields

usage

propagate-replacement-fields --help
Usage: propagate-replacement-fields [options]

Options:
  --field, -f        package.json field with replacement modules      [required]
  --source, -s       where to look for the source package.json.
                     default: process.cwd()
  --destination, -d  where is the node_modules where propagation will happen.
                     default: ./
  --help             Show help                                         [boolean]

Examples:
  propagate-replacement-fields --field=browser

license

MIT, Andre Staltz

versioning

This package follows ComVer, not SemVer.