@notask/unity-cli-tools 1.0.6 → 1.0.7
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 +10 -0
- package/dist/cjs/unityEditor.js +1 -1
- package/dist/cjs/unityHub.js +13 -2
- package/dist/cjs/utils/commandExecutor.js +28 -0
- package/dist/esm/unityEditor.js +1 -1
- package/dist/esm/unityHub.js +13 -2
- package/dist/esm/utils/commandExecutor.d.ts +2 -0
- package/dist/esm/utils/commandExecutor.js +28 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [1.0.7](https://github.com/NoTaskStudios/unity-cli-tools/compare/1.0.6...1.0.7) (2025-05-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **Editor:** hotfix import error from UnityEditor security ([f7cf9b8](https://github.com/NoTaskStudios/unity-cli-tools/commit/f7cf9b886e63df9e7ad2c10ac3351f42a73b9c81))
|
|
7
|
+
* extended CommandOptions with std events ([8198f9f](https://github.com/NoTaskStudios/unity-cli-tools/commit/8198f9f5fec330a389405194412310d22b3ab785))
|
|
8
|
+
* **Hub:** simple stream output feedback ([ba21b46](https://github.com/NoTaskStudios/unity-cli-tools/commit/ba21b462f3eee168909ae54003936e4c551bcaed)), closes [#13](https://github.com/NoTaskStudios/unity-cli-tools/issues/13)
|
|
9
|
+
* subprocess send streams stdout and stderr ([4348611](https://github.com/NoTaskStudios/unity-cli-tools/commit/4348611f96da5fbbed39895ac587a5e6caad1d03))
|
|
10
|
+
|
|
1
11
|
## [1.0.6](https://github.com/NoTaskStudios/unity-cli-tools/compare/1.0.5...1.0.6) (2025-04-30)
|
|
2
12
|
|
|
3
13
|
|
package/dist/cjs/unityEditor.js
CHANGED
|
@@ -8,7 +8,7 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const unity_js_1 = require("./types/unity.js");
|
|
10
10
|
const commandExecutor_js_1 = require("./utils/commandExecutor.js");
|
|
11
|
-
const security_js_1 = require("utils/security.js");
|
|
11
|
+
const security_js_1 = require("./utils/security.js");
|
|
12
12
|
class UnityEditor {
|
|
13
13
|
static UNITY_PATHS = {
|
|
14
14
|
win32: {
|
package/dist/cjs/unityHub.js
CHANGED
|
@@ -130,10 +130,15 @@ class UnityHub {
|
|
|
130
130
|
else {
|
|
131
131
|
throw new Error("No module IDs provided.");
|
|
132
132
|
}
|
|
133
|
-
const {
|
|
133
|
+
const { stderr } = await this.execUnityHubCommand(args, {
|
|
134
134
|
reject: false,
|
|
135
|
+
onStderr: (data) => {
|
|
136
|
+
console.warn(`Unity Hub stderr: ${data}`);
|
|
137
|
+
},
|
|
138
|
+
onStdout: (data) => {
|
|
139
|
+
console.debug(`Unity Hub stdout: ${data}`);
|
|
140
|
+
},
|
|
135
141
|
});
|
|
136
|
-
console.debug(`Add module command output: ${stdout}`);
|
|
137
142
|
if (stderr) {
|
|
138
143
|
console.warn(`Add module command warning/error: ${stderr}`);
|
|
139
144
|
}
|
|
@@ -160,6 +165,12 @@ class UnityHub {
|
|
|
160
165
|
args.push("--architecture", architecture);
|
|
161
166
|
const { stdout, stderr } = await this.execUnityHubCommand(args, {
|
|
162
167
|
reject: false,
|
|
168
|
+
onStderr: (data) => {
|
|
169
|
+
console.warn(`Unity Hub stderr: ${data}`);
|
|
170
|
+
},
|
|
171
|
+
onStdout: (data) => {
|
|
172
|
+
console.debug(`Unity Hub stdout: ${data}`);
|
|
173
|
+
},
|
|
163
174
|
});
|
|
164
175
|
if (stderr) {
|
|
165
176
|
throw new Error(`Error installing Unity ${version}: ${stderr}`);
|
|
@@ -4,13 +4,41 @@ exports.executeCommand = executeCommand;
|
|
|
4
4
|
const execa_1 = require("execa");
|
|
5
5
|
async function executeCommand(executable, args, options = {}) {
|
|
6
6
|
try {
|
|
7
|
+
const streamOutput = options.onStdout || options.onStderr;
|
|
7
8
|
const subprocess = (0, execa_1.execa)(executable, args, {
|
|
8
9
|
reject: options.reject ?? false,
|
|
9
10
|
timeout: options.timeout,
|
|
10
11
|
env: options.env,
|
|
11
12
|
cwd: options.cwd,
|
|
12
13
|
encoding: "utf8",
|
|
14
|
+
buffer: !streamOutput,
|
|
13
15
|
});
|
|
16
|
+
if (streamOutput) {
|
|
17
|
+
if (subprocess.stdout) {
|
|
18
|
+
subprocess.stdout.on("data", (data) => {
|
|
19
|
+
const lines = data.toString().split(/\r?\n/);
|
|
20
|
+
for (const line of lines) {
|
|
21
|
+
if (line.trim()) {
|
|
22
|
+
if (options.onStdout) {
|
|
23
|
+
options.onStdout(line);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (subprocess.stderr) {
|
|
30
|
+
subprocess.stderr.on("data", (data) => {
|
|
31
|
+
const lines = data.toString().split(/\r?\n/);
|
|
32
|
+
for (const line of lines) {
|
|
33
|
+
if (line.trim()) {
|
|
34
|
+
if (options.onStderr) {
|
|
35
|
+
options.onStderr(line);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
14
42
|
const { stdout, stderr, exitCode } = await subprocess;
|
|
15
43
|
return {
|
|
16
44
|
success: true,
|
package/dist/esm/unityEditor.js
CHANGED
|
@@ -3,7 +3,7 @@ import fs from "fs-extra";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { TestMode } from "./types/unity.js";
|
|
5
5
|
import { executeCommand } from "./utils/commandExecutor.js";
|
|
6
|
-
import { redactSensitiveArgs } from "utils/security.js";
|
|
6
|
+
import { redactSensitiveArgs } from "./utils/security.js";
|
|
7
7
|
class UnityEditor {
|
|
8
8
|
static UNITY_PATHS = {
|
|
9
9
|
win32: {
|
package/dist/esm/unityHub.js
CHANGED
|
@@ -125,10 +125,15 @@ class UnityHub {
|
|
|
125
125
|
else {
|
|
126
126
|
throw new Error("No module IDs provided.");
|
|
127
127
|
}
|
|
128
|
-
const {
|
|
128
|
+
const { stderr } = await this.execUnityHubCommand(args, {
|
|
129
129
|
reject: false,
|
|
130
|
+
onStderr: (data) => {
|
|
131
|
+
console.warn(`Unity Hub stderr: ${data}`);
|
|
132
|
+
},
|
|
133
|
+
onStdout: (data) => {
|
|
134
|
+
console.debug(`Unity Hub stdout: ${data}`);
|
|
135
|
+
},
|
|
130
136
|
});
|
|
131
|
-
console.debug(`Add module command output: ${stdout}`);
|
|
132
137
|
if (stderr) {
|
|
133
138
|
console.warn(`Add module command warning/error: ${stderr}`);
|
|
134
139
|
}
|
|
@@ -155,6 +160,12 @@ class UnityHub {
|
|
|
155
160
|
args.push("--architecture", architecture);
|
|
156
161
|
const { stdout, stderr } = await this.execUnityHubCommand(args, {
|
|
157
162
|
reject: false,
|
|
163
|
+
onStderr: (data) => {
|
|
164
|
+
console.warn(`Unity Hub stderr: ${data}`);
|
|
165
|
+
},
|
|
166
|
+
onStdout: (data) => {
|
|
167
|
+
console.debug(`Unity Hub stdout: ${data}`);
|
|
168
|
+
},
|
|
158
169
|
});
|
|
159
170
|
if (stderr) {
|
|
160
171
|
throw new Error(`Error installing Unity ${version}: ${stderr}`);
|
|
@@ -1,13 +1,41 @@
|
|
|
1
1
|
import { execa } from "execa";
|
|
2
2
|
export async function executeCommand(executable, args, options = {}) {
|
|
3
3
|
try {
|
|
4
|
+
const streamOutput = options.onStdout || options.onStderr;
|
|
4
5
|
const subprocess = execa(executable, args, {
|
|
5
6
|
reject: options.reject ?? false,
|
|
6
7
|
timeout: options.timeout,
|
|
7
8
|
env: options.env,
|
|
8
9
|
cwd: options.cwd,
|
|
9
10
|
encoding: "utf8",
|
|
11
|
+
buffer: !streamOutput,
|
|
10
12
|
});
|
|
13
|
+
if (streamOutput) {
|
|
14
|
+
if (subprocess.stdout) {
|
|
15
|
+
subprocess.stdout.on("data", (data) => {
|
|
16
|
+
const lines = data.toString().split(/\r?\n/);
|
|
17
|
+
for (const line of lines) {
|
|
18
|
+
if (line.trim()) {
|
|
19
|
+
if (options.onStdout) {
|
|
20
|
+
options.onStdout(line);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (subprocess.stderr) {
|
|
27
|
+
subprocess.stderr.on("data", (data) => {
|
|
28
|
+
const lines = data.toString().split(/\r?\n/);
|
|
29
|
+
for (const line of lines) {
|
|
30
|
+
if (line.trim()) {
|
|
31
|
+
if (options.onStderr) {
|
|
32
|
+
options.onStderr(line);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
11
39
|
const { stdout, stderr, exitCode } = await subprocess;
|
|
12
40
|
return {
|
|
13
41
|
success: true,
|