Skip to content

pnpm why command has default depth = 0. making the default behavior not very useful #607

Open
@bman654

Description

pnpm version: 9.14.3

with these declared dependencies:

  "dependencies": {
    "embedded-postgres": "17.2.0-beta.14",
    "rxjs": "^7.8.1",
    "winston": "^3.17.0"
  },
  "devDependencies": {
    "@eslint/js": "^9.16.0",
    "@smarttools/eslint-plugin-rxjs": "^1.0.7",
    "@types/node": "^22.10.1",
    "eslint": "^9.16.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-import-resolver-typescript": "^3.6.3",
    "eslint-plugin-import-x": "^4.4.3",
    "eslint-plugin-n": "^17.14.0",
    "eslint-plugin-promise": "^7.2.1",
    "globals": "^15.12.0",
    "husky": "^9.1.7",
    "lint-staged": "^15.2.10",
    "prettier": "^3.4.1",
    "rimraf": "^6.0.1",
    "typescript": "^5.7.2",
    "typescript-eslint": "^8.16.0"
  },

I wanted to see what version of pg was pulled in transitively so I did:

pnpm why pg

and got back nothing.

I had to google around a bit and finally do:

pnpm why --depth 1 pg

to get back results.

[00:35:33 /d/dev/adj (main)] 519$ pnpm why pg
[00:42:02 /d/dev/adj (main)] 520$ pnpm why --depth 1 pg
Legend: production dependency, optional only, dev only

@oms/[email protected] D:\dev\adj

dependencies:
embedded-postgres 17.2.0-beta.14
└── pg 8.13.1
[00:42:09 /d/dev/adj (main)] 521$ 

I do not know if this behavior is intended or accidental. If it's intended, I guess this is a feature request to change it? Seems like default depth of 0 for this command is not very useful. Most developers know why their direct dependencies are installed (because they are listed in package.json). If a dev is running pnpm why it is almost certainly to discover why a transitive dependency is installed. IMO default depth should be Infinity for this command.

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions