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

@granularjs/codemods

v0.2.1

Published

Codemods to migrate React projects to @granularjs/core + @granularjs/jsx. Powered by jscodeshift.

Readme

@granularjs/codemods

jscodeshift-powered codemods that automatically translate React code to @granularjs/core + @granularjs/jsx.

These power the granular migrate command (shipped via @granularjs/cli), but you can also run individual transforms standalone via granular-codemod.

Install

npm install --save-dev @granularjs/codemods

Use the high-level migration CLI

Install the umbrella CLI and run granular migrate:

npm install -g @granularjs/cli   # or: npx @granularjs/cli ...

# Basic: writes the migrated copy to "<source>-granular" next to your source
granular migrate ./my-react-app

# Explicit output path
granular migrate ./my-react-app --out ./my-granular-app

# Preview only (no files touched, no destination created)
granular migrate ./my-react-app --dry-run

# Overwrite an existing destination
granular migrate ./my-react-app --out ./out --force

The migration is always non-destructive: the source folder is never modified. The CLI clones the project to the destination first (skipping node_modules, dist, build caches, etc.) and runs every codemod plus dependency/config rewrites against the clone. A MIGRATION_REPORT.md is written to the destination, with diff instructions to compare against the source.

Steps the migration runs (use --steps / --skip to control them): discover, clone, deps, config, codemods, lint, audit, report.

Use individual transforms

npx granular-codemod useState-to-state ./src
npx granular-codemod array-map-to-list ./src/components/List.jsx
npx granular-codemod react-imports ./src

Available transforms

Reactivity

| Transform | What it does | | --- | --- | | useState-to-state | const [x, setX] = useState(0)const x = state(0); rewrites setX(v) and setX(prev => …). Surviving shorthand references to the setter (e.g. {x, setX}) are expanded to {x, setX: x.set}. | | useRef-to-state | const ref = useRef(null)const ref = state(null); rewrites ref.current reads/writes. | | useMemo-to-derive | useMemo(() => expr, [deps])derive(() => expr) (deps inferred reactively). | | useEffect-to-after | useEffect(fn, [a, b])after(a, b).change((a, b) => fn(...)). When deps are simple identifiers and the callback has no params, the dep names are bound as the callback parameters so the body keeps using each dep as a plain value. Empty/missing deps become a one-shot call with a TODO. | | useCallback-remove | useCallback(fn, deps)fn. | | useContext-to-context | createContext(default)context(default); useContext(Ctx)Ctx.state(); <Ctx.Provider value={x}>{children}</Ctx.Provider>Ctx.scope(x).serve(children). | | setState-updater | Catch-all for setX(prev => …) patterns left over after the previous transforms. |

Rendering

| Transform | What it does | | --- | --- | | array-map-to-list | arr.map(x => <Item …/>)list(arr, x => <Item …/>, { key }). | | conditional-jsx-to-when | {cond && <X/>} and {cond ? <X/> : <Y/>} inside JSX → when(cond, () => <X/>, …) when cond is a known reactive source. Ambiguous cases get a TODO comment. | | react-imports | Removes react / react-dom imports; rewrites createRoot(el).render(<App/>) and ReactDOM.render(<App/>, el) to bootstrap(<App/>, el). |

Project config

| Transform | What it does | | --- | --- | | tsconfig | Sets compilerOptions.jsx = "react-jsx" and compilerOptions.jsxImportSource = "@granularjs/jsx" in tsconfig.json. | | vite-config | Removes @vitejs/plugin-react; adds esbuild.jsx = 'automatic' and esbuild.jsxImportSource = '@granularjs/jsx'. | | package-json | Removes React deps; adds @granularjs/core and @granularjs/jsx. |

Programmatic API

const { runTransformOnSource, runAll } = require('@granularjs/codemods/runner');

const out = runTransformOnSource('useState-to-state', source, { path: 'Counter.jsx' });

License

Apache-2.0