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

RFC: Command Specific Configuration #566

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions accepted/0000-command-specific-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Scoped Command Config

## Summary

Implement a mechanism to scope configuration to commands explicitely.

## Motivation

This change will help resolve many issues user's face when configuring `npm` as the current strategy is to have a single set of global options available to **all** commands.

## Detailed Explanation

- expand `.npmrc` to support command-specific configuration
- changes should be as backwards compatible as possible (old `.npmrc` files should still be supported)
- add clear documentation on configuration precedence (ex. arguments vs. command-specific vs. project, user & global vs. globally set vs. `publishConfig`)

## Rationale and Alternatives

Currently, the only alternative strategy users have is to manual pass arguments to `npm`.

## Implementation

- `npm` should support `npm-` prefixed command configuration in `.npmrc` files
- prefixed command configuration scopes the nested config

### Example `.npmrc`

```ini
omit=dev

# equivalent to `npm install --no-audit --no-fund`
[npm-install]
audit=false
fund=false

# equivalent to `npm audit --production`
[npm-audit]
production=true

# equivalent to `npm audit fix --force`
[npm-audit-fix]
force=true

# equivalent to `npm list --all`
[npm-list]
all=true

# equivalent to `npm publish --loglevel=silly`
[npm-publish]
loglevel=silly
```

## Prior Art

- N/A

## Unresolved Questions and Bikeshedding

- N/A