Skip to content

Commit

Permalink
fixed bug arguments was wrong, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TsMonkeyPatch committed Feb 15, 2021
1 parent 5f7935f commit 184611b
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 15 deletions.
39 changes: 33 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,45 @@ This is more designed as a service, that means you can install electron but it w
CommandParams

```ts
type EventParams = ...string[] | { version: string, args: string[] }
type EventParams = ...string[] | { version: string, params: string[] }
```
## Commands
|name|params|return value|description|
|-|-|-|-|
|qmasters:electron.install|[version:string]|boolean| install passed version of electron for example v11.2.0. Default latest version which can found for electron|
|qmasters:electron.run|EventParams|ChildProcess| starts electron app in specific version, all arguments passed as **...string[]** will directly passed to electron as command line arguments. Alternate to use a specific version use **{ version: string, args: string[]}** for example **{ version: "v11.2.0", args: ["file_to_execute.js", "second param"]}**. It will allways check the version which should be used is installed, if not it will install directly. If no version is passed it will take allways the latest version and install if required.|
### qmasters:electron-install
install: electron in specifc version if not exists
#### @params
[version:string]
#### @return
string version which has been installed
### qmasters:electron-run
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
```ts
{
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.
#### @params
file: string, [EventParams]
#### @return
ChildProcess
## Development
- go into src directory
- npm install
- start extension via F5 inside of vscode
38 changes: 33 additions & 5 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,43 @@ This is more designed as a service, that means you can install electron but it w
CommandParams

```ts
type EventParams = ...string[] | { version: string, args: string[] }
type EventParams = ...string[] | { version: string, params: string[] }
```
## Commands
|name|params|return value|description|
|-|-|-|-|
|qmasters:electron.install|[version:string]|boolean| install passed version of electron for example v11.2.0. Default latest version which can found for electron|
|qmasters:electron.run|EventParams|ChildProcess| starts electron app in specific version, all arguments passed as **...string[]** will directly passed to electron as command line arguments. Alternate to use a specific version use **{ version: string, args: string[]}** for example **{ version: "v11.2.0", args: ["file_to_execute.js", "second param"]}**. It will allways check the version which should be used is installed, if not it will install directly. If no version is passed it will take allways the latest version and install if required.|
### qmasters:electron-install
install: electron in specifc version if not exists
#### @params
[version:string]
#### @return
string version which has been installed
### qmasters:electron-run
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
```ts
{
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.
#### @params
file: string, [EventParams]
#### @return
ChildProcess
## Development
- go into src directory
Expand Down
7 changes: 3 additions & 4 deletions src/lib/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import "reflect-metadata";
import { container } from "tsyringe";
import * as vscode from "vscode";
import { ELECTRON_ENV_VARS, ELECTRON_INSTALL_PATH, EventParams, OUTPUT_CHANNEL } from "./api";
import { ELECTRON_ENV_VARS, ELECTRON_INSTALL_PATH, OUTPUT_CHANNEL } from "./api";

import { ElectronInstaller } from "./installer";
import { ElectronManager } from "./manager";


export function activate(context: vscode.ExtensionContext) {

/**
Expand Down Expand Up @@ -48,9 +47,9 @@ export function activate(context: vscode.ExtensionContext) {
let params = args;

if (args[0].hasOwnProperty("version") && args[0].hasOwnProperty("params")) {
[version, params] = args[0]
version = args[0].version
params = args[0].params
}

return electronManager.run(file, version, ...params)
})
]
Expand Down

0 comments on commit 184611b

Please sign in to comment.