read-pkg-up
Advanced tools
Comparing version 8.0.0 to 9.0.0
import {Except} from 'type-fest'; | ||
import {readPackageAsync, readPackageSync, Options as ReadPackageOptions, NormalizeOptions as ReadPackageNormalizeOptions, PackageJson, NormalizedPackageJson} from 'read-pkg'; | ||
import {readPackage, readPackageSync, Options as ReadPackageOptions, NormalizeOptions as ReadPackageNormalizeOptions, PackageJson, NormalizedPackageJson} from 'read-pkg'; | ||
export type Options = { | ||
/** | ||
Directory to start looking for a package.json file. | ||
The directory to start looking for a package.json file. | ||
@@ -15,3 +15,3 @@ @default process.cwd() | ||
/** | ||
Directory to start looking for a package.json file. | ||
The directory to start looking for a package.json file. | ||
@@ -35,3 +35,3 @@ @default process.cwd() | ||
PackageJson, | ||
NormalizedPackageJson | ||
NormalizedPackageJson, | ||
}; | ||
@@ -44,5 +44,5 @@ | ||
``` | ||
import {readPackageUpAsync} from 'read-pkg-up'; | ||
import {readPackageUp} from 'read-pkg-up'; | ||
console.log(await readPackageUpAsync()); | ||
console.log(await readPackageUp()); | ||
// { | ||
@@ -58,4 +58,4 @@ // packageJson: { | ||
*/ | ||
export function readPackageUpAsync(options?: NormalizeOptions): Promise<NormalizedReadResult | undefined>; | ||
export function readPackageUpAsync(options: Options): Promise<ReadResult | undefined>; | ||
export function readPackageUp(options?: NormalizeOptions): Promise<NormalizedReadResult | undefined>; | ||
export function readPackageUp(options: Options): Promise<ReadResult | undefined>; | ||
@@ -62,0 +62,0 @@ /** |
16
index.js
@@ -1,6 +0,6 @@ | ||
import path from 'path'; | ||
import findUp from 'find-up'; | ||
import {readPackageAsync, readPackageSync} from 'read-pkg'; | ||
import path from 'node:path'; | ||
import {findUp, findUpSync} from 'find-up'; | ||
import {readPackage, readPackageSync} from 'read-pkg'; | ||
export async function readPackageUpAsync(options) { | ||
export async function readPackageUp(options) { | ||
const filePath = await findUp('package.json', options); | ||
@@ -12,4 +12,4 @@ if (!filePath) { | ||
return { | ||
packageJson: await readPackageAsync({...options, cwd: path.dirname(filePath)}), | ||
path: filePath | ||
packageJson: await readPackage({...options, cwd: path.dirname(filePath)}), | ||
path: filePath, | ||
}; | ||
@@ -19,3 +19,3 @@ } | ||
export function readPackageUpSync(options) { | ||
const filePath = findUp.sync('package.json', options); | ||
const filePath = findUpSync('package.json', options); | ||
if (!filePath) { | ||
@@ -27,4 +27,4 @@ return; | ||
packageJson: readPackageSync({...options, cwd: path.dirname(filePath)}), | ||
path: filePath | ||
path: filePath, | ||
}; | ||
} |
{ | ||
"name": "read-pkg-up", | ||
"version": "8.0.0", | ||
"version": "9.0.0", | ||
"description": "Read the closest package.json file", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=12" | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
@@ -53,11 +53,11 @@ "scripts": { | ||
"dependencies": { | ||
"find-up": "^5.0.0", | ||
"read-pkg": "^6.0.0", | ||
"type-fest": "^1.0.1" | ||
"find-up": "^6.2.0", | ||
"read-pkg": "^7.0.0", | ||
"type-fest": "^2.5.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^3.15.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.38.2" | ||
"tsd": "^0.18.0", | ||
"xo": "^0.45.0" | ||
} | ||
} |
@@ -13,5 +13,5 @@ # read-pkg-up | ||
```sh | ||
npm install read-pkg-up | ||
``` | ||
$ npm install read-pkg-up | ||
``` | ||
@@ -21,5 +21,5 @@ ## Usage | ||
```js | ||
import {readPackageUpAsync} from 'read-pkg-up'; | ||
import {readPackageUp} from 'read-pkg-up'; | ||
console.log(await readPackageUpAsync()); | ||
console.log(await readPackageUp()); | ||
/* | ||
@@ -39,3 +39,3 @@ { | ||
### readPackageUpAsync(options?) | ||
### readPackageUp(options?) | ||
@@ -57,3 +57,3 @@ Returns a `Promise<object>` or `Promise<undefined>` if no `package.json` was found. | ||
Directory to start looking for a package.json file. | ||
The directory to start looking for a package.json file. | ||
@@ -60,0 +60,0 @@ ##### normalize |
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
6611
+ Addedfind-up@6.3.0(transitive)
+ Addedlocate-path@7.2.0(transitive)
+ Addedp-limit@4.0.0(transitive)
+ Addedp-locate@6.0.0(transitive)
+ Addedpath-exists@5.0.0(transitive)
+ Addedread-pkg@7.1.0(transitive)
+ Addedtype-fest@2.19.0(transitive)
+ Addedyocto-queue@1.1.1(transitive)
- Removedfind-up@5.0.0(transitive)
- Removedlocate-path@6.0.0(transitive)
- Removedp-limit@3.1.0(transitive)
- Removedp-locate@5.0.0(transitive)
- Removedpath-exists@4.0.0(transitive)
- Removedread-pkg@6.0.0(transitive)
- Removedtype-fest@1.4.0(transitive)
- Removedyocto-queue@0.1.0(transitive)
Updatedfind-up@^6.2.0
Updatedread-pkg@^7.0.0
Updatedtype-fest@^2.5.0