-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: group outdated packages by dependency type #392
base: main
Are you sure you want to change the base?
Conversation
Hello, Right after publishing the RFC, I read outdated.js's source code and figured out the flag -- ORIGINAL PROPOSALShow outdated packages with dependency typesThis RFC proposes to show outdated packages with their corresponding dependency type in SummaryDisplay outdated packages with their corresponding dependency type in Motivation
Detailed ExplanationBy running
Example 1Default behavior, rows are sorted by $ npm outdated
Package Type Current Wanted Latest Location
@types/jest development 25.2.3 25.2.3 26.0.23 example
@types/node development 8.10.66 8.10.66 15.12.1 example
chalk production 3.0.0 3.0.0 4.1.1 example
cosmiconfig production 6.0.0 6.0.0 7.0.0 example
glob bundled 7.1.6 7.1.7 7.1.7 example
memfs peer 2.17.1 2.17.1 3.2.2 example
rimraf bundled 2.7.1 2.7.1 3.0.2 example
typescript development 3.9.9 3.9.9 4.3.2 example
update-notifier production 4.1.3 4.1.3 5.1.0 example
xregexp optional 3.2.0 3.2.0 5.0.2 example Example 2Using the new flag $ npm outdated --by-type
Package Type Current Wanted Latest Location
glob bundled 7.1.6 7.1.7 7.1.7 example
rimraf bundled 2.7.1 2.7.1 3.0.2 example
@types/jest development 25.2.3 25.2.3 26.0.23 example
@types/node development 8.10.66 8.10.66 15.12.1 example
typescript development 3.9.9 3.9.9 4.3.2 example
xregexp optional 3.2.0 3.2.0 5.0.2 example
memfs peer 2.17.1 2.17.1 3.2.2 example
chalk production 3.0.0 3.0.0 4.1.1 example
cosmiconfig production 6.0.0 6.0.0 7.0.0 example
update-notifier production 4.1.3 4.1.3 5.1.0 example Rationale and AlternativesAn alternative solution is to filter the current list of outdated packages by type, using CLI options like $ npm outdated --prod
Package Current Wanted Latest Location
chalk 3.0.0 3.0.0 4.1.1 example
cosmiconfig 6.0.0 6.0.0 7.0.0 example
update-notifier 4.1.3 4.1.3 5.1.0 example However, this alternative requires to give multiple commands to get all the outdated packages. ImplementationIt would affect the npm/cli repository, particularly the command |
After discussion at the last two RFC meetings this will be able to move forward after some small additions:
If this PR could be updated to reflect that it can move forward. |
Additional caveat on that second bullet point: a package should indicate all of the groups it belongs to, despite being grouped with the highest priority one. |
@wraithgar @ljharb Great, the PR can be updated as you see fit. |
This RFC proposes to group outdated packages by their corresponding dependency type in
package.json
(e.g.dependencies
,devDependencies
, etc) to facilitate package management for projects with a large number of dependencies.Summary
Group outdated packages by with their corresponding dependency type in
package.json
(e.g.dependencies
,devDependencies
, etc).Motivation
It helps developers to visualize and manage outdated packages according to their dependency type. This is specially useful for projects with a large number of dependencies.
Detailed Explanation
Currently, by running
npm outdated --long
, the output include two additional columns:Package Type
andHomepage
. The former indicates the dependency type as defined inpackage.json
. However, there is no CLI option to group the packages byPackage Type
and, thus, the packages are sorted byPackage
name only.Example
Current behavior, rows are sorted by
Package
.Proposal
Using the new flag
--by-type
, rows are sorted byPackage Type
(alphabetically) and then byPackage
nameRationale and Alternatives
An alternative solution is to filter the current list of outdated packages by type, using CLI options like
--prod
forproduction
,--dev
fordevelopment
,--optional
,--peer
, and--bundled
. Example:However, this alternative requires to give multiple commands to get all the outdated packages.
Implementation
It would affect the npm/cli repository, particularly the command
outdated
, implemented by outdated.js.References
Original proposal, before figuring out the flag
--long
(which is not available in the CLI help).