fix(update-notifier): resolve __dirname error on npx execution (#1406)

This commit is contained in:
matt korwel 2025-06-24 17:26:50 -07:00 committed by GitHub
parent 2505af8522
commit fbd8725c07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 6 deletions

View File

@ -5,17 +5,14 @@
*/
import updateNotifier from 'update-notifier';
import { readPackageUp } from 'read-package-up';
import { getPackageJson } from '../../utils/package.js';
export async function checkForUpdates(): Promise<string | null> {
try {
// read-package-up looks for the closest package.json from cwd
const pkgResult = await readPackageUp({ cwd: __dirname });
if (!pkgResult) {
const packageJson = await getPackageJson();
if (!packageJson || !packageJson.name || !packageJson.version) {
return null;
}
const { packageJson } = pkgResult;
const notifier = updateNotifier({
pkg: {
name: packageJson.name,