chore: replace fs-extra with native Node.js fs#510
Open
roli-lpci wants to merge 1 commit intopostcss:masterfrom
Open
chore: replace fs-extra with native Node.js fs#510roli-lpci wants to merge 1 commit intopostcss:masterfrom
roli-lpci wants to merge 1 commit intopostcss:masterfrom
Conversation
Replace fs-extra with native Node.js fs APIs (node:fs/promises,
node:fs). All replacements are available on the supported Node >= 18:
- fs.pathExists() → fs.access() with boolean resolution
- fs.outputFile() → fs.mkdir({ recursive: true }) + fs.writeFile()
- fs.copy() → fs.copyFile() (glob ensures file-only results)
- fs.emptyDir() → fs.rm({ recursive, force }) + fs.mkdir({ recursive })
- fs.remove() → fs.rm({ recursive, force })
- fs.createReadStream() → named import from node:fs
This removes 1 runtime dependency (fs-extra + 3 transitive deps).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fs-extrawith nativenode:fs/promisesandnode:fsAPIsFollows the same pattern as #489 (globby → tinyglobby).
Changes
Source (1 file):
index.js—fs.pathExists()→fs.access(),fs.outputFile()→fs.mkdir()+fs.writeFile()Tests (10 files):
test/helpers/clean.js—fs.emptyDir()→fs.rm()+fs.mkdir(),fs.remove()→fs.rm()test/helpers/env.js—fs.copy()→fs.copyFile(),fs.outputFile()→fs.writeFile()test/helpers/read.js— import swap onlytest/stdin.js,test/stdout.js—fs.createReadStream()→ named import fromnode:fstest/ext.js,test/map.js—fs.pathExists()→fs.access()test/replace.js—fs.copy()→fs.copyFile()test/unchanged.js,test/watch.js— import swap onlypackage.json — removed
fs-extrafrom dependenciesReplacement mapping
pathExists()access().then(() => true, () => false)outputFile()mkdir({ recursive: true })+writeFile()copy()copyFile()(glob ensures file-only results)emptyDir()rm({ recursive, force })+mkdir({ recursive })remove()rm({ recursive, force })createReadStream()node:fsTesting
All 39 tests pass. ESLint and Prettier clean.