File

libs/nx/src/executors/shared/metadata-utils/extract-package-json-data.ts

Index

Properties

Properties

name
Type string
version
Type string
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;
}

results matching ""

    No results matching ""