browser-debugger-cli
Version:
DevTools telemetry in your terminal. For humans and agents. Direct WebSocket to Chrome's debugging port.
26 lines • 760 B
JavaScript
import { readFileSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
/**
* Get the package version.
* Reads package.json once and caches the result.
*/
let cachedVersion = '';
export function getVersion() {
if (cachedVersion) {
return cachedVersion;
}
try {
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const pkgPath = join(__dirname, '../../package.json');
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
cachedVersion = pkg.version ?? '0.0.0';
}
catch {
cachedVersion = '0.0.0';
}
return cachedVersion;
}
export const VERSION = getVersion();
//# sourceMappingURL=version.js.map