High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix(npm): resolve package version from dist/src installs
Mario4a964742d782
diff --git a/npm/src/download.ts b/npm/src/download.tsindex 8de28c57..5102e99d 100644--- a/npm/src/download.ts+++ b/npm/src/download.ts@@ -3,15 +3,13 @@ import * as path from 'path';import * as http from 'http';import * as https from 'https';import * as crypto from 'crypto';-import { detectPlatform, getBinaryName, getBinaryPath } from './platform';+import { detectPlatform, getBinaryName, getBinaryPath, readPackageVersion } from './platform';const GITHUB_REPO = 'pinchtab/pinchtab';-// Read version from package.json at build time+// Resolve the published package version even when compiled code lives under dist/src.function getVersion(): string {- const pkgPath = path.join(__dirname, '..', 'package.json');- const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));- return pkg.version;+ return readPackageVersion(__dirname);}// NOTE: HTTPS_PROXY / HTTP_PROXY are NOT honored — downloads go direct. A priordiff --git a/npm/tests/mcp-wrapper.test.ts b/npm/tests/mcp-wrapper.test.tsindex dc9e3bad..213419a0 100644--- a/npm/tests/mcp-wrapper.test.ts+++ b/npm/tests/mcp-wrapper.test.ts@@ -139,3 +139,21 @@ describe('MCP wrapper integration', () => {assert.ok(response.result?.serverInfo, 'expected serverInfo in response');});});++describe('readPackageVersion', () => {+ test('finds the package root version from a dist/src-style compiled directory', () => {+ const packageRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'pinchtab-pkg-layout-'));+ try {+ const compiledDir = path.join(packageRoot, 'dist', 'src');+ fs.mkdirSync(compiledDir, { recursive: true });+ fs.writeFileSync(+ path.join(packageRoot, 'package.json'),+ JSON.stringify({ name: 'pinchtab', version: '0.14.0-test' })+ );++ assert.strictEqual(readPackageVersion(compiledDir), '0.14.0-test');+ } finally {+ fs.rmSync(packageRoot, { recursive: true, force: true });+ }+ });+});