fix: remove use of node-fetch, use built-in fetch - #71
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the node-fetch dependency and switches the codebase to Node’s built-in fetch (Node >=20), eliminating deprecation warnings coming from node-fetch@v2’s dependency chain.
Changes:
- Dropped
node-fetchfrom runtime dependencies and removed its usage fromsrc/lib/npm-helper.js. - Updated unit tests to mock
global.fetchinstead ofnode-fetch. - Added a Jest helper (
global.setFetchMock) to simplify fetch mocking across tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/lib/npm-helper.js |
Removes node-fetch import and relies on built-in fetch. |
package.json |
Removes node-fetch dependency entry. |
jest.setup.js |
Adds global.setFetchMock helper for mocking fetch in tests. |
test/lib/npm-helper.test.js |
Replaces node-fetch mocking with global.fetch mocking via setFetchMock. |
test/commands/templates/rollback.test.js |
Removes leftover commented node-fetch reference. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot apply changes based on the comments in this thread |
…heck Agent-Logs-Url: https://github.com/adobe/aio-cli-plugin-app-templates/sessions/32ce92b5-76ec-4dbe-9268-5c8558eb60b7 Co-authored-by: shazron <36107+shazron@users.noreply.github.com>
Applied both review suggestions (commit
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
codecov is not running because we don't have |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Motivation and Context
node-fetch@v2's dependencies use the built in punycode module, which is deprecated in node-22, and prints out a deprecation warning.
How Has This Been Tested?
Types of changes
Checklist: