[lockfile-explorer] Replace update-notifier with a built-in solution#5786
Open
iclanton wants to merge 5 commits intomicrosoft:mainfrom
Open
[lockfile-explorer] Replace update-notifier with a built-in solution#5786iclanton wants to merge 5 commits intomicrosoft:mainfrom
iclanton wants to merge 5 commits intomicrosoft:mainfrom
Conversation
…te-notifier - Add `PackageUpdateChecker` class to `rush-lib` as an `@internal` utility: caches latest-version results in `~/.rushstack/update-checks/`, uses global `fetch` with a 5s timeout, and supports `forceCheck`/`skip` options - Export as `_PackageUpdateChecker` from `@microsoft/rush-lib` - Replace `update-notifier` in `lockfile-explorer` with `PackageUpdateChecker`; fire the check concurrently with server setup and display the result inside `app.listen` via a standalone `printUpdateNotification` helper - Remove `update-notifier` and `@types/update-notifier` from dependencies - Remove `update-notifier` from nonbrowser-approved-packages.json - Add unit tests for `PackageUpdateChecker` (mocking `fetch` and `JsonFile`) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the
update-notifiernpm dependency from@rushstack/lockfile-explorerand replaces it with a small built-inPackageUpdateCheckerclass.The new implementation:
fetchAPI (Node 18+), with a 5-second abort timeout so it never hangs startup~/.rushstack/update-checks/<package>.json(consistent with the~/.rushstackconvention used by@rushstack/debug-certificate-manager)app.listen, so it never blocks the server from startingDetails
apps/lockfile-explorer/src/utils/PackageUpdateChecker.ts— new self-contained utility (no new dependencies)apps/lockfile-explorer/src/utils/constants.ts— extractsLFX_PACKAGE_NAME/LFX_VERSIONconstants shared across the CLI entry pointsExplorerCommandLineParser.ts— firesupdateCheckPromisebefore server setup, awaits it inapp.listencallback viaprintUpdateNotification()update-notifierand@types/update-notifierfrompackage.jsonupdate-notifierfromnonbrowser-approved-packages.jsonAlso includes: CLI help snapshot test and minor terminal/action cleanup.
How it was tested
Unit tests added for
PackageUpdateCheckercovering: fresh cache hit, stale cache re-fetch, missing cache,forceCheck, network error, non-ok HTTP response,isOutdatedlogic, wrongcacheVersion, customcacheExpiryMs, and scoped package name sanitization.