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.0
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: v6.0.1
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Oct 6, 2021

  1. Copy the full SHA
    6570506 View commit details
  2. 6.0.1

    sindresorhus committed Oct 6, 2021
    Copy the full SHA
    7fac1fa View commit details
Showing with 3 additions and 3 deletions.
  1. +2 −2 index.js
  2. +1 −1 package.json
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import path from 'node:path';
import {findUp, findUpSync} from 'find-up';

export async function packageDirectory({cwd}) {
export async function packageDirectory({cwd} = {}) {
const filePath = await findUp('package.json', {cwd});
return filePath && path.dirname(filePath);
}

export function packageDirectorySync({cwd}) {
export function packageDirectorySync({cwd} = {}) {
const filePath = findUpSync('package.json', {cwd});
return filePath && path.dirname(filePath);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pkg-dir",
"version": "6.0.0",
"version": "6.0.1",
"description": "Find the root directory of a Node.js project or npm package",
"license": "MIT",
"repository": "sindresorhus/pkg-dir",