Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on isomorphic-fetch #1616

Merged
merged 5 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-react": "7.32.2",
"husky": "8.0.3",
"isomorphic-fetch": "3.0.0",
"jsdom": "22.1.0",
"lerna": "7.1.3",
"npm-run-all": "4.1.5",
"prettier": "3.0.0",
"rxjs-compat": "6.6.7",
"typescript": "5.1.6"
},
"dependencies": {
"isomorphic-fetch": "3.0.0"
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was that needed to be moved from devDependencies to dependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after changing scripts/get-changelog.js there was an error ('isomorphic-fetch' should be listed in the project's dependencies, not devDependencies). So I modified it and it worked fine.

"resolutions": {
"**/lodash": "4.17.21"
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/get-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
// This code will generate changelog entries

const { readFile } = require('fs');
const { promisify } = require('util');
// eslint-disable-next-line import/no-extraneous-dependencies
const fetch = require('isomorphic-fetch');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this dep altogether? It's a polyfill for browsers, but we're using this script only with node.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yurishkuro Yes, it can be removed. @Yushmanth-reddy Here's some instructions to go ahead

// ... (rest of the code)

const { readFile } = require('fs').promises; // Use native fs.promises.readFile

// ... (rest of the code)

// Remove the following line since 'promisify' is not required anymore
// const { promisify } = require('util');

// ... (rest of the code)

// Modify this function to use native fs.promises.readFile
// const readFilePromise = promisify(readFile);
// Instead, use the following line to define readFilePromise
// const readFilePromise = readFile;

// ... (rest of the code)

// No other changes are required in the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, thanks @anshgoyalevil

// eslint-disable-next-line import/no-extraneous-dependencies
const jsdom = require('jsdom');
const { promisify } = require('util');

const readFilePromise = promisify(readFile);

Expand Down