facebook / jscodeshift

A JavaScript codemod toolkit.
https://jscodeshift.com
MIT License
9.23k stars 477 forks source link

Replace `mkdirp` with `fs.mkdirSync(path, { recursive: true })` #608

Closed trivikr closed 2 months ago

trivikr commented 2 months ago

Is your feature request related to a problem? Please describe.

In April 2016, the Node.js fs APIs did not provide recursive mode to create files. So mkdirp utility was used in https://github.com/facebook/jscodeshift/commit/5d58f4170394c78784bc899fa5f1207ca227cca0

Node.js fs.mkdirSync added recursive option in Node.js v10.12.0 published on Oct 10, 2018.

The mkdirp currently uses these native APIs:

Describe the solution you'd like

Replace mkdirp with fs.mkdirSync(path, { recursive: true })

trivikr commented 2 months ago

Documentation https://github.com/es-tooling/module-replacements/blob/81e7dc647a208ed7e438b6e792a4150c8e0fff14/docs/modules/mkdirp.md