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

Refactor websocket/ from CommonJS to ESM #324

Merged
merged 11 commits into from
Sep 12, 2023

Conversation

DuCanhGH
Copy link
Contributor

@DuCanhGH DuCanhGH commented Sep 11, 2023

Description

This PR migrates websocket/ from CommonJS to ESM. This helps modernize the codebase, gets rid of legacy or unmaintained code (including packages), and helps make the code easier to work with. It also adds a lockfile for npm to avoid breaking the site when sudden breaking changes happen in one or more dependencies.

What

Some of the changes are as aforementioned.

The PR gets rid of qu (with a copy of its code) and simplesets (with JS's standardized Set), which haven't been maintained in years.

I've also added prettier to help format JS code so that we don't have to manually format them (currently applies to websocket/ only), fixed some grammar errors in README.md and 502.html.

Node.js has been upgraded to v18 as v14 reached its End-of-Life in April 2023 and v16 reaches its End-of-Life today.

No breaking changes are expected from this PR.

How was this PR tested?

I simply set EVENT_DAEMON_USE in local_settings.py to True and provided EVENT_DAEMON_POST and EVENT_DAEMON_GET, and verified that the websocket still worked by submitting in one tab and opening /submissions in another tab. Both tabs were updated when the judge finished testing.

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have explained the purpose of this PR.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the README/documentation
  • Any dependent changes have been merged and published in downstream modules
  • Informed of breaking changes, testing and migrations (if applicable).
  • Attached screenshots (if applicable).

By submitting this pull request, I confirm that my contribution is made under the terms of the AGPL-3.0 License.

.gitignore Outdated Show resolved Hide resolved
@hieplpvip
Copy link
Contributor

Thanks for the PR!

I think the changes in README.md and 502.html should be in another PR.
@leduythuccs What do you think?

.gitignore Outdated Show resolved Hide resolved
@DuCanhGH
Copy link
Contributor Author

@hieplpvip I was going to add something to README.md anyway, so I think it'd be nice to just keep the changes.

@DuCanhGH DuCanhGH changed the title refactor: migrate websocket to ESM Refactor websocket/ from CommonJS to ESM Sep 12, 2023
@DuCanhGH DuCanhGH requested a review from hieplpvip September 12, 2023 11:39
Copy link
Contributor

@hieplpvip hieplpvip left a comment

Choose a reason for hiding this comment

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

LGTM

@hieplpvip hieplpvip merged commit 8795a9b into VNOI-Admin:master Sep 12, 2023
3 checks passed
behitek pushed a commit to luyencode/lcoj-site that referenced this pull request Sep 15, 2023
Co-authored-by: Le Bao Hiep <baohiep2013@gmail.com>
behitek added a commit to luyencode/lcoj-site that referenced this pull request Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants