Deno is winding down. I ran a Deno-to-Node codemod on 27 real repos
On October 9 Ryan Dahl posted that the Deno team is joining Cloudflare. The runtime gets one more year of monthly bug and security releases, and then the team stops developing it. Deno Deploy now has a banner in its docs: it will be sunset in April 2027. Val Town, which runs on Deno, goes read-only on December 10 and keeps vals running until January 10, and its migration guide points people at Node, Bun or a provider runtime like Cloudflare Workers.
I went looking for a tool that would move a Deno project to Node and found migration PRs written by hand. People were doing the same edits again and again: Deno.env.get to process.env, Deno.readTextFile to fs/promises, jsr: imports into a package.json, Deno.test into node:test. So I wrote one. It is called deno-exit, it runs offline, and it is a personal project, MIT.
What it does is simple to describe. Report mode lists every place a repo depends on Deno, with file and line. With --fix it rewrites the parts that map 1:1 onto Node and writes a MIGRATION.md with everything else. Some things it refuses to touch at all: Deno KV, Deno.cron, Fresh, BroadcastChannel and Val Town's hosted std/* services. Those need a person to decide where the data and the schedules go.
A codemod that only works on its own fixtures proves nothing, so I tested it on real code.
The test
I picked 27 public repos with a deno.json at the root and a push in the last 90 days. I wanted a mix: plain Deno.serve apps, Hono, Oak, Fresh, KV, cron, a Discord bot, a couple of CLIs, and three Val Town projects exported to git. For each one I ran deno check and deno test on the untouched clone (Deno 2.9.6) to get a baseline. Then on a copy: deno-exit --fix, npm install, tsc --noEmit, and the repo's own test script on Node 22.23.
Every number below comes from that run.
What moved by itself
Across the 27 repos the tool rewrote 4285 things and changed 830 files. It listed 568 things as manual, each with the Node replacement it would use, and left 127 decisions alone.
npm install worked in all 27 after the fix. I expected this to be the hard part, because JSR packages have to come through npm.jsr.io as @jsr/scope__name aliases with an .npmrc next to them, and import maps are full of entries nobody uses anymore. Deno never fetches an unused entry. npm fails on one that no longer exists, so the tool only carries over the entries that a file actually imports.
tsc --noEmit came out clean in 7 of the 27. That sounds low until you look at where the other errors are. There were 2761 in total. 1961 of them sit inside the node_modules of a single repo: three JSR packages from the same author ship .tsx that still imports npm:preact@... and jsr: specifiers, and neither Node nor tsc can resolve those. 356 are on lines the tool had already flagged, or in files that use KV or Fresh. 82 are await res.json(), which Deno types as any and @types/node types as unknown. 42 were there before the move, under deno check. That leaves 241 I had to explain one by one, and most of them turned out to be Fresh route handlers, files meant for the browser, or Nitro auto-imports.
The tests were the part I cared about most. In 5 repos the repo's own suite passed on Node with exactly the same count as on Deno: pax.deno.dev 17/17, deno-github-contributions-api 16/16, douyinVd 12/12, open-docs 5/5, and editors-arena 11/14 on both sides. food-log passed 96/96 on Node. Wherever Node tests failed, the failing file loaded something the report had flagged.
I also checked for silent misses. After --fix, every file that still has Deno. in it has at least one manual or decision line in the report. I wrote a small script for that and ran it over all 27 copies.
What didn't, and why I left it that way
Deno KV was in 7 of the 27 repos. On Node there is no KV runtime, and on Deploy the data has to be exported before you can do anything else. The target could be SQLite, Postgres, Workers KV or D1, and that depends on traffic, budget and where the app will live. The tool lists every Deno.openKv and every Deno.Kv* type and stops there.
Deno.cron showed up in one repo, remote-rupiah. Its Node test run failed in 22 places, all in files that touch KV or cron. Moving a schedule is a hosting question: a Workers cron trigger, node-cron in a long-running process, or the platform's own scheduler. A codemod picking one of those for you would be wrong most of the time.
Fresh was in 3 repos and there is no Node port of it. In atmosphere-account, 107 of the unexplained tsc errors are route handlers typed through Fresh's define helper, which turns into any once fresh stops resolving. The honest answer for a Fresh app is "pick a new framework", and a tool can't do that for you.
Val Town was the clearest case. In open-docs the tool marks std/sqlite, std/blob and std/openai as decisions, because those are hosted services that go away with Val Town. std/utils is only a code helper, so it is manual. esm.town imports of other vals are manual too, with the advice from Val Town's own guide: copy the val's files into the project and import them relatively.
A few smaller things also stay manual on purpose. Deno.stat is one: isFile is a boolean in Deno and a method in Node, so a plain rename turns if (info.isFile) into a check that is always true. Deno.remove(path) without recursive is another, since Node makes you pick rm or rmdir. A Deno.serve whose return value is used stays too, because server.finished and shutdown() have no direct counterpart.
Two bugs the real repos found
Fixtures didn't catch these. Real repos did.
In atmosphere-account, a multi-line Deno.readTextFile(...) sat inside Deno.test({ async fn() { ... } }). When the test body moves out of the options object it gets re-indented, so the inner rewrite no longer matched the text around it and two test files were skipped. The tool now matches with the shifted indentation.
In tw-dl-bot the test task was deno test ... tests/. I had turned that into node --test tests/, and Node tries to load the directory as a module and fails with ERR_UNSUPPORTED_DIR_IMPORT. A directory now becomes the same glob deno test uses. That repo went from 0/1 to 48/97 Node tests. Most of the remaining failures load discordeno and fp-ts from deno.land/x, which the report lists as manual.
Both fixes have tests now.
Where this leaves a Deno project
For a small app on Deno.serve or Hono with no KV, the move is mostly mechanical. The tool does most of it, and what's left is a short list of lines to change by hand. Once KV, cron or Fresh is involved, the code changes are the easy part. Somebody has to decide where the data goes and what runs the schedule, and the report tells you where all those places are.
If you have a Deno or Deploy app to move, run it on a copy first:
npx github:atokim4/deno-exit ./my-app
npx github:atokim4/deno-exit ./my-app --fix
Then read MIGRATION.md before you touch anything else.
The Val Town and Deno Deploy dates, with the days left, are on upgrade-check-2026.netlify.app/deno-deploy-val-town-exit. It can also scan a public repo in the browser for KV, cron, Fresh and Val Town imports before you clone anything.
I wrote this with help from AI tools. The codemod runs, the test counts and every number above come from scripts I ran on the 27 repos myself.
About the author
- Full-stack developer working with React, Next.js, Node.js and Supabase. My open-source projects are at github.com/atokim4.
Comments
Join the discussionNo comments yet. Be the first to comment.