shadcn-vue/packages/cli/src/utils/get-package-info.ts
Sadegh Barati 8a8d1ef20a refactor: use get-tsconfig instead of tsconfig-paths
refactor: replace `node:path` with `pathe`
chore: add `tinyexec` instead of `execa`
2024-12-05 00:00:10 +03:30

15 lines
353 B
TypeScript

import type { PackageJson } from 'type-fest'
import fs from 'fs-extra'
import path from 'pathe'
export function getPackageInfo(
cwd: string = '',
shouldThrow: boolean = true,
): PackageJson | null {
const packageJsonPath = path.join(cwd, 'package.json')
return fs.readJSONSync(packageJsonPath, {
throws: shouldThrow,
}) as PackageJson
}