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

bye-react

v1.0.1

Published

Migrate from React to Preact with one command.

Downloads

2

Readme

bye-react

Migrate your project from React to Preact with a single command. More specifically, this tool switches the project over to preact-compat, the "compatibility layer that makes React-based modules work with Preact, without any code changes".

Disclaimers

  1. Requires usage of Webpack, Browserify, or the Babel React preset (or any combination thereof). If you don’t use any of these, this won't work. Also you should probably be using one of these.
  2. Not guaranteed to work in all cases. You should be using a version of React that is compatible with the current stable release (@15.6.1). May interact in interesting and unfortunate ways with non-standard build pipelines (e.g. if you dynamically generate .babelrc or package.json, etc).
  3. Will delete comments inside package.json and .babelrc files. These files contain JSON-compliant data. To add the aliases, bye-react reads in the JSON, modifies it, and writes it back to disk. Comments are lost en route. If these are important to you then don't use bye-react.

Usage

Install

npm install -g bye-react

or

yarn global add bye-react

Usage

cd ~/your/react/project

bye-react

Undoing

When you first run bye-react backups are made of all config files modified by this tool. Running these undo commands restores these files to their original state. It also uninstalls preact and reinstalls react and react-dom. bye-react -u

or

bye-react --undo

How It Works

  1. Uninstalls react and react-dom.
  2. Installs preact and preact-compat (obviously) via npm (or yarn, if a Yarn lockfile is detected)
  3. Checks for usage of Webpack. If detected, an alias is added to webpack.config.js. Specifically these lines are appended to the end of the file.
  4. Checks for usage of Babel’s React preset. If detected, babel-plugin-module-resolver is installed and used to create an alias in .babelrc
  5. Checks for usage of Browserify. If detected, aliasify is installed and used to create an alias in package.json.