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

Preparations to use javascript modules and other small fixes #1050

Merged
merged 12 commits into from
Jan 8, 2024

Conversation

araujoarthur0
Copy link
Collaborator

@araujoarthur0 araujoarthur0 commented Jan 7, 2024

Related issue

This helps #1037

Context / Background

The new electron 28 changes things by providing main electron imports through JS modules. That means we'll be able to use import syntax rather than node's require(), and no longer need the esm module to use both notations.
The require() notation will still be available, making it the best of both worlds for other imports that haven't migrated yet - date-holidays for example.

I'm separating a few of the changes that will need to be made for a simpler review. These changes here still work in electron 27 and will clear the field for a larger patch.

What change is being introduced by this PR?

Using the .cjs extension for files that will be using only node modules

Commit: Renaming window-aux and app-config to .cjs

Updating pre-commit script

Script was trying to format deleted files. It also had to be updated to format .cjs and .mjs files
Commit: Preparing commit hook to accept mjs and cjs files, avoiding deleted files
Commit: Adding all 3 js extensions to eslint target

Cleanups

Commit: Adding 'use strict' to all files
Commit: Export section to have commas and be sorted, last line at end

Switching imports to import keyword rather than require()

Commit: Updating renderer electron imports
Commit: Switching 'fs' import to use import
Commit: Switching 'electron-store' import to use import
Commit: Switching notification.js to use export
Commit: Switching 'path' import to use import
Commit: Switching 'electron' to use import

How will this be tested?

Testsuite works fine.

Copy link

codecov bot commented Jan 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7be9e9a) 79.89% compared to head (5a3f644) 79.36%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1050      +/-   ##
==========================================
- Coverage   79.89%   79.36%   -0.53%     
==========================================
  Files          21       19       -2     
  Lines        1278     1231      -47     
  Branches      190      183       -7     
==========================================
- Hits         1021      977      -44     
+ Misses        257      254       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@araujoarthur0 araujoarthur0 merged commit c95578c into thamara:main Jan 8, 2024
8 of 9 checks passed
@araujoarthur0 araujoarthur0 deleted the renaming-extensions branch January 8, 2024 02:00
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