Skip to content

feat: add run from ASAR button #1695

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

AlokYadavCodes
Copy link
Contributor

  • Adds a dropdown to the right of the "Run" button, featuring a new button labeled "Run from ASAR"
  • Introduces a new optional parameter runOptions in Runner.run() method.
  • The runOptions parameter is defined as follows:
interface runOptions {
  runFromAsar: boolean;
}
  • Updates test snapshots to reflect the new UI changes.

Updated UI screenshots:

Screenshot from 2025-03-20 23-48-01
Screenshot from 2025-03-20 23-48-16

Closes #1551

This functionality requires an upstream change in @electron/fiddle-core.

I have already opened a PR to implement the required updates in fiddle-core:

Please review both the PR's and let me know if any changes are needed.

@AlokYadavCodes AlokYadavCodes requested review from codebytere and a team as code owners March 20, 2025 19:18
@AlokYadavCodes
Copy link
Contributor Author

Hey @codebytere , just checking in. Let me know if there's anything I can do to help with the review.

Also tagging @dsanders11 , since you opened this issue and are mentoring the GSoC project I’m applying for (Fiddle Support for Fuses), I would love to hear your thoughts as well.

Thanks so much for your time and guidance. I really appreciate it and am excited to incorporate any feedback you might have!

Copy link
Member

@nikwen nikwen left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request! I won't be able to review all of the PR, unfortunately, due to time constraints, but I thought this one was one of the best GSoC-related PRs I've seen so far this year.

I hope that someone else will get to this soon. There's a flood of GSoC-related pull requests at the moment, which keeps everyone busy. Please know that a good PR like this is very much appreciated. Thank you! 👍

Copy link
Member

@dsanders11 dsanders11 left a comment

Choose a reason for hiding this comment

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

This is a good start but it requires some changes and test coverage. 👍

Comment on lines 23 to 25
interface runOptions {
runFromAsar: boolean;
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
interface runOptions {
runFromAsar: boolean;
}
export interface RunOptions {
runFromAsar?: boolean;
}

Should start with a capital letter to match existing style, and should be exported since it's part of the public API for this file. Since these are options, runFromAsar should be optional as more options may be added in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, missed the capital letter there, thanks for catching that!
Exported it and made runFromAsar optional.

Comment on lines 378 to 380
if (runFromAsar) {
options.push('runFromAsar');
}
Copy link
Member

Choose a reason for hiding this comment

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

This should be added to StartFiddleParams, and then it will be handled automatically by the ...params in the call to window.ElectronFiddle.startFiddle below. This will also require changes in src/main/fiddle-core.ts to plumb it into the call to runner.spawn.

@dsanders11 dsanders11 marked this pull request as draft April 4, 2025 23:02
@dsanders11
Copy link
Member

@AlokYadavCodes, I've changed this PR to be a draft for the moment, the test failures are related to needing the @electron/fiddle-core PR to land first.

@AlokYadavCodes
Copy link
Contributor Author

Hey @dsanders11 ,
Now that the fiddle-core PR is merged, this one should be ready for review whenever you get a chance.

Also, I submitted a draft GSoC proposal titled "Electron Fiddle Support for Fuses" on April 2. If you have a moment to share any quick feedback before the deadline tomorrow, I'd really appreciate it. Totally understand if you're busy - thanks!

@dsanders11
Copy link
Member

@AlokYadavCodes, you'll need to bump the version of @electron/fiddle-core in this PR to use the new v1.4.0 release with your corresponding changes there.

If you have a moment to share any quick feedback before the deadline tomorrow, I'd really appreciate it. Totally understand if you're busy - thanks!

Please send it to [email protected] as that's where we provide draft feedback. 🙂

@AlokYadavCodes AlokYadavCodes marked this pull request as ready for review April 7, 2025 20:23
@AlokYadavCodes
Copy link
Contributor Author

@dsanders11
Updated the PR to use @electron/[email protected] and sent the draft proposal to the email you mentioned. Thanks again for the guidance!

@coveralls
Copy link

coveralls commented Apr 7, 2025

Coverage Status

coverage: 87.224% (-0.2%) from 87.472%
when pulling 15a7597 on AlokYadavCodes:feat/1551-run-from-asar
into d5e133f on electron:main.

@dsanders11
Copy link
Member

@AlokYadavCodes, the UI around the "Run from ASAR" button needs to be improved from my testing, the dropdown is a bit awkward looking with the focus ring around it (could it look more like the the dropdown for public/private gist?) and the dropdown remains there after I've clicked on it.

I've also realized that this line is preventing this from working (due to starting options with dir) as we're actually running the fiddle out of the copied files, rather than the directory that fiddle-core creates. This wasn't caught in the refactor to start using fiddle-core internally since it just works, but it'll need to be changed to ensure the ASAR is used. I need to think through any other consequences of changing this before we do it, but you can work on the UI improvements in the meantime.

const options = [dir, '--inspect'].concat(executionFlags);

@AlokYadavCodes
Copy link
Contributor Author

@dsanders11, fixed the UI to match the dropdown style used for public/private gist selection.

I've also realized that this line is preventing this from working (due to starting options with dir) as we're actually running the fiddle out of the copied files, rather than the directory that fiddle-core creates.

Should we also update the cwd in child_process.spawn() options to point to the directory created by fiddle-core? Currently it is set to the copied files directory path.

{ args: options, cwd: dir, env },

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.

Run from ASAR
4 participants