From d027a92c0c75ae7821e8668b8419c8f4c0a29f47 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Tue, 4 Jul 2023 13:16:26 +0200 Subject: [PATCH] Require Node.js 16 Fixes #23 --- .github/workflows/main.yml | 6 ++++-- index.d.ts | 17 +++++++---------- index.test-d.ts | 2 +- package.json | 22 +++++++++++++++------- readme.md | 6 ------ 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 441975c..1ed55d5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/index.d.ts b/index.d.ts index 7829b7a..5cb06c6 100644 --- a/index.d.ts +++ b/index.d.ts @@ -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; -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'; diff --git a/index.test-d.ts b/index.test-d.ts index ef950ef..d604a67 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -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>(readPackageUp()); expectType>( diff --git a/package.json b/package.json index bd7d1d2..5003f2b 100644 --- a/package.json +++ b/package.json @@ -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" + } } } diff --git a/readme.md b/readme.md index ca0e55a..c961590 100644 --- a/readme.md +++ b/readme.md @@ -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