Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sindresorhus/read-package-up
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v9.1.0
Choose a base ref
...
head repository: sindresorhus/read-package-up
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v10.0.0
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Jul 4, 2023

  1. Require Node.js 16

    Fixes #23
    sindresorhus committed Jul 4, 2023
    Copy the full SHA
    d027a92 View commit details
  2. 10.0.0

    sindresorhus committed Jul 4, 2023
    Copy the full SHA
    62db0bc View commit details
Showing with 28 additions and 27 deletions.
  1. +4 −2 .github/workflows/main.yml
  2. +7 −10 index.d.ts
  3. +1 −1 index.test-d.ts
  4. +16 −8 package.json
  5. +0 −6 readme.md
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -10,10 +10,12 @@ jobs:
fail-fast: false
matrix:
node-version:
- 20
- 18
- 16
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
17 changes: 7 additions & 10 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Except} from 'type-fest';
import {readPackage, readPackageSync, Options as ReadPackageOptions, NormalizeOptions as ReadPackageNormalizeOptions, PackageJson, NormalizedPackageJson} from 'read-pkg';
import {type Except} from 'type-fest';
import {readPackage, readPackageSync, type Options as ReadPackageOptions, type NormalizeOptions as ReadPackageNormalizeOptions, type PackageJson, type NormalizedPackageJson} from 'read-pkg';

export type Options = {
/**
@@ -19,19 +19,14 @@ export type NormalizeOptions = {
cwd?: URL | string;
} & Except<ReadPackageNormalizeOptions, 'cwd'>;

export interface ReadResult {
export type ReadResult = {
packageJson: PackageJson;
path: string;
}
};

export interface NormalizedReadResult {
export type NormalizedReadResult = {
packageJson: NormalizedPackageJson;
path: string;
}

export {
PackageJson,
NormalizedPackageJson,
};

/**
@@ -75,3 +70,5 @@ console.log(readPackageUpSync());
*/
export function readPackageUpSync(options?: NormalizeOptions): NormalizedReadResult | undefined;
export function readPackageUpSync(options: Options): ReadResult | undefined;

export {PackageJson, NormalizedPackageJson} from 'read-pkg';
2 changes: 1 addition & 1 deletion index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {expectType, expectError} from 'tsd';
import {readPackageUp, readPackageUpSync, ReadResult, NormalizedReadResult} from './index.js';
import {readPackageUp, readPackageUpSync, type ReadResult, type NormalizedReadResult} from './index.js';

expectType<Promise<NormalizedReadResult | undefined>>(readPackageUp());
expectType<Promise<NormalizedReadResult | undefined>>(
24 changes: 16 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "read-pkg-up",
"version": "9.1.0",
"version": "10.0.0",
"description": "Read the closest package.json file",
"license": "MIT",
"repository": "sindresorhus/read-pkg-up",
@@ -11,9 +11,12 @@
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
"node": ">=16"
},
"scripts": {
"test": "xo && ava && tsd"
@@ -50,12 +53,17 @@
],
"dependencies": {
"find-up": "^6.3.0",
"read-pkg": "^7.1.0",
"type-fest": "^2.5.0"
"read-pkg": "^8.0.0",
"type-fest": "^3.12.0"
},
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.18.0",
"xo": "^0.45.0"
"ava": "^5.3.1",
"tsd": "^0.28.1",
"xo": "^0.54.2"
},
"xo": {
"rules": {
"@typescript-eslint/no-redundant-type-constituents": "off"
}
}
}
6 changes: 0 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
@@ -60,12 +60,6 @@ Default: `true`

[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.

## read-pkg-up for enterprise

Available as part of the Tidelift Subscription.

The maintainers of read-pkg-up and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-read-pkg-up?utm_source=npm-read-pkg-up&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)

## Related

- [read-pkg](https://github.com/sindresorhus/read-pkg) - Read a package.json file