Replace fs-extra outputFile and outputJson with mkdir + writeFile
ProprietaryReplaces fs-extra's outputFile, outputJson and their sync variants with a recursive mkdir of the parent directory followed by writeFile from node:fs/promises or node:fs. JSON is written the way jsonfile does, as JSON.stringify(data, replacer, spaces) + '\n'. A path that isn't safe to evaluate twice is hoisted into a const first, which needs a statement to sit before, so such a call in expression position is left alone — as are callback-style calls and JSON options a native rewrite can't reproduce (non-literal options, a custom fs, an EOL other than '\n').
org. openrewrite. node. migrate. fs-extra. replace-fs-extra-output-filemod run . --recipe= org. openrewrite. node. migrate. fs-extra. replace-fs-extra-output-fileInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.