Install or Executes Electon apps inside of vscode
If an extension is to be created which displays a dialog with the help of Electron, or is to call up a session cookie, this is currently only possible with great difficulty because it is not possible to install electron via the package.json.
- Option we could deliver Electron which leads
- to a very large extension and more importantly
- the electron binaries are OS specific. So if the extension developed on a Windows system then is electron for Windows inside and will not run on mac / linux.
- Option Hope that Electron is installed globally, otherwise it won't work.
- Option is to compile the app beforehand, but this must be done separately for Mac, Windows and Linux.
The aim of this extension is to solve precisely those problems.
- It is checked whether an Electron is available (global) or with Mac whether it is installed under Applications.
- If it is not installed, the OS-specific version of Electron is downloaded for Mac, Windows or Linux, thus ensuring platform independence.
Furthermore, javascript files can now be started directly via vscode in electron so the files no longer have to be compiled.
This is more designed as a service, that means you can install electron but it will not help alot. These is an example how this could be used inside your extension @see Vscode-Electron-Demo and Run Electron Command how this could be used inside an extension.
CommandParams
type EventParams = ...string[] | { version: string, params: string[] }
install: electron in specifc version if not exists
[version:string]
string version which has been installed
Starts electron with passed file. Second parameter is optional, if it passed as ...string[] it will use the latest version which can be found for electron, all params will passed as command line arguments to electron.
To run in a specific version pass an object as second param
{
version: string,
params: string[]
}
In both cases if electron in this version could not be found, latest electron version or passed one, it will install the required version.
file: string, [EventParams]
ChildProcess
- go into src directory
- npm install
- start extension via F5 inside of vscode