Skip to content

Commit

Permalink
Require Node.js 16
Browse files Browse the repository at this point in the history
Fixes #23
  • Loading branch information
sindresorhus committed Jul 4, 2023
1 parent 1eed68d commit d027a92
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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 = {
/**
Expand All @@ -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,
};

/**
Expand Down Expand Up @@ -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>>(
Expand Down
22 changes: 15 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand 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"
Expand Down Expand Up @@ -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
Expand Up @@ -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
Expand Down

0 comments on commit d027a92

Please sign in to comment.