@kawalir/extension-node 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Support for creating a window in Process.command.pwsh
|
|
@@ -1,15 +1,47 @@
|
|
|
1
1
|
import { ChildProcess } from "@kawalir/extension-node/External";
|
|
2
2
|
|
|
3
|
+
type WindowOptions = {
|
|
4
|
+
keepOpen?: boolean;
|
|
5
|
+
title?: string;
|
|
6
|
+
administrator?: boolean;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type PwshRequest = {
|
|
10
|
+
command: string;
|
|
11
|
+
folderPath: string;
|
|
12
|
+
window?: WindowOptions;
|
|
13
|
+
};
|
|
14
|
+
|
|
3
15
|
export class CommandFunctions {
|
|
4
|
-
public static pwsh = (request: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const result = ChildProcess.spawnSync(request.command, {
|
|
16
|
+
public static pwsh = (request: PwshRequest): void => {
|
|
17
|
+
const window = request.window ?? null;
|
|
18
|
+
let command: string;
|
|
19
|
+
const options: ChildProcess.SpawnSyncOptions = {
|
|
9
20
|
cwd: request.folderPath,
|
|
10
21
|
shell: "pwsh",
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
};
|
|
23
|
+
if (window === null) {
|
|
24
|
+
command = request.command;
|
|
25
|
+
options.stdio = "inherit";
|
|
26
|
+
} else {
|
|
27
|
+
const windowCommand = [
|
|
28
|
+
window.title === undefined
|
|
29
|
+
? null
|
|
30
|
+
: `\`$Host.UI.RawUI.WindowTitle = '${window.title}'`,
|
|
31
|
+
request.command,
|
|
32
|
+
]
|
|
33
|
+
.filter((e) => typeof e === "string")
|
|
34
|
+
.join("; ");
|
|
35
|
+
command =
|
|
36
|
+
"start pwsh -ArgumentList " +
|
|
37
|
+
(window.keepOpen === true ? `"-NoExit",` : "") +
|
|
38
|
+
`"-Command","${windowCommand}"`;
|
|
39
|
+
if (window.administrator === true) {
|
|
40
|
+
command += " -Verb RunAs";
|
|
41
|
+
}
|
|
42
|
+
options.stdio = "ignore";
|
|
43
|
+
}
|
|
44
|
+
const result = ChildProcess.spawnSync(command, options);
|
|
13
45
|
if (result.status === 0) {
|
|
14
46
|
return;
|
|
15
47
|
}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"Node",
|
|
8
8
|
"Node Extension"
|
|
9
9
|
],
|
|
10
|
-
"version": "0.6.
|
|
10
|
+
"version": "0.6.2",
|
|
11
11
|
"author": "Denis Mijatovic",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"type": "commonjs",
|
|
@@ -30,12 +30,13 @@
|
|
|
30
30
|
"minor": "npm run script Publish minor",
|
|
31
31
|
"patch": "npm run script Publish patch",
|
|
32
32
|
"script": "cd Scripts && npm start",
|
|
33
|
-
"test": "cd Test && npm
|
|
34
|
-
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@types/node": "^25.3.0"
|
|
33
|
+
"test": "cd Test && npm run once",
|
|
34
|
+
"watch-test": "cd Test && npm start"
|
|
37
35
|
},
|
|
38
36
|
"dependencies": {
|
|
39
37
|
"@kawalir/extension": "^0.8.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/node": "^25.3.0"
|
|
40
41
|
}
|
|
41
42
|
}
|