Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Named dependency groups #592

Open
sandstrom opened this issue May 24, 2022 · 1 comment
Open

Named dependency groups #592

sandstrom opened this issue May 24, 2022 · 1 comment

Comments

@sandstrom
Copy link

sandstrom commented May 24, 2022

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).

@Delapouite
Copy link

Hi. This issue seems closely related to this previous one about custom dependency lists: #360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants