Remove fs-extra dependency#213
Merged
GrahamCampbell merged 2 commits intomainfrom Apr 30, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the fs-extra dependency by replacing its usage with Node.js core fs/fs.promises APIs and a small set of internal FS helpers, while extending test coverage around filesystem behavior and hardening template URL parsing.
Changes:
- Dropped
fs-extrafrompackage.jsonand replaced usages across runtime code and tests with corefsutilities and new internal helpers (copy,remove,ensure-file,json-file). - Added new
lib/utils/fs/*helpers (copy/copy-sync/remove/ensure-file/json-file) and updated call sites to use them. - Strengthened
download-template-from-repoURL parsing/validation and added regression tests for unsafe paths and temporary-dir cleanup.
Reviewed changes
Copilot reviewed 82 out of 82 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/utils/plugins.js | Switches plugin fixture writer from fs-extra to local outputFileSync helper |
| test/utils/fs.js | Replaces fs-extra with core-fs equivalents and adds helper utilities used across tests |
| test/unit/lib/utils/serverless-utils/download.test.js | Replaces fs-extra helpers with test fs helpers (remove, pathExists) |
| test/unit/lib/utils/serverless-utils/config.test.js | Replaces fs-extra directory/file helpers with test fs helpers |
| test/unit/lib/utils/rename-service.test.js | Replaces fs-extra reads/writes/dir creation with core fs + test helper |
| test/unit/lib/utils/log-deprecation.test.js | Adds regression test for creating parent dir before writing summary output |
| test/unit/lib/utils/glob.test.js | Replaces fs-extra with test outputFile/remove helpers |
| test/unit/lib/utils/get-framework-id.test.js | Replaces fs-extra dir setup/cleanup with test fs helpers |
| test/unit/lib/utils/fs/write-file.test.js | Adds test asserting nested parent directories are created |
| test/unit/lib/utils/fs/write-file-sync.test.js | Adds sync variant test asserting nested parent directories are created |
| test/unit/lib/utils/fs/safe-move-file.test.js | Replaces fs-extra usage and adds test ensuring temp destination is cleaned after success |
| test/unit/lib/utils/fs/remove.test.js | New tests for new runtime remove/removeSync helper |
| test/unit/lib/utils/fs/json-file.test.js | New tests for new runtime JSON read/write helper (BOM stripping, error prefixing, newline) |
| test/unit/lib/utils/fs/file-exists-sync.test.js | Replaces fs-extra symlink ops with core fs |
| test/unit/lib/utils/fs/ensure-file.test.js | New tests for new runtime ensure-file helper |
| test/unit/lib/utils/fs/dir-exists-sync.test.js | New tests for new runtime dir-exists-sync helper |
| test/unit/lib/utils/fs/create-zip-file.test.js | Replaces fs-extra.ensureDir with test ensureDir helper |
| test/unit/lib/utils/fs/copy.test.js | New tests for new runtime async copy helper |
| test/unit/lib/utils/fs/copy-sync.test.js | New tests for new runtime sync copy-sync helper |
| test/unit/lib/utils/fs/copy-dir-contents-sync.test.js | Updates cleanup and adds assertions around symlink dereference behavior |
| test/unit/lib/utils/extract-zip.test.js | Replaces fs-extra with test remove/pathExists helpers |
| test/unit/lib/utils/ensure-exists.test.js | Adds coverage for nested cache-dir creation prior to generation |
| test/unit/lib/utils/ensure-artifact.test.js | Replaces fs-extra.pathExists with test pathExists helper |
| test/unit/lib/utils/download-template-from-repo.test.js | Reworks stubs/cleanup and adds tests for temp-dir lifecycle + URL validation |
| test/unit/lib/utils/create-from-local-template.test.js | Adds test verifying symlinks are skipped when creating from local template |
| test/unit/lib/skip-on-disabled-symlinks-in-windows.test.js | New unit test for Windows symlink skip helper |
| test/unit/lib/plugins/standalone.test.js | New tests covering uninstall cleanup and stale temp-binary removal |
| test/unit/lib/plugins/install.test.js | Replaces fs-extra directory creation with test ensureDirSync |
| test/unit/lib/plugins/create/create.test.js | Replaces fs-extra ensure/remove usage with test fs helpers |
| test/unit/lib/plugins/aws/utils/credentials.test.js | Replaces fs-extra calls with test helpers and core fs.promises.lstat |
| test/unit/lib/plugins/aws/provider.test.js | Replaces fs-extra with test helpers; adds cleanup of created homedir .aws dir |
| test/unit/lib/plugins/aws/package/compile/functions.test.js | Replaces fs-extra.createReadStream with fs.createReadStream |
| test/unit/lib/plugins/aws/invoke-local/index.test.js | Updates proxyquire stubs to match new core-fs/copy helper usage |
| test/unit/lib/plugins/aws/deploy/lib/upload-artifacts.test.js | Replaces fs-extra.ensureFileSync with test helper |
| test/unit/lib/plugins/aws/custom-resources/index.test.js | Adds test asserting package dir is created before copying generated zip |
| test/unit/lib/plugins/aws/config-credentials.test.js | Replaces fs-extra output/remove with test fs helpers |
| test/unit/lib/plugins/aws/common/lib/artifacts.test.js | Replaces fs-extra.removeSync with test removeSync helper |
| test/unit/lib/configuration/read.test.js | Replaces fs-extra file/dir helpers with test fs helpers |
| test/unit/lib/cli/run-compose.test.js | Replaces fs-extra reads/writes/remove/writeJson with core-fs + test helpers |
| test/unit/lib/cli/resolve-configuration-path.test.js | Replaces fs-extra.ensureFile/ensureDir with test helpers |
| test/unit/lib/cli/local-serverless-path.test.js | Replaces fs-extra setup with test ensureDir/ensureFile |
| test/unit/lib/classes/utils.test.js | Replaces fs-extra stats/remove with core fs and test removeSync |
| test/unit/lib/classes/plugin-manager.test.js | Replaces fs-extra tmp dir creation/removal with test helpers |
| test/unit/lib/aws/has-local-credentials.test.js | Replaces fs-extra.outputFile/remove with test helpers |
| test/unit/commands/plugin-uninstall.test.js | Replaces fs-extra reads/writes with fs.promises and adds JSON-config coverage |
| test/unit/commands/plugin-install.test.js | Replaces fs-extra reads/writes with fs.promises and adds JSON-config coverage |
| test/lib/skip-on-disabled-symlinks-in-windows.js | Simplifies skip helper to avoid skip-with-notice dependency and validates mocha context |
| test/lib/setup-fixtures-engine.js | Replaces fs-extra copy/remove/read/write with core fs equivalents |
| test/lib/run-serverless.js | Replaces fs-extra.writeJson with test writeJsonFile helper |
| test/lib/provision-tmp-dir.js | Replaces fs-extra.mkdir with fs.promises.mkdir |
| test/lib/process-tmp-dir.js | Replaces fs-extra.removeSync with fs.rmSync |
| test/integration/create.test.js | Replaces fs-extra.ensureDir with test ensureDir helper |
| test/integration-package/lambda-files.tests.js | Replaces fs-extra.copy with test copyPath helper |
| test/integration-package/cloudformation.tests.js | Replaces fs-extra.copySync with test copyPathSync helper |
| test/integration-basic.test.js | Replaces fs-extra.mkdirsSync with test ensureDirSync helper |
| package.json | Removes fs-extra dependency |
| lib/utils/rename-service.js | Replaces fs-extra file ops with core fs |
| lib/utils/log-deprecation.js | Replaces fs-extra.ensureDir with fs.promises.mkdir({ recursive: true }) |
| lib/utils/fs/write-file.js | Replaces fs-extra.mkdirs with core fs.promises.mkdir({ recursive: true }) |
| lib/utils/fs/write-file-sync.js | Replaces fs-extra sync mkdir/write with core fs |
| lib/utils/fs/safe-move-file.js | Replaces fs-extra.copy/remove with fs.promises.copyFile + internal remove helper |
| lib/utils/fs/remove.js | New runtime remove/removeSync helper implemented via fs.rm* |
| lib/utils/fs/read-file-sync.js | Replaces fs-extra.readFileSync with core fs.readFileSync |
| lib/utils/fs/json-file.js | New runtime JSON helper for BOM stripping and error prefixing |
| lib/utils/fs/file-exists-sync.js | Replaces fs-extra.statSync with core fs.statSync |
| lib/utils/fs/ensure-file.js | New runtime ensure-file helper implemented via mkdir + open('a') |
| lib/utils/fs/dir-exists-sync.js | Replaces fs-extra.statSync with core fs.statSync |
| lib/utils/fs/copy.js | New runtime async copy helper (uses fs.cp, custom deref path to avoid symlink issues) |
| lib/utils/fs/copy-sync.js | New runtime sync copy helper (uses fs.cpSync, custom deref path to avoid symlink issues) |
| lib/utils/fs/copy-dir-contents-sync.js | Replaces fs-extra.copySync with internal copy-sync helper and updates filter handling |
| lib/utils/ensure-exists.js | Replaces fs-extra.ensureDir with fs.promises.mkdir({ recursive: true }) |
| lib/utils/download-template-from-repo.js | Removes fs-extra, adds strict URL path/query validation, and changes temp-dir handling |
| lib/utils/create-from-local-template.js | Replaces fs-extra.copy with internal copy helper |
| lib/plugins/standalone.js | Replaces fs-extra.remove with internal remove helper |
| lib/plugins/aws/invoke-local/index.js | Removes fs-extra, replaces ensure/copy with core mkdir + internal helpers |
| lib/plugins/aws/custom-resources/index.js | Replaces fs-extra.mkdirs/copy with core mkdir + copyFile |
| lib/plugins/aws/custom-resources/generate-zip.js | Replaces fs-extra.copy with internal copy helper |
| lib/plugins/aws/common/lib/cleanup-temp-dir.js | Replaces fs-extra.removeSync with internal removeSync |
| lib/plugins/aws/common/lib/artifacts.js | Replaces fs-extra.removeSync with internal removeSync |
| lib/classes/utils.js | Replaces fs-extra tmpdir/dir creation helpers with core fs.mkdirSync |
| commands/plugin-uninstall.js | Replaces fs-extra JSON handling with new lib/utils/fs/json-file helper |
| commands/plugin-install.js | Replaces fs-extra JSON handling with new lib/utils/fs/json-file helper |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a84e104 to
eeaddeb
Compare
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.
No description provided.