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

fix: enforce extraModules to be a set of strings #888

Merged
merged 4 commits into from
Nov 12, 2024

Conversation

paul-marechal
Copy link
Contributor

For some reason TypeScript is AOK with stuffing Set objects with
random keys. This is problematic as this is not how Set are supposed
to be used (like a plain JavaScript object map).

Fix the logic to respect the -w/--which-module CLI argument.

@codecov-commenter
Copy link

codecov-commenter commented Oct 8, 2021

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.47%. Comparing base (4663859) to head (645c794).
Report is 27 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #888      +/-   ##
==========================================
+ Coverage   76.30%   76.47%   +0.17%     
==========================================
  Files          21       21              
  Lines         726      727       +1     
  Branches      136      136              
==========================================
+ Hits          554      556       +2     
  Misses        121      121              
+ Partials       51       50       -1     

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

For some reason TypeScript is AOK with stuffing `Set` objects with
random keys. This is problematic as this is not how `Set` are supposed
to be used (like a plain JavaScript object map).

Fix the logic to respect the `-w/--which-module` CLI argument.
@paul-marechal
Copy link
Contributor Author

@malept ping.

The -w/--which-module argument must have been broken for some time now, I have an issue where it doesn't work as far back as [email protected]. This patch rectifies the logic to make it work.

Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

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

Code LGTM. Approved, but I'll hold off merging since @malept was pinged in case he wants to review.

@paul-marechal please ping me if nothing happens in a week 😸

@paul-marechal
Copy link
Contributor Author

@paul-marechal please ping me if nothing happens in a week 😸

@ckerr ping :)

@malept
Copy link
Member

malept commented Oct 28, 2021

Can the added unit tests not cause modules to be rebuilt? Trying not to increase the test time when possible.

@paul-marechal
Copy link
Contributor Author

@malept I am not familiar with how electron-rebuild works and how to do that... Do you have any pointers on how to test that --which-module/-w actually works without causing the rebuild? Is there a way to do some kind of dry run?

@paul-marechal
Copy link
Contributor Author

@ckerr @malept updated the tests. I modified one of the tests to delete all dependencies from the package.json file and make use of extraModules.

paul-marechal added a commit to eclipse-theia/theia that referenced this pull request Nov 17, 2021
See electron/rebuild#888

The way we invoke `electron-rebuild` should allow Theia application
developers to run `theia rebuild:*` from the root of their monorepos,
but because of a bug in `electron-rebuild` it will only build
dependencies listed in the `package.json` file located in `cwd`.

Implement a workaround that modifies or creates a `package.json` file to
list the dependencies to rebuild.

Add exit hooks to cleanup in case users do `Ctrl+C` while theia rebuild
is running so that we don't pollute user workspaces.
paul-marechal added a commit to eclipse-theia/theia that referenced this pull request Nov 17, 2021
See electron/rebuild#888

The way we invoke `electron-rebuild` should allow Theia application
developers to run `theia rebuild:*` from the root of their monorepos,
but because of a bug in `electron-rebuild` it will only build
dependencies listed in the `package.json` file located in `cwd`.

Implement a workaround that modifies or creates a `package.json` file to
list the dependencies to rebuild.

Add exit hooks to cleanup in case users do `Ctrl+C` while theia rebuild
is running so that we don't pollute user workspaces.
paul-marechal added a commit to eclipse-theia/theia that referenced this pull request Nov 17, 2021
See electron/rebuild#888

The way we invoke `electron-rebuild` should allow Theia application
developers to run `theia rebuild:*` from the root of their monorepos,
but because of a bug in `electron-rebuild` it will only build
dependencies listed in the `package.json` file located in `cwd`.

Implement a workaround that modifies or creates a `package.json` file to
list the dependencies to rebuild.

Add exit hooks to cleanup in case users do `Ctrl+C` while theia rebuild
is running so that we don't pollute user workspaces.
paul-marechal added a commit to eclipse-theia/theia that referenced this pull request Nov 17, 2021
See electron/rebuild#888

The way we invoke `electron-rebuild` should allow Theia application
developers to run `theia rebuild:*` from the root of their monorepos,
but because of a bug in `electron-rebuild` it will only build
dependencies listed in the `package.json` file located in `cwd`.

Implement a workaround that modifies or creates a `package.json` file to
list the dependencies to rebuild.

Add exit hooks to cleanup in case users do `Ctrl+C` while theia rebuild
is running so that we don't pollute user workspaces.
paul-marechal added a commit to eclipse-theia/theia that referenced this pull request Nov 23, 2021
* workaround electron-rebuild bug

See electron/rebuild#888

The way we invoke `electron-rebuild` should allow Theia application
developers to run `theia rebuild:*` from the root of their monorepos,
but because of a bug in `electron-rebuild` it will only build
dependencies listed in the `package.json` file located in `cwd`.

Implement a workaround that modifies or creates a `package.json` file to
list the dependencies to rebuild.

Add exit hooks to cleanup in case users do `Ctrl+C` while theia rebuild
is running so that we don't pollute user workspaces.
@vince-fugnitto
Copy link

@malept @ckerr any updates?

Copy link
Member

@malept malept left a comment

Choose a reason for hiding this comment

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

It seems to me like there should be a better way to test this. I need to think about it.

Also I'm not thrilled at the idea that a test has been modified, rather than adding a separate test.

@paul-marechal
Copy link
Contributor Author

paul-marechal commented Jan 12, 2022

Can the added unit tests not cause modules to be rebuilt? Trying not to increase the test time when possible.

@malept I did it this way because of the above comment, I thought the new test I had added was causing issues...

edit: See the commit where I removed the extra tests.

With the current way, it won't build (many) more packages than what it used to before, keeping the test run time low. Moreover the specific test modified is specifically trying to rebuild packages that aren't part of dependencies, so this hackish way of modifying the package.json just for this case seemed reasonable to me.

If the test is that problematic I can always remove it :)

The previous lookup logic was broken without a doubt, and the fix in this PR is trivial.

@malept malept changed the title fix usage of this.prodDeps as a Set<string> fix: enforce extraModules to be a set of strings Jan 17, 2022
Copy link
Contributor Author

@paul-marechal paul-marechal left a comment

Choose a reason for hiding this comment

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

Your last commit looks good to me! Thanks for helping with this, I didn't feel familiar enough with the internals to do what you did.

@paul-marechal
Copy link
Contributor Author

@malept should I do anything?

@vince-fugnitto
Copy link

@malept any update?

@vince-fugnitto
Copy link

ping.

@erickzhao erickzhao requested a review from a team as a code owner November 7, 2023 22:49
@tsmaeder
Copy link

Hello, is this thing on? The PR has been open for 2.5 years and approved for half a year. Can we get a decision, please?

Copy link
Member

@erikian erikian left a comment

Choose a reason for hiding this comment

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

Looks like all feedback was addressed, so this should be good to land

@erikian erikian merged commit 6430e74 into electron:main Nov 12, 2024
3 checks passed
Copy link

🎉 This PR is included in version 3.7.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@paul-marechal paul-marechal deleted the mp/set-fix branch November 12, 2024 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants