MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / readVersion

Function readVersion

src/index.ts:155–163  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153// kept forgetting to bump, so `qodex --version` reported a stale number (1.22.0) for ~50 releases
154// even though the freshly-built dist was current — a confusing red herring. Resolve relative to this
155// module (dist/index.js → ../package.json), with a safe fallback if the file can't be read.
156function readVersion(): string {
157 try {
158 const here = path.dirname(fileURLToPath(import.meta.url));
159 const pkg = JSON.parse(fsSync.readFileSync(path.join(here, '..', 'package.json'), 'utf8'));
160 return typeof pkg.version === 'string' ? pkg.version : '0.0.0';
161 } catch {
162 return '0.0.0';
163 }
164}
165
166program

Callers 1

index.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected