@tiflis-io/tiflis-code-tunnel 0.3.3 → 0.3.5
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/main.js +19 -4
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -138,12 +138,27 @@ var WEBSOCKET_CONFIG = {
|
|
|
138
138
|
|
|
139
139
|
// src/utils/version.ts
|
|
140
140
|
import { readFileSync } from "fs";
|
|
141
|
-
import { join } from "path";
|
|
141
|
+
import { dirname, join } from "path";
|
|
142
|
+
import { fileURLToPath } from "url";
|
|
142
143
|
function getTunnelVersion() {
|
|
143
144
|
try {
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
|
|
145
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
146
|
+
const __dirname = dirname(__filename);
|
|
147
|
+
const possiblePaths = [
|
|
148
|
+
join(__dirname, "../package.json"),
|
|
149
|
+
join(__dirname, "../../package.json")
|
|
150
|
+
];
|
|
151
|
+
for (const packageJsonPath of possiblePaths) {
|
|
152
|
+
try {
|
|
153
|
+
const packageJsonContent = readFileSync(packageJsonPath, "utf8");
|
|
154
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
155
|
+
if (packageJson.name === "@tiflis-io/tiflis-code-tunnel" && typeof packageJson.version === "string" && packageJson.version.length > 0) {
|
|
156
|
+
return packageJson.version;
|
|
157
|
+
}
|
|
158
|
+
} catch {
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return "unknown";
|
|
147
162
|
} catch (error) {
|
|
148
163
|
console.error("Failed to read tunnel version from package.json:", error);
|
|
149
164
|
return "unknown";
|
package/package.json
CHANGED