Comments (5)
I recovered the "expected" behavior with only a few small changes to search.js
(marked in comments)
class Search extends BaseCommand {
// ...
async exec (args) {
const opts = {
...this.npm.flatOptions,
...this.npm.flatOptions.search,
detailed: true, // NEW: request full response from search API
include: args.map(s => s.toLowerCase()).filter(s => s),
exclude: this.npm.flatOptions.search.exclude.split(/\s+/),
}
// NEW: long is not in flatOptions
const returnLong = this.npm.config.get('long');
if (opts.include.length === 0) {
throw new Error('search must be called with arguments')
}
// Used later to figure out whether we had any packages go out
let anyOutput = false
class FilterStream extends Minipass {
constructor () {
super({ objectMode: true })
console.log(opts);
}
write (pkg) {
// NEW: pkg now contains a package prop plus extra info
if (filter(pkg.package, opts.include, opts.exclude)) {
// NEW: only JSON output supports extra fields
super.write((returnLong && opts.json) ? pkg : pkg.package)
}
}
}
// ... class continues
}
This would add support for --long
when using --json
, but not otherwise. It would be helpful to have access to the popularity
and flags.insecure
props from the CLI ;)
On the other hand, it would also make loads of sense to just remove the --long
flag from search
altogether and update the docs appropriately.
from cli.
I thing --long
probably doesn't make sense anymore. It was a bandage over the real problem, which is that table output for search was not a good fit. All it ever actually did was prevent the columns from truncating, which it looks like it hasn't been doing since npm@6
.
As far as adding those flags, that'd be a separate feature request. I don't thing popularity is likely to be added, but I think adding an extra line of caution if insecure
is not 0
would be a great addition to the search results.
from cli.
Closing this as it's not a bug, but if someone wants to submit a PR to add something if insecure
is true that would probably be an easy task.
from cli.
Reopening cause we should remove this from the params
from cli.
Nice job :)
from cli.
Related Issues (20)
- Runtinme Error loading
- [BUG] npm audit consistently not finding any vulnerabilities HOT 6
- [BUG] npm audit stopped audit packages HOT 1
- [BUG] Npm Search is failing on version 10.6.0 - Cannot read properties of undefined (reading 'username') HOT 3
- [BUG NPM] Error when installing npm modules HOT 2
- [BUG] Scoped packages attempted to download from http and not https url as defined in npmrc file HOT 5
- [BUG] `npm.ps1` introduced two regressions
- [BUG] Running `npm ci` doesn't fail when package.json#version has changed HOT 2
- [BUG] `install` and `cache add` disagrees on accept header
- [BUG] Windows npx looking in node_modules/node_modules HOT 3
- Typo in install-clean command HOT 2
- [BUG] npm install failing with ECONNRESET error HOT 4
- [BUG] running npm install without a package.json shouldn't create a package-lock.json if it errors HOT 2
- [BUG] <title>npm EXIT handler never called HOT 1
- [BUG] npm v6.14.xx : 'npm install' generate different node_modules which made my project not responding HOT 1
- [BUG] npx does not respect version range if a compatible version is found inside any package installed globally HOT 7
- [BUG] Npm incorrectly reads parameters in Powershell terminal (Node 20.13.0) HOT 1
- [DOCS] npm removal using make, no Makefile in project directory HOT 5
- [BUG] `npm update` hangs for some dependencies for `npm>=10.4.0`
- [BUG] Invalid package name ".DS_Store" HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.