import { readFileSync } from 'fs';
import { parse as parseJson } from 'jsonc-parser';
import { join } from 'path';
export interface packageJsonData {
name: string;
version: string;
}
export function extractPackageJsonData(projectFolder: string): packageJsonData {
const { name, version } = readPackageJsonFile(projectFolder);
return { name, version };
}
export function readPackageJsonFile(projectFolder: string) {
const packageJsonPath = join(projectFolder, 'package.json');
const packageJson = parseJson(readFileSync(packageJsonPath).toString());
return packageJson;
}