mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
fix(update-notifier): resolve __dirname error on npx execution (#1406)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user