[RRFC] Query Installs
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, node.js
Research direction
Start by comparing the existing npm query and npm install behavior described in the issue. Define how a query selects dependencies, how the minimal dependency tree is built, and how existing install behavior is preserved. Done means npm install --query supports the listed examples and continues to support aliases such as --production.
Written by the indexing model from the issue text.
Description
Motivation ("The Why")
1. Extending the usefulness of npm query
With the new npm query command it's now possible to select subtrees of your dependencies for many different purposes, auditing, inspecting, upgrading dependencies, funding, etc.
For all of these purposes, you sometimes also want the contents of these dependencies as well, even a full install. You can run a full install today, but that tends to take awhile and if you're auditing or want to do something sensitive
2. Allow users to install just the packages they need for a task
For users with sizable installs, npm install is one of the longest steps in their CI process. And oftentimes its not worthwhile to parallelize running separate npm scripts across CI nodes, simply because npm install takes much longer than the script itself.
If you could run:
npm install --query "eslint, [name^=eslint-plugin-], [name^=@typescript-eslint/], typescript"
And get the subtree of your dependencies queried, it would be much faster than trying to run a full npm install/ci and splitting tasks across ci nodes would be much more impactful.
Other tools could be written around npm install --query to make this more powerful by generating queries for you.
3. "Explain" existing features like --production
Features like --production could be implemented via queries, it could be called an alias.
4. Avoid building one-off features in installs
By giving users a powerful querying syntax in installs, many feature requests related to installs could point to this instead.
Example
npm install --query <query>
npm install --query "*:attr(contributors, :attr([name~=Jordan]))"
npm install --query "eslint, [name^=eslint-plugin-], [name^=@typescript-eslint/], typescript"
npm install --query ".prod" # same as `npm install --production`
How
Current Behaviour
N/A, only options are npm install [--production]
Desired Behaviour
npm install --query <query>- Build the minimal tree that includes all of the dependencies matched by
<query> - Preserve
npm install's other behaviors otherwise
References
Related to #360, #592
- Dominant language
- JavaScript
- Stars
- 777
- Forks
- 267
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from npm/rfcs
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
[RRFC] <title> Open
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
Similar issues
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100