zmod is 100% API compatible with jscodeshift. In most cases, all you need to do is swap the import.
Run @zmod/migrate to automatically convert your jscodeshift codemods to zmod:
This handles:
import j from 'jscodeshift'import type { Transform } from 'zmod'const j = api.jscodeshift{ j } → { z } in transform paramsj. / j( → z. / z(export const parser = 'ts' (and other string aliases) to a proper Parser objectUse --dry-run to preview changes without writing files:
The API object is passed as z instead of j — everything else is the same.
If your jscodeshift codemod exports a custom parser, the same pattern works in zmod.
jscodeshift lets you export a string alias to select a built-in parser:
zmod uses the Parser interface instead. @zmod/migrate converts string aliases automatically. For example, 'ts' becomes:
Supported aliases and their babel plugins:
| Alias | Plugins |
|---|---|
babel |
["jsx"] |
babylon |
["jsx"] |
flow |
["jsx", "flow"] |
ts |
["typescript"] |
tsx |
["typescript", "jsx"] |
The parser export is picked up automatically by run(). You can also call z.withParser(parser) directly to get a parser-specific z instance.
See Custom Parsers for full documentation.