Open wenfangdu opened 1 year ago
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.
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.
I suggest opening an issue on the update-notifier repo to request this functionality.
Tracked here.
@raineorshine Would you mind vendoring update-notifier
? It’s a small package and they dropped support for yarn after being asked to support pnpm.
What do you mean by vendoring?
Inlining their source code and modify it to fit our needs in this repo.
Got it, thanks.
Even easier, we can replace this line:
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.
Would you accept a PR for this?
For an environment variable to disable update-notifier? Yes.
Let me know if you had something else in mind though.
No I mean supporting different package managers.
Yes! Sure.
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.