Skip to content

Commit

Permalink
feat: add support of the update-notifier configuration option (#4285)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
LeSuisse and zkochan committed Jan 27, 2022
1 parent 4e778cf commit 334e534
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/forty-pens-stare.md
Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions packages/config/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export interface Config {

userAgent?: string
tag?: string
updateNotifier?: boolean

alwaysAuth?: boolean

Expand Down
1 change: 1 addition & 0 deletions packages/config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
1 change: 1 addition & 0 deletions packages/pnpm/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit 334e534

Please sign in to comment.