Skip to content

[DOCS] npm search --long flag has no effect #7434

Closed
@joshbax189

Description

@joshbax189

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

This could also be a feature request or a docs update depending how you look at it...

When calling npm search with the --long flag, e.g.

> npm search --long --json --searchlimit 1 color

I get this output, which is identical to calling search without --long

[
  {
    "name": "color",
    "scope": "unscoped",
    "version": "4.2.3",
    "description": "Color conversion and manipulation with CSS string support",
    "keywords": [
      "color",
      "colour",
      "css"
    ],
    "date": "2022-04-05T09:15:16.379Z",
    "links": {
      "npm": "https://www.npmjs.com/package/color",
      "homepage": "https://github.com/Qix-/color#readme",
      "repository": "https://github.com/Qix-/color",
      "bugs": "https://github.com/Qix-/color/issues"
    },
    "publisher": {
      "username": "qix",
      "email": "josh@junon.me"
    },
    "maintainers": [
      {
        "username": "qix",
        "email": "josh@junon.me"
      }
    ]
  }
]

Expected Behavior

I expected more information, perhaps the full output of registry search

For example

> npm search --long --json --searchlimit 1 color
[
  {
    "package": {
      "name": "color",
      "scope": "unscoped",
      "version": "4.2.3",
      "description": "Color conversion and manipulation with CSS string support",
      "keywords": [
        "color",
        "colour",
        "css"
      ],
      "date": "2022-04-05T09:15:16.379Z",
      "links": {
        "npm": "https://www.npmjs.com/package/color",
        "homepage": "https://github.com/Qix-/color#readme",
        "repository": "https://github.com/Qix-/color",
        "bugs": "https://github.com/Qix-/color/issues"
      },
      "publisher": {
        "username": "qix",
        "email": "josh@junon.me"
      },
      "maintainers": [
        {
          "username": "qix",
          "email": "josh@junon.me"
        }
      ]
    },
    "flags": {
      "insecure": 0
    },
    "score": {
      "final": 0.38903615890331245,
      "detail": {
        "quality": 0.5395409662759634,
        "popularity": 0.4959066747321972,
        "maintenance": 0.15316152246929846
      }
    },
    "searchScore": 100000.43
  }
]

Steps To Reproduce

Run the commands above. I've checked on 8.x, 9.x and 10.6.0 using nvm

It looks like the config value is never used in search.js. Compare the other referenced commands from the help docs: ls.js and help-search.js. Both access the config via this.npm.config.get('long'), but search.js only uses this.npm.flatOptions which doesn't contain the long prop.

Environment

  • npm: 10.6.0
  • Node.js: 20.12.2
  • OS Name: ArchLinux
  • System Model Name: Toaster
  • npm config:
; nothing special

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions