-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[BUG] npm find-dupes
and npm dedupe --dry-run
doesn't print anything useful
#2687
Comments
Hey! I would like to work on this issue. How can I test the output for my changes in
|
Figured out how to test locally with Now I'm trying to set Any more tips? |
Hey, @chowkapow! Thanks for diving into this UX issue. We are in the process of a somewhat massive overhaul of the way that configuration parameters are handled and managed. It may be easiest at the current moment to base your work on the In that branch, you'll see in the class FindDupes {
// ... description, name, eventually a usage() method, etc.
exec (args, cb) {
this.npm.config.set('dry-run', true)
this.npm.commands.dedupe([], cb)
}
} That's the appropriate way to set configs now. The flatOptions.dryRun flag will be set based on calling As a first pass here, since we also want similar behavior for const reifyOutput = (npm, arb) => {
// don't print any info in --silent mode
// XXX: maybe it _should_ print something in dry-run anyway?
// I'm not sure. Even if it's "silent", isn't the pretty printed diff
// kind of "the point" when it's a dry-run? Maybe play with this?
if (log.levels[log.level] > log.levels.error)
return
const { diff, actualTree } = arb
// XXX: added bit here, not sure if it goes here? Should it be
// later? Earlier? Some room for creativity/iteration here.
if (npm.config.get('dry-run')) {
// a method that will show what WOULD have been done
prettyPrintDiff(diff) // might need to pass the npm object, if anything in here is config-specific?
// maybe return? Maybe it makes sense to still print the rest?
// this is where we should try some stuff and see what UX feels right
} That Then none of the commands have to change (because any dry-run reification command will just go through this method, which knows what has to be shown to the user). Another open question, should Once you add some code in there, you can do I realize I'm answering your question with a bunch more questions, but hopefully it gets you headed in a productive direction ;) |
Once you have the code and output feeling about right, you can write tests in Don't spend too much time trying to make it perfect. Getting something there and then tweaking it with feedback from the CLI team and other users is much more efficient. If it ends up taking a while, better to have something that gets us most of the way there, than have it be blocked. Feel free to send a draft PR with anything you'd like us to take a look at. |
Hey @isaacs, thank you so much for the thorough explanation! This turned out to have more creative input than I thought. I made a PR with some of my initial thoughts and questions. Let me know if this is the right direction and I will continue working. |
Hi. It seems that this has been around for a while. |
@isaacs - I see that you've done some work on this issue with @chowkapow, but that work was done back on Mar 20, 2021 (most recent comment between the two of you here). Is this issue still relevant/"up-for-grabs"? If so, I'd like to take a whack at it - assuming that it wasn't resolved already by the PR @chowkapow referenced previously. Please let me know. |
Is this still an open issue? |
Can i work on this? |
Current Behavior:
Expected Behavior:
Steps To Reproduce:
Run
npm find-dupes
ornpm dedupe --dry-run
in npm v7.Perhaps any call into
lib/utils/reify-output.js
withnpm.flatOptions.dryRun === true
, it should print much more details about the diff. Just saying "2 packages added, 3 packages removed, etc" is not so helpful, if it didn't actually do those things.Environment:
All environments, npm v7.5.4
The text was updated successfully, but these errors were encountered: