-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
npm outdated with arborist #1208
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some ways to lean on the Edge class to do a bit more work here, and we can optimize the async fetches for packuments to go a little faster.
Areas for further improvement (perhaps outside the scope of this PR):
- What happens with git deps? It'd be nice if we could detect things other than versions being outdated, but also git deps that are not up to date. We'd have to treat the "wanted" as the resolved value, of course, since a lot of the time, those things won't be on the registry, and the "packument" is fake, so we'd need to look at the
manifest._resolved
rather thanmanifest.version
. - Needs to be updated to handle cases where there are multiple edges that limit what a package can be. If you have a deduped top-level dep that can be updated, with another dep depending on its current version, maybe "wanted" would be a lower version in
--all
mode? I'm not sure the best way to present that. Showing a separate line for each dependent is pretty noisy.
cd6840b
to
e57a991
Compare
d12038a
to
0e06c26
Compare
0e06c26
to
c613d1a
Compare
8d8d997
to
f17be9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super minor nit that could be polished to remove the extra name
field in the set of objects, and one open question. But the nit really is super minor, and the open question should probably be an RFC anyway (or maybe just a separate issue/PR) since it'd be a deviation from v6 behavior.
LGTM!
columns[5] = type | ||
columns[6] = homepage | ||
} | ||
const tree = await arb.loadActual() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking we might want this to be arb.buildIdealTree()
so it finds outdated deps in the virtual tree, falling back to the actual if there's no lockfile. But I wonder if that even makes sense? The current behavior only looks at the actual tree, but it also predates the existence of lockfiles, so I'm not sure how much sense it makes to go based on that.
if (deps.length !== 0) { | ||
// specific deps | ||
for (let i = 0; i < deps.length; i++) { | ||
const nodes = tree.inventory.query('name', deps[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was initially a little curious as to why you had that in/out switch in getEdges
, but it makes sense seeing this. This is a lot more efficient than looping over every node in the tree!
f17be9a
to
332830b
Compare
Changes
This PR is a refactor of
npm outdated
with Arborist. It removes the--depth
option flag and introduces a new--all
one for displaying all outdated dependencies in a tree. The homepage information of a package is now taken directly from the packument instead of thepackage.json
to avoid displaying outdated information. The location info is now thenode.location
(it's position on the physical tree) instead of it's position on the logical dependency tree.A new column
Depended by
was also added on the default display that shows which package depends on the displayed dependency. This makes the information displayed when--all
is on easier to understand.References
http://github.com/npm/rfcs/pull/133
Examples