npm / npm/rfcs

Named dependency groups

Open
#592 1 comment 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
777
Forks
267
PR merge metrics
No merged PRs in 30d

Description

I'd suggest that NPM adopted named dependency groups.

It could work like this:

  • dependencies -> production group [existing group]
  • devDependencies -> dev group [existing group]
  • lintingDependencies -> linting group [example]

The general pattern would be this:

{prefix}Dependencies -> {prefix} group

These groups could then be used with install, e.g. npm install only=linting or npm install only=dev,test.

Prior Art

Bundler (a Ruby package manager) has support for groups:
https://bundler.io/guides/groups.html

Use-case

A common problem today is that linting (in CI jobs) need to install a ton of dependencies that aren't needed. If we could have a linting group, we could install only select dependencies needed to run linting.

One can imagine similar groups for tests, deployment and staging.

Open-questions

  • It could make sense to use dependencies as the default group (basically changing it's name), but that would be a breaking change.

Alternative solutions

One could also allow specifying an alternative package file when calling npm install, for example npm install --package-file=linting-package.json (prior art).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files, tests, or entry points are named. Start by reviewing the proposal, npm issue #1669, and the linked Bundler groups documentation; define the group syntax, install behavior, and backward-compatibility expectations before this is ready for implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.