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

@cloudflare/codemods

v0.11.0

Published

Codemods for upgrading Cloudflare developer projects

Readme

@cloudflare/codemods

Codemods for upgrading Cloudflare developer projects.

Run a codemod by name:

npx @cloudflare/codemods vitest:v3-to-v4

Available codemods:

  • wrangler-to-cf - migrate a Wrangler configuration to the new cf configuration format
  • vitest:v3-to-v4 — migrate @cloudflare/vitest-pool-workers configuration from Vitest v3 to v4
  • vitest:pool-workers-to-vitest-plugin — rename @cloudflare/vitest-pool-workers to @cloudflare/vitest-plugin v1

Use --dry-run to list changes without writing them, --cwd <path> to target another project, or repeat --files <glob> to restrict the files considered. When the target is inside a Git worktree, the worktree must be clean. Use --force to bypass this safety check.

To migrate a Wrangler project with the default Vite bundler:

npx @cloudflare/codemods wrangler-to-cf --cwd ./path/to/project

The CLI detects a single root wrangler.json, wrangler.jsonc, or wrangler.toml. Pass --config <path> to select another file, or pass --bundler wrangler to retain Wrangler-specific tooling configuration. For this codemod, --files filters the selected Wrangler config and skips the migration when it does not match.

Programmatic usage

Codemods can also be run from JavaScript or TypeScript:

import { runCodemod } from "@cloudflare/codemods";

const { changedFiles } = await runCodemod("vitest:v3-to-v4", {
	cwd: process.cwd(),
	dryRun: false,
});

runCodemod accepts the same codemod names and aliases as the CLI. Its context also accepts optional files and force fields corresponding to the CLI flags, and setting dryRun lists changed files without writing them. It returns a CodemodResult containing changedFiles and rejects if the codemod cannot be run. The CLI's clean-worktree check also applies to programmatic runs.

Migrate Wrangler config to cf

Pass the exact Wrangler config file to migrateWranglerToCf:

import { migrateWranglerToCf } from "@cloudflare/codemods";

const result = await migrateWranglerToCf("./wrangler.jsonc", {
	bundler: "vite",
});

The options object and all of its fields are optional. The defaults are the Vite bundler, writes enabled, dirty-worktree protection enabled, and automatic dependency installation enabled. The migration installs cf when missing, installs @cloudflare/vite-plugin@^2.0.0-rc.0 when Vite is selected and the plugin is missing or older than the v2 release candidate, and upgrades Wrangler when generated Wrangler tooling requires a newer version. Dist tags such as beta count as incompatible, because they can stop pointing at a compatible release. Project-managed Vite plugin specifiers such as workspace: and catalog: are preserved; incompatible or unverified versions require a manual update. Set installDependencies to false to prevent dependency changes; required dependencies are then returned as blocking follow-ups. The migration always creates cloudflare.config.ts; selecting the Wrangler bundler also creates wrangler.config.ts when Wrangler-specific tooling config exists. Existing target files are never overwritten. Inspect result.followUps when result.status is needs-intervention.

Convert Wrangler config in memory

Tools that already hold a parsed Wrangler configuration can convert it without files or a project. Import convertWranglerConfig from the @cloudflare/autoconfig/wrangler-to-cf entry point, which loads only the converter:

import { convertWranglerConfig } from "@cloudflare/autoconfig/wrangler-to-cf";

const { base, environments, followUps } = convertWranglerConfig(rawConfig);

base is the top-level ConvertedBranch, and environments is a Map<string, ConvertedBranch> keyed by Wrangler environment name. Each branch has a config: OutputObject and, if the source branch defines previews, a previewConfig: OutputObject. For example, read the top-level tree from base.config or the staging tree from environments.get("staging")?.config. These trees contain plain values, objects (kind: "object"), and calls to cf/config helpers (kind: "call", for example bindings.kv). migrateWranglerToCf renders these trees into cloudflare.config.ts.

Pass { bundler: "wrangler" } to convert for the Wrangler bundler. The function reads and writes no files, so it reports no dependency or secret-file follow-ups.