RFC: Deprecated packages UX revamp #516
Merged
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.
Deprecated packages UX revamp
Summary
Add a new notification interface at the end of every
installinforming the user of how much packages are deprecated in their current installed tree, in replacement of warning messages printed to standard output during the install.Motivation
There are two main motivations for this change:
npm installand this would be the final act to convert what used to be hundreds of lines printed in users interface during install into the notification system provided at the end that let users aware of audit issues, funding and now deprecations.Detailed Explanation
During
npm installarborist should no longer print warnings lines for each package that is marked as deprecated and it should instead queue them up and provide metrics that can be printed at the end of the install, similar to how it works with audit today.A new command can be introduced to properly display the current deprecations.
Alternatives
Implementation
Install changes:
lib/audit-report.jslib/utils/reify-output.jsin order to make sure we retrieve that info from arborist and properly display the deprecated packages notification.Install example:
Overview of all deprecated packages after an install
Creates a new
deprecationssubcommand in the cli.For the next few examples, assume an install such as:
$ npm ls project@1.0.0 $HOME/work/project ├── foo@0.4.0 ├─┬ lorem@0.4.0 │ └── ipsum@2.0.0 deprecated ├─┬ abbrev@3.0.9 │ └── bar@2.88.0 deprecated └── once@1.4.0 deprecated1. Prints deprecated notices for direct dependencies in the current install, e.g:
2. Prints deprecated notices for all deprecated packages in the current install, e.g:
3. Print deprecation notices for a given package from the current install when using package name only, e.g:
3.1. Support different output types:
3.2. Support multiple positional arguments:
4. Support reaching to the registry when using qualified spec as positional argument, e.g:
5. Support other common arborist options, e.g:
Prior Art
npm installwill print a single warning line during install for each deprecated package found, e.g: