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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rtl-first/patch-generator

v0.1.0

Published

Generate rebaseable RTL patches organized by layer — apply after every upstream rebase

Readme

@rtl-first/patch-generator

Generate rebaseable RTL patches organized by layer. Apply after every upstream rebase.

Part of the rtl-first framework — build for the world from day one.

What it does

Scans your fork, generates shell scripts for each RTL layer, and gives you an apply-all.sh you can run after every git rebase.

npx @rtl-first/patch-generator ./my-fork
  RTL Patch Generator
  ═══════════════════════

  Generated patches:
  📁 .rtl-patches/
  ├── ✓ 01-direction.sh     (1 files)
  │   Add dir="rtl" and lang attribute to root HTML element
  ├── ✓ 02-css-logical.sh   (147 files)
  │   Convert CSS physical → logical properties
  ├── ✓ 03-locale.sh        (1 files)
  │   Set up Arabic locale files
  ├── ✓ apply-all.sh
  │   Apply all patches in order
  └── ✓ health-check.sh
      Check fork health metrics

  After upstream rebase:
  git rebase upstream/main && bash .rtl-patches/apply-all.sh

The Problem it Solves

Every time you rebase your fork from upstream, RTL changes can break. This tool generates portable shell scripts that you can re-apply after each rebase, keeping your RTL support intact.

Usage

# Generate patches (scans project automatically)
npx @rtl-first/patch-generator ./my-fork

# Generate only CSS patches
npx @rtl-first/patch-generator ./my-fork --layers 3

# Use rtl-audit JSON for more accurate scan
npx @rtl-first/audit ./my-fork --json > audit.json
npx @rtl-first/patch-generator ./my-fork --audit audit.json

# Preview without creating files
npx @rtl-first/patch-generator ./my-fork --dry-run

# JSON output
npx @rtl-first/patch-generator ./my-fork --json

Generated Scripts

| Script | Layer | What it does | |--------|-------|-------------| | 01-direction.sh | 2 | Injects dir="rtl" and lang="ar" into root HTML element | | 02-css-logical.sh | 3 | Converts physical CSS properties to logical (margin-left → margin-inline-start) | | 03-locale.sh | 4 | Copies source locale to create ar.json | | apply-all.sh | — | Runs all patches in order, supports --layer N filter | | health-check.sh | — | Shows commits behind upstream, override file count, last rebase |

Rebase Workflow

# 1. Rebase from upstream
git fetch upstream
git rebase upstream/main

# 2. Re-apply RTL patches
bash .rtl-patches/apply-all.sh

# 3. Check health
bash .rtl-patches/health-check.sh

# 4. If patches fail, re-generate
npx @rtl-first/patch-generator ./

Programmatic API

const { run } = require('@rtl-first/patch-generator');

const result = run('./my-fork', {
  layers: [2, 3],
  lang: 'ar',
  dryRun: true
});

console.log(result.patches); // Array of generated patches

Features

  • Zero dependencies — just Node.js + bash
  • Built-in scanner — works without rtl-audit (or uses its JSON for better accuracy)
  • Layer isolation — separate script per layer, apply individually with --layer
  • Idempotent — safe to run multiple times
  • Health check — monitors fork drift from upstream
  • README included — generated .rtl-patches/README.md documents usage

License

MIT