-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename package from
pkg-up
to package-up
- Loading branch information
1 parent
b902cd5
commit 4a4d1db
Showing
6 changed files
with
27 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import process from 'node:process'; | ||
import {findUp, findUpSync} from 'find-up-simple'; | ||
|
||
export async function pkgUp({cwd = process.cwd()} = {}) { | ||
export async function packageUp({cwd = process.cwd()} = {}) { | ||
return findUp('package.json', {cwd}); | ||
} | ||
|
||
export function pkgUpSync({cwd = process.cwd()} = {}) { | ||
export function packageUpSync({cwd = process.cwd()} = {}) { | ||
return findUpSync('package.json', {cwd}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import {expectType} from 'tsd'; | ||
import {pkgUp, pkgUpSync} from './index.js'; | ||
import {packageUp, packageUpSync} from './index.js'; | ||
|
||
expectType<Promise<string | undefined>>(pkgUp()); | ||
expectType<Promise<string | undefined>>(pkgUp({cwd: '.'})); | ||
expectType<string | undefined>(pkgUpSync()); | ||
expectType<string | undefined>(pkgUpSync({cwd: '.'})); | ||
expectType<Promise<string | undefined>>(packageUp()); | ||
expectType<Promise<string | undefined>>(packageUp({cwd: '.'})); | ||
expectType<string | undefined>(packageUpSync()); | ||
expectType<string | undefined>(packageUpSync({cwd: '.'})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import path from 'node:path'; | ||
import {fileURLToPath} from 'node:url'; | ||
import test from 'ava'; | ||
import {pkgUp, pkgUpSync} from './index.js'; | ||
import {packageUp, packageUpSync} from './index.js'; | ||
|
||
const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
|
||
const cwd = path.join(__dirname, 'fixture'); | ||
const pkgPath = path.join(__dirname, 'package.json'); | ||
const packagePath = path.join(__dirname, 'package.json'); | ||
|
||
test('async', async t => { | ||
t.is(await pkgUp({cwd}), pkgPath); | ||
t.is(path.dirname(await pkgUp()), __dirname); | ||
t.is(await packageUp({cwd}), packagePath); | ||
t.is(path.dirname(await packageUp()), __dirname); | ||
}); | ||
|
||
test('sync', t => { | ||
t.is(pkgUpSync({cwd}), pkgPath); | ||
t.is(path.dirname(pkgUpSync()), __dirname); | ||
t.is(packageUpSync({cwd}), packagePath); | ||
t.is(path.dirname(packageUpSync()), __dirname); | ||
}); |