bb-api-platforma
Version:
API module for BetBooster Platform
15 lines (14 loc) • 689 B
JavaScript
import { readFileSync, writeFileSync } from 'fs';
import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';
// Получаем текущую директорию в ESM
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Читаем package.json
const packageJsonPath = resolve(__dirname, '..', 'package.json');
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
const { name, version } = packageJson;
const versionJson = JSON.stringify({ name, version }, null, 2);
const outputPath = resolve(__dirname, 'version.json');
writeFileSync(outputPath, versionJson, 'utf8');
console.log(`Version: ${version}`);