-
Notifications
You must be signed in to change notification settings - Fork 739
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
AlokYadavCodes
wants to merge
6
commits into
electron:main
Choose a base branch
from
AlokYadavCodes:feat/1551-run-from-asar
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3b25345
feat: add run from ASAR button
AlokYadavCodes 7fe1b21
refactor: extract Asar button UI into a separate component
AlokYadavCodes eee6ea4
Merge branch 'electron:main' into feat/1551-run-from-asar
AlokYadavCodes 177b402
refactor: address review feedback
AlokYadavCodes 4126b85
chore(deps): bump @electron/fiddle-core from 1.3.3 to 1.4.0
AlokYadavCodes 15a7597
refactor: improve "Run from ASAR" dropdown styling
AlokYadavCodes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,11 +20,16 @@ export enum ForgeCommands { | |
| MAKE = 'make', | ||
| } | ||
|
|
||
| interface runOptions { | ||
| runFromAsar: boolean; | ||
| } | ||
|
|
||
| interface RunFiddleParams { | ||
| localPath: string | undefined; | ||
| isValidBuild: boolean; // If the localPath is a valid Electron build | ||
| version: string; // The user selected version | ||
| dir: string; | ||
| runFromAsar: boolean; | ||
AlokYadavCodes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| const resultString: Record<RunResult, string> = Object.freeze({ | ||
|
|
@@ -139,8 +144,9 @@ export class Runner { | |
| /** | ||
| * Actually run the fiddle. | ||
| */ | ||
| public async run(): Promise<RunResult> { | ||
| public async run(runOptions?: runOptions): Promise<RunResult> { | ||
| const options = { includeDependencies: false, includeElectron: false }; | ||
| const runFromAsar = runOptions?.runFromAsar ?? false; | ||
|
|
||
| const { appState } = this; | ||
| const currentRunnable = appState.currentElectronVersion; | ||
|
|
@@ -220,6 +226,7 @@ export class Runner { | |
| isValidBuild, | ||
| dir, | ||
| version, | ||
| runFromAsar, | ||
| }); | ||
| } | ||
|
|
||
|
|
@@ -362,12 +369,15 @@ export class Runner { | |
| * or the user selected electron version | ||
| */ | ||
| private async runFiddle(params: RunFiddleParams): Promise<RunResult> { | ||
| const { version, dir } = params; | ||
| const { version, dir, runFromAsar } = params; | ||
| const { pushOutput, flushOutput, executionFlags } = this.appState; | ||
| const env = this.buildChildEnvVars(); | ||
|
|
||
| // Add user-specified cli flags if any have been set. | ||
| const options = [dir, '--inspect'].concat(executionFlags); | ||
| if (runFromAsar) { | ||
| options.push('runFromAsar'); | ||
| } | ||
|
||
|
|
||
| const cleanup = async () => { | ||
| flushOutput(); | ||
|
|
||
161 changes: 98 additions & 63 deletions
161
tests/renderer/components/__snapshots__/commands-runner-spec.tsx.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,85 +1,120 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
|
||
| exports[`Runner component renders InstallState.downloading 1`] = ` | ||
| <Blueprint3.Button | ||
| disabled={true} | ||
| icon={ | ||
| <Blueprint3.Spinner | ||
| size={16} | ||
| value={50} | ||
| /> | ||
| } | ||
| id="button-run" | ||
| text="Downloading" | ||
| /> | ||
| <Blueprint3.ButtonGroup> | ||
| <Blueprint3.Button | ||
| disabled={true} | ||
| icon={ | ||
| <Blueprint3.Spinner | ||
| size={16} | ||
| value={50} | ||
| /> | ||
| } | ||
| id="button-run" | ||
| text="Downloading" | ||
| /> | ||
| <AsarButton | ||
| disabled={true} | ||
| /> | ||
| </Blueprint3.ButtonGroup> | ||
| `; | ||
|
|
||
| exports[`Runner component renders InstallState.installed 1`] = ` | ||
| <Blueprint3.Button | ||
| disabled={false} | ||
| icon="play" | ||
| id="button-run" | ||
| onClick={[MockFunction]} | ||
| text="Run" | ||
| /> | ||
| <Blueprint3.ButtonGroup> | ||
| <Blueprint3.Button | ||
| disabled={false} | ||
| icon="play" | ||
| id="button-run" | ||
| onClick={[Function]} | ||
| text="Run" | ||
| /> | ||
| <AsarButton | ||
| disabled={false} | ||
| /> | ||
| </Blueprint3.ButtonGroup> | ||
| `; | ||
|
|
||
| exports[`Runner component renders InstallState.installing 1`] = ` | ||
| <Blueprint3.Button | ||
| disabled={true} | ||
| icon={ | ||
| <Blueprint3.Spinner | ||
| size={16} | ||
| /> | ||
| } | ||
| id="button-run" | ||
| text="Unzipping" | ||
| /> | ||
| <Blueprint3.ButtonGroup> | ||
| <Blueprint3.Button | ||
| disabled={true} | ||
| icon={ | ||
| <Blueprint3.Spinner | ||
| size={16} | ||
| /> | ||
| } | ||
| id="button-run" | ||
| text="Unzipping" | ||
| /> | ||
| <AsarButton | ||
| disabled={true} | ||
| /> | ||
| </Blueprint3.ButtonGroup> | ||
| `; | ||
|
|
||
| exports[`Runner component renders InstallState.missing 1`] = ` | ||
| <Blueprint3.Button | ||
| disabled={true} | ||
| icon={ | ||
| <Blueprint3.Spinner | ||
| size={16} | ||
| /> | ||
| } | ||
| id="button-run" | ||
| text="Checking status" | ||
| /> | ||
| <Blueprint3.ButtonGroup> | ||
| <Blueprint3.Button | ||
| disabled={true} | ||
| icon={ | ||
| <Blueprint3.Spinner | ||
| size={16} | ||
| /> | ||
| } | ||
| id="button-run" | ||
| text="Checking status" | ||
| /> | ||
| <AsarButton | ||
| disabled={true} | ||
| /> | ||
| </Blueprint3.ButtonGroup> | ||
| `; | ||
|
|
||
| exports[`Runner component renders idle 1`] = ` | ||
| <Blueprint3.Button | ||
| disabled={false} | ||
| icon="play" | ||
| id="button-run" | ||
| onClick={[MockFunction]} | ||
| text="Run" | ||
| /> | ||
| <Blueprint3.ButtonGroup> | ||
| <Blueprint3.Button | ||
| disabled={false} | ||
| icon="play" | ||
| id="button-run" | ||
| onClick={[Function]} | ||
| text="Run" | ||
| /> | ||
| <AsarButton | ||
| disabled={false} | ||
| /> | ||
| </Blueprint3.ButtonGroup> | ||
| `; | ||
|
|
||
| exports[`Runner component renders installing modules 1`] = ` | ||
| <Blueprint3.Button | ||
| disabled={false} | ||
| icon={ | ||
| <Blueprint3.Spinner | ||
| size={16} | ||
| /> | ||
| } | ||
| id="button-run" | ||
| text="Installing modules" | ||
| /> | ||
| <Blueprint3.ButtonGroup> | ||
| <Blueprint3.Button | ||
| disabled={false} | ||
| icon={ | ||
| <Blueprint3.Spinner | ||
| size={16} | ||
| /> | ||
| } | ||
| id="button-run" | ||
| text="Installing modules" | ||
| /> | ||
| <AsarButton | ||
| disabled={true} | ||
| /> | ||
| </Blueprint3.ButtonGroup> | ||
| `; | ||
|
|
||
| exports[`Runner component renders running 1`] = ` | ||
| <Blueprint3.Button | ||
| active={true} | ||
| disabled={false} | ||
| icon="stop" | ||
| id="button-run" | ||
| onClick={[MockFunction]} | ||
| text="Stop" | ||
| /> | ||
| <Blueprint3.ButtonGroup> | ||
| <Blueprint3.Button | ||
| active={true} | ||
| disabled={false} | ||
| icon="stop" | ||
| id="button-run" | ||
| onClick={[MockFunction]} | ||
| text="Stop" | ||
| /> | ||
| <AsarButton | ||
| disabled={true} | ||
| /> | ||
| </Blueprint3.ButtonGroup> | ||
| `; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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,
runFromAsarshould be optional as more options may be added in the future.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.
Oops, missed the capital letter there, thanks for catching that!
Exported it and made
runFromAsaroptional.