/**
 * scripts/generate-docs/lib/version.ts
 * Reads the canonical version from package.json so the doc generator can
 * inject it into every page (kills the v3.34.0 drift permanently).
 */
import { readFileSync } from 'node:fs';
import { join } from 'node:path';

const PKG_PATH = join(__dirname, '..', '..', '..', 'package.json');

export const VERSION: string = (() => {
  const pkg = JSON.parse(readFileSync(PKG_PATH, 'utf-8')) as { version?: string };
  if (!pkg.version) {
    throw new Error(`Cannot read version from ${PKG_PATH}`);
  }
  return pkg.version;
})();
