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

@jumpn/react-native-jetifier

v0.1.4

Published

React Native Jetifier

Downloads

3,184

Readme

React Native Jetifier (@jumpn/react-native-jetifier)

Glosary

Jetificable

A Java, Kotlin, or XML file with references to any Support class, now migrated to AndroidX.

Jetificable Group

All the jetificables under a dependency (npm package).

Jetify

Rewrite Support classes to AndroidX equivalents.

Jetification

The process of jetify a jetificable.

Why this package exists?

By the end of 2018, Android released Jetpack that comprises a full rewrite of the Support Library now called AndroidX.

To support this, they ask you to set the following properties with true in your gradle.properties file:

android.useAndroidX=true
android.enableJetifier=true

In addition to this, you also need to require artifacts and import classes with their new names.

So you might be thinking, I've already done this on my App, so I still don't understand *"Why this package exists?", so let me answer this with another question:

What about your dependencies?

When we move to the world of React Native, all your dependencies instead of being libraries (JAR, AAR, and ZIP files) as they are in a normal Android App, they are npm packages and live under the node_modules folder, so this means that unless all the React Native packages (including React Native itself) you are using have already migrated to AndroidX, you will have to manually rewrite all the Support classes usages and point them to their respective AndroidX equivalent as the Jetifier tool Android provides won't help you do this because it only handles Android libraries.

You can track the progress of React Native migration to AndroidX in this issue and I also recommend you to open an issue (if not already opened) and even better, submit a PR, to all your dependencies that haven't migrated yet.

How jetification is done?

  1. An index (jetificableGroups.json) file will be created (or updated if already there) under your package root with the jetificables of all your dependencies (npm packages).
  2. All the jetificables of your dependencies (npm packages) present in the index (jetificableGroups.json) will be jetified.

This process should be fast (under 10 sec) on the first run (no index available) and super extremely fast (aprox 2 sec) on the following executions (index available).

Installation

Using npm

$ npm install --save @jumpn/react-native-jetifier

Using yarn

$ yarn add @jumpn/react-native-jetifier

Usage

After having installed this package you will have an executable file called react-native-jetifier available under your node_modules/.bin folder.

Follow the following steps that will ensude your dependencies (npm packages) will be jetified even if you decide to remove or add some:

Execute it after installation

Execute react-native-jetifier to jetify your dependencies (npm packages) and create the index (jetificableGroups.json).

Using npm

$ npx react-native-jetifier

Using yarn

$ yarn react-native-jetifier

Setup it to run on npm postinstall

Add it under the npm postinstall script in your package.json to keep your dependencies jetified when you remove or add some.

Using npm

{
  "scripts": {
    "postinstall": "npx react-native-jetifier"
  }
}

Using yarn

{
  "scripts": {
    "postinstall": "yarn react-native-jetifier"
  }
}

Commit the index file (jetificableGroups.json) to your repository

Since all the jetificable paths are read from the index file (jetificableGroups.json) to improve perfomance, it's highly recommended to commit it to your repository so on a clean clone react-native-jetifier will use it instead of creating a new one.

Unjetify if needed

I have been thinking for a while about the reasons you might want to do this and I found none, but well, if you want to unjetify your dependencies (npm packages) do the following:

Using npm

$ npm install --force

Using yarn

$ yarn install --force

License

MIT :copyright: Jumpn Limited