Skip to content

Query Cookbook

Nathan Fritz edited this page Oct 26, 2022 · 4 revisions

The Cookbook

npm query uses a CSS-like syntax for selecting packages within your project's dependency tree.

This is an informal space for documenting "useful" queries that we've come across or developed.

Not In Engine Spec

Finds production dependencies that do not meet an engine spec. There are entire npx tools that do this. (rsubset coming soon)

npm query '.prod:attr(engines, [node]):not(:semver(^14.17.0 || ^16.13.0 || >=18, :attr(engines, [node]), rsubset))'

Author: @lukekarrys

Some Other Query

explanation

npm query ...

Author: ...