@graphprotocol/graph-cli
Version:
CLI for building for and deploying to The Graph
10 lines (9 loc) • 442 B
JavaScript
import fs from 'node:fs';
import path from 'node:path';
const packageJson = JSON.parse(fs
.readFileSync(
// works even when bundled/built because the path to package.json is the same
path.join(`${process.platform === 'win32' ? '' : '/'}${/file:\/{2,3}(.+)\/[^/]/.exec(import.meta.url)[1]}`, '..', 'package.json'))
.toString());
export const version = packageJson.version;
export const nodeVersion = (packageJson.engines?.node ?? '');