From 184611b0be285a56fce007260cdebbc506b1d3ed Mon Sep 17 00:00:00 2001 From: Ralf Hannuschka Date: Mon, 15 Feb 2021 21:39:10 +0100 Subject: [PATCH] fixed bug arguments was wrong, update docs --- README.md | 39 +++++++++++++++++++++++++++++++++------ src/README.md | 38 +++++++++++++++++++++++++++++++++----- src/lib/main.ts | 7 +++---- 3 files changed, 69 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 452caab..e43a060 100644 --- a/README.md +++ b/README.md @@ -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 - diff --git a/src/README.md b/src/README.md index 66cf087..e43a060 100644 --- a/src/README.md +++ b/src/README.md @@ -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 diff --git a/src/lib/main.ts b/src/lib/main.ts index 3f22e78..70b8558 100644 --- a/src/lib/main.ts +++ b/src/lib/main.ts @@ -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) { /** @@ -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) }) ]