Skip to content

feat(cli): notify when a newer version is available on npm#426

Merged
pavelfeldman merged 1 commit into
microsoft:mainfrom
pavelfeldman:feat-update-notifier
Jun 23, 2026
Merged

feat(cli): notify when a newer version is available on npm#426
pavelfeldman merged 1 commit into
microsoft:mainfrom
pavelfeldman:feat-update-notifier

Conversation

@pavelfeldman

Copy link
Copy Markdown
Member

Summary

  • On startup, the CLI checks the npm registry for a newer release and prints an update notice when one is available.
  • The check runs at most once a day; the timestamp is cached in the Playwright registry directory, so the notice never appears more than once per day.
  • Best-effort and non-intrusive: 1.5s timeout, all errors swallowed (never blocks or breaks the CLI), and skipped when CI or NO_UPDATE_NOTIFIER is set.
  • Version comparison uses tools.compareSemver from playwright-core so Playwright's alpha/beta/nightly suffixes are handled correctly.

On startup the CLI checks the npm registry for a newer release at most
once a day (result cached in the Playwright registry directory) and, when
one is found, prints an update notice. Skipped when CI or
NO_UPDATE_NOTIFIER is set, and the check is best-effort so it never blocks
or breaks the CLI.
Comment thread playwright-cli.js
const lines = [
`Update available for ${packageJson.name}: ${current} → ${latest}`,
`Run \`npm install -g ${packageJson.name}@latest\` (global) or`,
`\`npm install ${packageJson.name}@latest\` (local) to update.`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this one be npm install --save-dev?

@pavelfeldman pavelfeldman merged commit 0857d71 into microsoft:main Jun 23, 2026
4 checks passed
@iamher672

iamher672 commented Jun 23, 2026 via email

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants