uloop-cli 1.6.4 → 1.7.0
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 +32 -30
- package/dist/cli.bundle.cjs.map +2 -2
- package/package.json +3 -3
- package/src/__tests__/port-resolver.test.ts +45 -0
- package/src/__tests__/project-root.test.ts +35 -1
- package/src/default-tools.json +1 -1
- package/src/port-resolver.ts +39 -38
- package/src/project-root.ts +6 -1
- package/src/version.ts +1 -1
package/dist/cli.bundle.cjs
CHANGED
|
@@ -5605,8 +5605,12 @@ function isUnityProject(dirPath) {
|
|
|
5605
5605
|
const hasProjectSettings = (0, import_fs.existsSync)((0, import_path.join)(dirPath, "ProjectSettings"));
|
|
5606
5606
|
return hasAssets && hasProjectSettings;
|
|
5607
5607
|
}
|
|
5608
|
+
function getUnitySettingsCandidatePaths(dirPath) {
|
|
5609
|
+
const settingsPath = (0, import_path.join)(dirPath, "UserSettings/UnityMcpSettings.json");
|
|
5610
|
+
return [settingsPath, `${settingsPath}.tmp`, `${settingsPath}.bak`];
|
|
5611
|
+
}
|
|
5608
5612
|
function hasUloopInstalled(dirPath) {
|
|
5609
|
-
return (
|
|
5613
|
+
return getUnitySettingsCandidatePaths(dirPath).some((path) => (0, import_fs.existsSync)(path));
|
|
5610
5614
|
}
|
|
5611
5615
|
function isUnityProjectWithUloop(dirPath) {
|
|
5612
5616
|
return isUnityProject(dirPath) && hasUloopInstalled(dirPath);
|
|
@@ -5813,34 +5817,32 @@ Run 'uloop launch -r' to restart Unity.`
|
|
|
5813
5817
|
);
|
|
5814
5818
|
}
|
|
5815
5819
|
async function readPortFromSettingsOrThrow(projectRoot) {
|
|
5816
|
-
const settingsPath
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
if (port === null) {
|
|
5841
|
-
throw createSettingsReadError(projectRoot);
|
|
5820
|
+
for (const settingsPath of getUnitySettingsCandidatePaths(projectRoot)) {
|
|
5821
|
+
let content;
|
|
5822
|
+
try {
|
|
5823
|
+
content = await (0, import_promises.readFile)(settingsPath, "utf-8");
|
|
5824
|
+
} catch {
|
|
5825
|
+
continue;
|
|
5826
|
+
}
|
|
5827
|
+
let parsed;
|
|
5828
|
+
try {
|
|
5829
|
+
parsed = JSON.parse(content);
|
|
5830
|
+
} catch {
|
|
5831
|
+
continue;
|
|
5832
|
+
}
|
|
5833
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
5834
|
+
continue;
|
|
5835
|
+
}
|
|
5836
|
+
const settings = parsed;
|
|
5837
|
+
if (settings.isServerRunning === false) {
|
|
5838
|
+
throw new UnityNotRunningError(projectRoot);
|
|
5839
|
+
}
|
|
5840
|
+
const port = resolvePortFromUnitySettings(settings);
|
|
5841
|
+
if (port !== null) {
|
|
5842
|
+
return port;
|
|
5843
|
+
}
|
|
5842
5844
|
}
|
|
5843
|
-
|
|
5845
|
+
throw createSettingsReadError(projectRoot);
|
|
5844
5846
|
}
|
|
5845
5847
|
|
|
5846
5848
|
// src/project-validator.ts
|
|
@@ -5893,7 +5895,7 @@ var import_path4 = require("path");
|
|
|
5893
5895
|
|
|
5894
5896
|
// src/default-tools.json
|
|
5895
5897
|
var default_tools_default = {
|
|
5896
|
-
version: "1.
|
|
5898
|
+
version: "1.7.0",
|
|
5897
5899
|
tools: [
|
|
5898
5900
|
{
|
|
5899
5901
|
name: "compile",
|
|
@@ -6526,7 +6528,7 @@ function getCachedServerVersion() {
|
|
|
6526
6528
|
}
|
|
6527
6529
|
|
|
6528
6530
|
// src/version.ts
|
|
6529
|
-
var VERSION = "1.
|
|
6531
|
+
var VERSION = "1.7.0";
|
|
6530
6532
|
|
|
6531
6533
|
// src/spinner.ts
|
|
6532
6534
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|