@tiflis-io/tiflis-code-tunnel 0.3.4 → 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.
Files changed (2) hide show
  1. package/dist/main.js +19 -4
  2. 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 packageJsonPath = join(process.cwd(), "package.json");
145
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
146
- return packageJson.version;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiflis-io/tiflis-code-tunnel",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Tunnel server for tiflis-code - reverse proxy for workstation connections",
5
5
  "author": "Roman Barinov <rbarinov@gmail.com>",
6
6
  "license": "FSL-1.1-NC",