Comparing version 6.0.0 to 7.0.0
@@ -32,13 +32,13 @@ import * as typeFest from 'type-fest'; | ||
``` | ||
import {readPackageAsync} from 'read-pkg'; | ||
import {readPackage} from 'read-pkg'; | ||
console.log(await readPackageAsync()); | ||
console.log(await readPackage()); | ||
//=> {name: 'read-pkg', …} | ||
console.log(await readPackageAsync({cwd: 'some-other-directory'}); | ||
console.log(await readPackage({cwd: 'some-other-directory'}); | ||
//=> {name: 'unicorn', …} | ||
``` | ||
*/ | ||
export function readPackageAsync(options?: NormalizeOptions): Promise<NormalizedPackageJson>; | ||
export function readPackageAsync(options: Options): Promise<PackageJson>; | ||
export function readPackage(options?: NormalizeOptions): Promise<NormalizedPackageJson>; | ||
export function readPackage(options: Options): Promise<PackageJson>; | ||
@@ -45,0 +45,0 @@ /** |
@@ -1,9 +0,10 @@ | ||
import fs, {promises as fsAsync} from 'fs'; | ||
import path from 'path'; | ||
import process from 'node:process'; | ||
import fs, {promises as fsPromises} from 'node:fs'; | ||
import path from 'node:path'; | ||
import parseJson from 'parse-json'; | ||
import normalizePackageData from 'normalize-package-data'; | ||
export async function readPackageAsync({cwd = process.cwd(), normalize = true} = {}) { | ||
export async function readPackage({cwd = process.cwd(), normalize = true} = {}) { | ||
const filePath = path.resolve(cwd, 'package.json'); | ||
const json = parseJson(await fsAsync.readFile(filePath, 'utf8')); | ||
const json = parseJson(await fsPromises.readFile(filePath, 'utf8')); | ||
@@ -10,0 +11,0 @@ if (normalize) { |
{ | ||
"name": "read-pkg", | ||
"version": "6.0.0", | ||
"version": "7.0.0", | ||
"description": "Read a package.json file", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=12" | ||
"node": ">=12.20" | ||
}, | ||
@@ -38,11 +38,11 @@ "scripts": { | ||
"dependencies": { | ||
"@types/normalize-package-data": "^2.4.0", | ||
"@types/normalize-package-data": "^2.4.1", | ||
"normalize-package-data": "^3.0.2", | ||
"parse-json": "^5.2.0", | ||
"type-fest": "^1.0.1" | ||
"type-fest": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^3.15.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.38.2" | ||
"tsd": "^0.17.0", | ||
"xo": "^0.44.0" | ||
}, | ||
@@ -49,0 +49,0 @@ "xo": { |
@@ -19,8 +19,8 @@ # read-pkg | ||
```js | ||
import {readPackageAsync} from 'read-pkg'; | ||
import {readPackage} from 'read-pkg'; | ||
console.log(await readPkg()); | ||
console.log(await readPackage()); | ||
//=> {name: 'read-pkg', …} | ||
console.log(await readPkg({cwd: 'some-other-directory'})); | ||
console.log(await readPackage({cwd: 'some-other-directory'})); | ||
//=> {name: 'unicorn', …} | ||
@@ -31,3 +31,3 @@ ``` | ||
### readPackageAsync(options?) | ||
### readPackage(options?) | ||
@@ -34,0 +34,0 @@ Returns a `Promise<object>` with the parsed JSON. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
5793
66
1
+ Addedtype-fest@2.19.0(transitive)
- Removedtype-fest@1.4.0(transitive)
Updatedtype-fest@^2.0.0