-
Notifications
You must be signed in to change notification settings - Fork 505
Use several modern Node.js patterns #4632
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
Conversation
Use the the `node:` protocol when importing Node.js builtin modules and enable rule in eslint to enforce. The `node:` protocol for Node.js builtin modules has been available since Node.js v14. See: https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/enforce-node-protocol-usage.md
We can use the Node.js Fetch API directly instead of relying on an external dependency.
Modern Node.js can watch natively so we don't need nodemon anymore.
2ac3cf4 to
4d70510
Compare
nwoodward
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks @alanorth. I'm by no means a Node expert, but this handful of changes makes sense, and it's nice to remove a few dependencies. The start:dev and test:watch commands work the same for me.
tdonohue
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks @alanorth ! This looks good to me too, and I also like it removes some unnecessary dependencies. I also manually tested SSR (since this touches server.ts) and verified that it's still working properly.
|
Successfully created backport PR for |
|
Has this been tested on Windows development environments? |
|
Hi @tamu-sad-iii. I have not personally tried this on Windows. These "modern" Node.js patterns use built-in Node APIs and functionality, so I assume they are better supported than external modules etc. Do you build DSpace on a Windows system? If there are problems you can help us diagnose and if need be, we can revert the changes. Thanks. |
Description
The Node.js platform has evolved in recent years and there are some new patterns we should take advantage of.
See: https://kashw1n.com/blog/nodejs-2025/
Instructions for Reviewers
Please add a more detailed description of the changes made by your PR. At a minimum, providing a bulleted list of changes in your PR is helpful to reviewers.
List of changes in this PR:
node:prefix when importing built-in dependencies and add an eslint plugin to enforceInclude guidance for how to test or review your PR. This may include: steps to reproduce a bug, screenshots or description of a new feature, or reasons behind specific changes.
Make sure the frontend builds and runs as expected, especially the builds that use watch like
npm run start:dev.Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.