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/pkg-dir
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.0.1
Choose a base ref
...
head repository: sindresorhus/pkg-dir
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v7.0.0
Choose a head ref
  • 3 commits
  • 5 files changed
  • 1 contributor

Commits on Aug 16, 2022

  1. Require Node.js 14

    sindresorhus committed Aug 16, 2022
    Copy the full SHA
    b05b835 View commit details
  2. Fix TypeScript return type

    Fixes #17
    sindresorhus committed Aug 16, 2022
    Copy the full SHA
    dea1a16 View commit details
  3. 7.0.0

    sindresorhus committed Aug 16, 2022
    Copy the full SHA
    7dfd36b View commit details
Showing with 17 additions and 17 deletions.
  1. +3 −3 .github/workflows/main.yml
  2. +2 −2 index.d.ts
  3. +2 −2 index.test-d.ts
  4. +8 −8 package.json
  5. +2 −2 test.js
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -10,12 +10,12 @@ jobs:
fail-fast: false
matrix:
node-version:
- 18
- 16
- 14
- 12
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
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ console.log(await packageDirectory());
//=> '/Users/sindresorhus/foo'
```
*/
export function packageDirectory(options?: Options): Promise<string>;
export function packageDirectory(options?: Options): Promise<string | undefined>;

/**
Synchronously find the root directory of a Node.js project or npm package.
@@ -55,4 +55,4 @@ console.log(packageDirectorySync());
//=> '/Users/sindresorhus/foo'
```
*/
export function packageDirectorySync(options?: Options): string;
export function packageDirectorySync(options?: Options): string | undefined;
4 changes: 2 additions & 2 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {expectType} from 'tsd';
import {packageDirectory, packageDirectorySync} from './index.js';

expectType<Promise<string>>(packageDirectory({cwd: '/Users/project/pkg-dir'}));
expectType<string>(packageDirectorySync({cwd: '/Users/project/pkg-dir'}));
expectType<Promise<string | undefined>>(packageDirectory({cwd: '/Users/project/pkg-dir'}));
expectType<string | undefined>(packageDirectorySync({cwd: '/Users/project/pkg-dir'}));
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pkg-dir",
"version": "6.0.1",
"version": "7.0.0",
"description": "Find the root directory of a Node.js project or npm package",
"license": "MIT",
"repository": "sindresorhus/pkg-dir",
@@ -13,7 +13,7 @@
"type": "module",
"exports": "./index.js",
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
"node": ">=14.16"
},
"scripts": {
"test": "xo && ava && tsd"
@@ -47,13 +47,13 @@
"path"
],
"dependencies": {
"find-up": "^6.1.0"
"find-up": "^6.3.0"
},
"devDependencies": {
"ava": "^3.15.0",
"tempy": "^2.0.0",
"tsd": "^0.17.0",
"typescript": "^4.4.3",
"xo": "^0.44.0"
"ava": "^4.3.1",
"tempy": "^3.0.0",
"tsd": "^0.22.0",
"typescript": "^4.7.4",
"xo": "^0.51.0"
}
}
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
@@ -2,14 +2,14 @@ import fs from 'node:fs';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import test from 'ava';
import tempy from 'tempy';
import {temporaryDirectory} from 'tempy';
import {packageDirectory, packageDirectorySync} from './index.js';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

// Create a disjoint directory, used for the not-found tests
test.beforeEach(t => {
t.context.disjoint = tempy.directory();
t.context.disjoint = temporaryDirectory();
});

test.afterEach(t => {