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

zod-v3-to-v4

v1.11.0

Published

Migrate Zod from v3 to v4

Readme

Zod v3 to v4

NPM version GitHub Actions Workflow Status All Contributors

This is a codemod (a tool that automatically transforms code) for migrating from Zod v3 to v4.

The migration guide can be found at https://zod.dev/v4/changelog

zod-v3-to-v4-demo

Using this codemod

This assumes you have Node.js installed.

The first step for you is to upgrade your Zod version to v4. In doubt, check your package.json. Note that if you're using Zod through Astro v6, you don't need to upgrade Zod manually.

Then, you can use this codemod to automatically migrate your code from Zod v3 to v4 syntax.

Interactive CLI

You can run it with the following command:

npx zod-v3-to-v4

It will ask you for the path to your tsconfig.json file, and then it will go through all your files and migrate Zod v3 code to v4.

Non-interactive CLI

Alternatively, you can pass the path to your tsconfig.json file as an argument:

npx zod-v3-to-v4 path/to/your/tsconfig.json

This is useful if you ever need to run the codemod in script (e.g. in a CI pipeline).

Installing it as a package

You can also install it as a package and run it from your project:

npm install -ED zod-v3-to-v4

And then run it with:

npx zod-v3-to-v4

Reporting issues

If the codemod missed something or did something wrong, please open an issue.

Contributing

This project uses node.js and pnpm. To get started, run:

pnpm install

To run the tests, run:

pnpm test

We use ts-morph to parse and transform the code.

Useful links:

Playground

If you want to test the codemod from CLI, you can use the playground folder. It contains a tsconfig.json file and some sample TypeScript files with Zod v3 code. You can run the codemod on these files with:

pnpm playground

Or interactively:

pnpm playground:interactive
# Then enter: playground/tsconfig.json

Contributors