Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Is there a way to disable the upgrade notice? #1324

Open
wenfangdu opened this issue Sep 5, 2023 · 7 comments
Open

[Question] Is there a way to disable the upgrade notice? #1324

wenfangdu opened this issue Sep 5, 2023 · 7 comments
Labels

Comments

@wenfangdu
Copy link

How do you disable the following message? Also, I'm using pnpm, it always suggests doing npm i -g npm-check-updates, which is wrong.

image

@raineorshine
Copy link
Owner

There is not a way to disable the update-notifier currently, though I could add an environment variable for that.

As for your second question about the package manager, I'll have to look into that to see if it's possible. That message is coming from a library that handles the update logic and notification.

@raineorshine
Copy link
Owner

raineorshine commented Sep 7, 2023

I reviewed update-notifier and discovered that it does not run when executed within an npm script. Try creating a simple npm script "ncu": "ncu". Then you should be able to do npm run ncu and check for updates without getting the update-notifier message. Let me know if that works for you.

When it comes to the npm install command it suggests, that appears to be a limitation of update-notifier itself. It only detects npm or yarn. It is currently using a simple is-yarn-global package to detect yarn, and maybe something similar can be done for pnpm. I suggest opening an issue on the update-notifier repo to request this functionality, or even better a PR.

@wenfangdu
Copy link
Author

I suggest opening an issue on the update-notifier repo to request this functionality.

Tracked here.

@alex-kinokon
Copy link
Contributor

@raineorshine Would you mind vendoring update-notifier? It’s a small package and they dropped support for yarn after being asked to support pnpm.

@raineorshine
Copy link
Owner

What do you mean by vendoring?

@alex-kinokon
Copy link
Contributor

Inlining their source code and modify it to fit our needs in this repo.

@raineorshine
Copy link
Owner

raineorshine commented Nov 23, 2023

Got it, thanks.

Even easier, we can replace this line:

Run ${chalk.cyan('{updateCommand}')} to update

with our own template literal:

Run ${chalk.cyan(`${options.packageManager} ${options.packageManager ==='yarn' ? 'add' : 'install'}${options.global ? ' -g' : ''} npm-check-updates`)} to update

That's basically what update-notifier is doing, but with the package manager specific phrasing added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants