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

@i18n-bakery/poacher

v1.0.9

Published

The Forager. Ventures into the wild (legacy code) to recover valuable ingredients (keys) and bring them back to the safety of the bakery.

Downloads

155

Readme

🥚 @i18n-bakery/poacher

"The Forager" - Ventures into the wild (legacy code) to recover valuable ingredients (keys) and bring them back to the safety of the bakery.

npm version License: MIT

📖 The Story

Transitioning from an old kitchen (like i18next) to a modern bakery can be daunting. You have thousands of "recipes" (keys) scattered across mismatched containers (JSON files).

Meet The Forager. This tool specializes in hunting down existing translations, understanding their structure (flat, nested, chaotic), and carefully transporting them into the pristine, standardized containers of i18n-bakery.

🚀 Features (Foraging Skills)

  • 🕵️‍♀️ Recipe Scout: Scans your source code using AST parsing (BabelKeyExtractor) to find every usage of t('key') and identifying default values.
  • 🔄 Universal Converter: Reads legacy JSON structures (flat, nested, namespaced, mixed) and normalizes them into Bakery standards.
  • 🛡️ Safety First: Always creates a full backup of your locales folder before touching diverse ingredients.
  • 📊 Export for Review: Can export your translation spread to CSV (serve command) so you can audit what you have.

📦 Installation

This tool belongs in your dev-dependencies belt:

pnpm add -D @i18n-bakery/poacher
# or
npm install -D @i18n-bakery/poacher

🛠️ Usage (Hunting Techniques)

Poacher provides a CLI interface under the command poacher.

1. Poach (The Migration)

Migrate from a legacy folder to a Bakery-compatible structure.

npx poacher poach ./src/legacy-locales ./src/locales

Options:

  • --dry-run: Simulate the hunt without gathering anything. Logs what would happen.
  • --verbose: Detailed accounts of every key found.

Behavior:

  • Automatically detects if source files are flat (key.subkey) or nested objects.
  • Promotes top-level objects in flat files to Namespaces (files) in Bakery.
    • Example: legacy/en.json contains { "auth": { "login": "..." } }.
    • Result: locales/en/auth.json is created.

2. Scout (The Analysis)

Analyze your source code to see what keys are currently being requested by the chefs.

npx poacher scout ./src

What it does:

  • Parses .js, .ts, .jsx, .tsx files.
  • Identifies t('namespace:key') patterns.
  • Reports missing keys or discrepancies vs your JSON files.

3. Serve (The Export)

Serve your gathered ingredients in a format easy for humans to digest (CSV).

npx poacher serve ./src/locales --format csv --out ./review.csv

📖 Examples (Field Notes)

Scenario 1: The "Spaghetti" Migration (Nested to Bakery)

You have a legacy locales folder where every file is a mix of deep nesting.

Legacy Structure:

locales/en/translation.json  -> { "auth": { "errors": { "generic": "Error" } } }

Command:

npx poacher poach ./legacy-locales ./src/new-locales

Result (Bakery Style): Poacher intelligently splits this into namespaced files for better organization:

locales/en/auth.json -> { "errors": { "generic": "Error" } }

Scenario 2: The "Missing Keys" Hunt

Your chefs (developers) added t('new.feature') in the code but forgot to add it to the JSONs.

Command:

npx poacher scout ./src

Output:

MISSING KEYS FOUND:
[en] new.feature (in src/components/Feature.tsx)

Scenario 3: Exporting for the Content Team

The content team wants to review all translations in Excel.

Command:

npx poacher serve ./src/locales --format csv > translations.csv

Output (translations.csv):

key,en,es
auth.login,Login,Iniciar Sesión
auth.logout,Logout,Cerrar Sesión

⚠️ Warnings (Kitchen Safety)

  • Backup: While Poacher creates backups, always commit your code to Git before running valid migrations.
  • Pluralization: Poacher copies values as-is. If you use {{count}} syntax from i18next, it works in Bakery! But if you use complex v1, v2 nesting typical of older i18n libs, verify them manually.
  • Overwrite: By default, Poacher overwrites keys in the target logic if they collide, but preserve old files in a backup folder.

🤝 Integration

Poacher is designed to be run once (or fully) during migration. Once you are migrated, you typically hand over duties to The Sous-Chef (@i18n-bakery/cli) for daily operations.


📜 License

MIT © Arturo Sáenz


🙏 Support


🥚 Recover your legacy translations with ease

Made with 🍩 and Regex/AST Magic