uloop-cli 1.7.0 → 1.7.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/dist/cli.bundle.cjs +65 -25
- package/dist/cli.bundle.cjs.map +3 -3
- package/package.json +3 -3
- package/src/__tests__/busy-state-order.test.ts +120 -0
- package/src/__tests__/cli-project-error.test.ts +33 -0
- package/src/__tests__/cli-update.test.ts +129 -0
- package/src/cli-project-error.ts +26 -0
- package/src/cli.ts +13 -21
- package/src/default-tools.json +1 -1
- package/src/execute-tool.ts +14 -3
- package/src/project-root.ts +1 -1
- package/src/version.ts +1 -1
package/dist/cli.bundle.cjs
CHANGED
|
@@ -9,6 +9,10 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
9
9
|
var __commonJS = (cb, mod) => function __require() {
|
|
10
10
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
11
|
};
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
12
16
|
var __copyProps = (to, from, except, desc) => {
|
|
13
17
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
18
|
for (let key of __getOwnPropNames(from))
|
|
@@ -25,6 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
29
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
30
|
mod
|
|
27
31
|
));
|
|
32
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
33
|
|
|
29
34
|
// node_modules/commander/lib/error.js
|
|
30
35
|
var require_error = __commonJS({
|
|
@@ -5382,6 +5387,14 @@ var require_semver2 = __commonJS({
|
|
|
5382
5387
|
}
|
|
5383
5388
|
});
|
|
5384
5389
|
|
|
5390
|
+
// src/cli.ts
|
|
5391
|
+
var cli_exports = {};
|
|
5392
|
+
__export(cli_exports, {
|
|
5393
|
+
getInstalledVersion: () => getInstalledVersion,
|
|
5394
|
+
updateCli: () => updateCli
|
|
5395
|
+
});
|
|
5396
|
+
module.exports = __toCommonJS(cli_exports);
|
|
5397
|
+
|
|
5385
5398
|
// src/cli-constants.ts
|
|
5386
5399
|
var PRODUCT_DISPLAY_NAME = "Unity CLI Loop";
|
|
5387
5400
|
var MENU_PATH_SERVER = "Window > Unity CLI Loop > Server";
|
|
@@ -5895,7 +5908,7 @@ var import_path4 = require("path");
|
|
|
5895
5908
|
|
|
5896
5909
|
// src/default-tools.json
|
|
5897
5910
|
var default_tools_default = {
|
|
5898
|
-
version: "1.7.
|
|
5911
|
+
version: "1.7.2",
|
|
5899
5912
|
tools: [
|
|
5900
5913
|
{
|
|
5901
5914
|
name: "compile",
|
|
@@ -6528,7 +6541,7 @@ function getCachedServerVersion() {
|
|
|
6528
6541
|
}
|
|
6529
6542
|
|
|
6530
6543
|
// src/version.ts
|
|
6531
|
-
var VERSION = "1.7.
|
|
6544
|
+
var VERSION = "1.7.2";
|
|
6532
6545
|
|
|
6533
6546
|
// src/spinner.ts
|
|
6534
6547
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
@@ -6864,6 +6877,12 @@ function checkUnityBusyState(projectPath) {
|
|
|
6864
6877
|
throw new Error("UNITY_SERVER_STARTING");
|
|
6865
6878
|
}
|
|
6866
6879
|
}
|
|
6880
|
+
function checkUnityBusyStateBeforeProjectResolution(globalOptions) {
|
|
6881
|
+
if (globalOptions.port !== void 0) {
|
|
6882
|
+
return;
|
|
6883
|
+
}
|
|
6884
|
+
checkUnityBusyState(globalOptions.projectPath);
|
|
6885
|
+
}
|
|
6867
6886
|
async function executeToolCommand(toolName, params, globalOptions) {
|
|
6868
6887
|
let portNumber;
|
|
6869
6888
|
if (globalOptions.port) {
|
|
@@ -6873,6 +6892,7 @@ async function executeToolCommand(toolName, params, globalOptions) {
|
|
|
6873
6892
|
}
|
|
6874
6893
|
portNumber = parsed;
|
|
6875
6894
|
}
|
|
6895
|
+
checkUnityBusyStateBeforeProjectResolution(globalOptions);
|
|
6876
6896
|
const port = await resolveUnityPort(portNumber, globalOptions.projectPath);
|
|
6877
6897
|
const compileOptions = getCompileExecutionOptions(toolName, params);
|
|
6878
6898
|
const shouldWaitForDomainReload = compileOptions.waitForDomainReload;
|
|
@@ -6885,7 +6905,7 @@ async function executeToolCommand(toolName, params, globalOptions) {
|
|
|
6885
6905
|
const shouldValidateProject = portNumber === void 0 && projectRoot !== null;
|
|
6886
6906
|
let requestDispatched = false;
|
|
6887
6907
|
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
6888
|
-
|
|
6908
|
+
checkUnityBusyStateBeforeProjectResolution(globalOptions);
|
|
6889
6909
|
const client = new DirectUnityClient(port);
|
|
6890
6910
|
try {
|
|
6891
6911
|
await client.connect();
|
|
@@ -7002,6 +7022,7 @@ async function listAvailableTools(globalOptions) {
|
|
|
7002
7022
|
}
|
|
7003
7023
|
portNumber = parsed;
|
|
7004
7024
|
}
|
|
7025
|
+
checkUnityBusyStateBeforeProjectResolution(globalOptions);
|
|
7005
7026
|
const port = await resolveUnityPort(portNumber, globalOptions.projectPath);
|
|
7006
7027
|
const projectRoot = globalOptions.projectPath !== void 0 ? validateProjectPath(globalOptions.projectPath) : findUnityProjectRoot();
|
|
7007
7028
|
const shouldValidateProject = portNumber === void 0 && projectRoot !== null;
|
|
@@ -7009,7 +7030,7 @@ async function listAvailableTools(globalOptions) {
|
|
|
7009
7030
|
const spinner = createSpinner("Connecting to Unity...");
|
|
7010
7031
|
let lastError;
|
|
7011
7032
|
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
7012
|
-
|
|
7033
|
+
checkUnityBusyStateBeforeProjectResolution(globalOptions);
|
|
7013
7034
|
const client = new DirectUnityClient(port);
|
|
7014
7035
|
try {
|
|
7015
7036
|
await client.connect();
|
|
@@ -7064,6 +7085,7 @@ async function syncTools(globalOptions) {
|
|
|
7064
7085
|
}
|
|
7065
7086
|
portNumber = parsed;
|
|
7066
7087
|
}
|
|
7088
|
+
checkUnityBusyStateBeforeProjectResolution(globalOptions);
|
|
7067
7089
|
const port = await resolveUnityPort(portNumber, globalOptions.projectPath);
|
|
7068
7090
|
const projectRoot = globalOptions.projectPath !== void 0 ? validateProjectPath(globalOptions.projectPath) : findUnityProjectRoot();
|
|
7069
7091
|
const shouldValidateProject = portNumber === void 0 && projectRoot !== null;
|
|
@@ -7071,7 +7093,7 @@ async function syncTools(globalOptions) {
|
|
|
7071
7093
|
const spinner = createSpinner("Connecting to Unity...");
|
|
7072
7094
|
let lastError;
|
|
7073
7095
|
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
7074
|
-
|
|
7096
|
+
checkUnityBusyStateBeforeProjectResolution(globalOptions);
|
|
7075
7097
|
const client = new DirectUnityClient(port);
|
|
7076
7098
|
try {
|
|
7077
7099
|
await client.connect();
|
|
@@ -9012,6 +9034,28 @@ function registerFocusWindowCommand(program3, helpGroup) {
|
|
|
9012
9034
|
});
|
|
9013
9035
|
}
|
|
9014
9036
|
|
|
9037
|
+
// src/cli-project-error.ts
|
|
9038
|
+
function getProjectResolutionErrorLines(error) {
|
|
9039
|
+
if (error instanceof UnityNotRunningError) {
|
|
9040
|
+
return [
|
|
9041
|
+
"Error: Unity Editor for this project is not running.",
|
|
9042
|
+
"",
|
|
9043
|
+
` Project: ${error.projectRoot}`,
|
|
9044
|
+
"",
|
|
9045
|
+
"Start the Unity Editor for this project and try again."
|
|
9046
|
+
];
|
|
9047
|
+
}
|
|
9048
|
+
return [
|
|
9049
|
+
"Error: Connected Unity instance belongs to a different project.",
|
|
9050
|
+
"",
|
|
9051
|
+
` Project: ${error.expectedProjectRoot}`,
|
|
9052
|
+
` Connected to: ${error.connectedProjectRoot}`,
|
|
9053
|
+
"",
|
|
9054
|
+
"Another Unity instance was found, but it belongs to a different project.",
|
|
9055
|
+
"Start the Unity Editor for this project, or use --project-path to specify the target."
|
|
9056
|
+
];
|
|
9057
|
+
}
|
|
9058
|
+
|
|
9015
9059
|
// src/cli.ts
|
|
9016
9060
|
var FOCUS_WINDOW_COMMAND = "focus-window";
|
|
9017
9061
|
var LAUNCH_COMMAND = "launch";
|
|
@@ -9273,23 +9317,15 @@ async function runWithErrorHandling(fn) {
|
|
|
9273
9317
|
await fn();
|
|
9274
9318
|
} catch (error) {
|
|
9275
9319
|
if (error instanceof UnityNotRunningError) {
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
console.error("");
|
|
9280
|
-
console.error("Start the Unity Editor for this project and try again.");
|
|
9320
|
+
for (const line of getProjectResolutionErrorLines(error)) {
|
|
9321
|
+
console.error(line.startsWith("Error: ") ? `\x1B[31m${line}\x1B[0m` : line);
|
|
9322
|
+
}
|
|
9281
9323
|
process.exit(1);
|
|
9282
9324
|
}
|
|
9283
9325
|
if (error instanceof ProjectMismatchError) {
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
console.error(` Connected to: ${error.connectedProjectRoot}`);
|
|
9288
|
-
console.error("");
|
|
9289
|
-
console.error("Another Unity instance was found, but it belongs to a different project.");
|
|
9290
|
-
console.error(
|
|
9291
|
-
"Start the Unity Editor for this project, or use --project-path to specify the target."
|
|
9292
|
-
);
|
|
9326
|
+
for (const line of getProjectResolutionErrorLines(error)) {
|
|
9327
|
+
console.error(line.startsWith("Error: ") ? `\x1B[31m${line}\x1B[0m` : line);
|
|
9328
|
+
}
|
|
9293
9329
|
process.exit(1);
|
|
9294
9330
|
}
|
|
9295
9331
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -9412,9 +9448,7 @@ compdef _uloop uloop`;
|
|
|
9412
9448
|
}
|
|
9413
9449
|
function getInstalledVersion(callback) {
|
|
9414
9450
|
const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
9415
|
-
const child = (0, import_child_process.spawn)(npmCommand, ["list", "-g", "uloop-cli", "--json"]
|
|
9416
|
-
shell: true
|
|
9417
|
-
});
|
|
9451
|
+
const child = (0, import_child_process.spawn)(npmCommand, ["list", "-g", "uloop-cli", "--json"]);
|
|
9418
9452
|
let stdout = "";
|
|
9419
9453
|
child.stdout.on("data", (data) => {
|
|
9420
9454
|
stdout += data.toString();
|
|
@@ -9461,8 +9495,7 @@ function updateCli() {
|
|
|
9461
9495
|
console.log("Updating uloop-cli to the latest version...");
|
|
9462
9496
|
const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
9463
9497
|
const child = (0, import_child_process.spawn)(npmCommand, ["install", "-g", "uloop-cli@latest"], {
|
|
9464
|
-
stdio: "inherit"
|
|
9465
|
-
shell: true
|
|
9498
|
+
stdio: "inherit"
|
|
9466
9499
|
});
|
|
9467
9500
|
child.on("close", (code) => {
|
|
9468
9501
|
if (code === 0) {
|
|
@@ -9755,5 +9788,12 @@ async function main() {
|
|
|
9755
9788
|
}
|
|
9756
9789
|
program2.parse();
|
|
9757
9790
|
}
|
|
9758
|
-
void
|
|
9791
|
+
if (process.env.JEST_WORKER_ID === void 0) {
|
|
9792
|
+
void main();
|
|
9793
|
+
}
|
|
9794
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
9795
|
+
0 && (module.exports = {
|
|
9796
|
+
getInstalledVersion,
|
|
9797
|
+
updateCli
|
|
9798
|
+
});
|
|
9759
9799
|
//# sourceMappingURL=cli.bundle.cjs.map
|