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

whackage

v1.3.0

Published

Multi-repo development tool for React Native

Downloads

486

Readme


What is this?

whackage provides a hot-reload-friendly workflow for developing across multiple React Native packages

React Native packager, the development server that bundles your app's JavaScript sources, has a few rough edges when it comes to developing apps and libraries that span across multiple repositories. It doesn't handle symlinks reliably, and the Haste module system gets easily confused by @providesModule declarations in subdependencies.

Whackage is an npm link replacement that works with React Native. It synchronizes changes in your local workspace to your project's node_modules without using symlinks, and automatically generates a packager blacklist for linked modules to avoid Haste naming collisions.

We wrote whackage to scratch our own itch when working on Victory Native. It's a blunt instrument, but it works well. Hope you find it useful!

How-to

Quick start

# install whackage globally
npm i -g whackage

# rest of the steps happen in your project root directory
cd ~/your-project-directory

# create new whackage.json
whack init

# create a link to a package you want to make changes to
whack link ../path/to/other/package

# start react native packager and the whackage server (equivalent to npm start)
whack run start

More detailed instructions of each step below:

Prerequisites

  • node >=4
  • npm >=3
  • OSX/Linux. Windows currently not supported, but PRs welcome.
  • rsync (most likely pre-installed on your system)

Install

Install whackage globally:

npm i -g whackage

Initialize whackage in your project

You'll now have access to the whack command on your command line. To get started, generate an empty whackage.json in your project's root directory:

whack init

Link modules

You can then link local copies of React Native libraries to your project with whack link <path>, e.g.:

whack link ../victory-core-native
whack link ../victory-chart-native

You'll now have a whackage.json file that looks as follows:

{
  "include": "/**/*.js",
  "exclude": ["/node_modules/*", ".babelrc", ".git"],
  "dependencies": {
    "victory-chart-native": "../victory-chart-native",
    "victory-core-native": "../victory-core-native"
  }
}

The dependencies map specifies which modules to synchronize, and paths to directories where to look for the sources.

By default whackage watches changes to .js files, and ignores your sources' node_modules and git metadata. We also skip copying Babel configurations, because the React Native packager does not support per-module configurations, and project-specific presets often causes the Babel transpilation step to fail.

You can configure the include and exclude glob patterns as needed.

Start packager

Start the packager server with whack run <command>, where command is the npm script you normally use to start your development server.

If you usually start the server with npm start, the corresponding whackage command is:

whack run start

(Alternatively, if your start task is npm run server:dev, you'd use whack run server:dev!)

When started, the whackage server will overwrite the specified dependencies in your node_modules with the sources you linked with whack link, and start a file watcher that synchronizes changes made in the source directories into your node_modules as they happen.

It will also specify a CLI config which adds the node_modules within linked source directories to the Haste blacklist to avoid @providesModules naming collisions.

Update transitive dependencies

When you whack link a package, whackage automatically installs and flattens transitive dependencies into your project. If you change the dependencies of your linked packages, you'll need to run whack install to add them to your project:

whack install victory-chart-native

Or sync all transitive depedencies or all linked packages:

whack install

Stop whacking

When you're done making changes to your local packages, you can remove the whackage.json entry and reset the module to its original state:

whack unlink victory-chart-native

To reset your your original dependencies, but keep the whackage.json around for the next time you want to work with that package, simply nuke your node_modules:

rm -rf node_modules && npm i

API

Run whack --help for a list of all available commands and options.

Misc

Why the name?

It's wacky, it's hacky, and it rhymes with package. Also it whacks your node_modules.

Contributing

Found an issue or a missing feature? Congratulations! :tada: That is the prize you win as an early adopter! GitHub issues and pull requests are more than welcome.

Please note

This project is in a pre-release state. The API may be considered relatively stable, but changes may still occur.

MIT licensed