feat: add support of the update-notifier configuration option (#4285)

The configuration option `update-notifier` allows users to disable the
update verification. This is interesting when pnpm is installed from
another package manager because the given instructions will not be
accurate. The `update-notifier` option exists in NPM so it can also
ease the migration to pnpm.
(https://docs.npmjs.com/cli/v8/using-npm/config#update-notifier).

close #4158.

Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
LeSuisse
2022-01-27 23:54:02 +01:00
committed by GitHub
parent 4e778cfbab
commit 334e5340a4
4 changed files with 9 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/config": minor
"pnpm": minor
---
Add support of the `update-notifier` configuration option [#4158](https://github.com/pnpm/pnpm/issues/4158).

View File

@@ -92,6 +92,7 @@ export interface Config {
userAgent?: string
tag?: string
updateNotifier?: boolean
alwaysAuth?: boolean

View File

@@ -121,6 +121,7 @@ export const types = Object.assign({
'test-pattern': [String, Array],
'changed-files-ignore-pattern': [String, Array],
'embed-readme': Boolean,
'update-notifier': Boolean,
}, npmTypes.types)
export type CliOptions = Record<string, unknown> & { dir?: string }

View File

@@ -226,6 +226,7 @@ export default async function run (inputArgv: string[]) {
await new Promise<void>((resolve) => setTimeout(() => resolve(), 0))
if (
config.updateNotifier !== false &&
!isCI &&
!selfUpdate &&
!config.offline &&