You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
380 B
12 lines
380 B
import path from 'node:path'; |
|
import {findUp, findUpSync} from 'find-up'; |
|
|
|
export async function packageDirectory({cwd} = {}) { |
|
const filePath = await findUp('package.json', {cwd}); |
|
return filePath && path.dirname(filePath); |
|
} |
|
|
|
export function packageDirectorySync({cwd} = {}) { |
|
const filePath = findUpSync('package.json', {cwd}); |
|
return filePath && path.dirname(filePath); |
|
}
|
|
|