Replace fs-extra move with a generated helper
org.openrewrite.node.migrate.fs-extra.replace-fs-extra-moveArtifact@openrewrite/recipes-nodejsReplaces fs-extra's move/moveSync with a call to a helper this recipe writes into the same file. rename alone is not a replacement: it doesn't create the destination's parent directory, it overwrites silently instead of refusing, and it fails across devices with EXDEV. The helper does what fs-extra does — mkdir the parent, refuse an existing destination unless overwrite was asked for, then rename, falling back to cp + rm on EXDEV. A call passing an option other than overwrite (dereference, the legacy clobber) or a callback is left alone, as is one whose options aren't an object literal. One helper is written per file, however many calls it has.
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.node.migrate.fs-extra.replace-fs-extra-moveIf the recipe isn’t available locally, install it with:
mod config recipes npm install @openrewrite/recipes-nodejs