Replace fs-extra writeJson with fs.writeFile
Recipe ID
org.openrewrite.node.migrate.fs-extra.replace-fs-extra-write-jsonArtifact@openrewrite/recipes-nodejsReplaces fs-extra's writeJson/writeJSON and their sync forms with writeFile/writeFileSync from node:fs/promises and node:fs, serializing with JSON.stringify(obj, replacer, spaces) + '\n' exactly as fs-extra does. Calls with a callback, non-literal options, or a non-default EOL are left in place.
Single recipeProprietary
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-write-jsonIf the recipe isn’t available locally, install it with:
mod config recipes npm install @openrewrite/recipes-nodejs