mirror of
https://github.com/pnpm/pnpm.git
synced 2026-06-29 10:25:05 -04:00
The online documentation has long listed `pnpm login [--registry <url>] [--scope <scope>]`,
but the CLI only ever accepted `--registry`. `pnpm login --scope foo` errored with
`Unknown option: 'scope'` and there was no way to associate a scope with a registry
through the login command — users had to edit `.npmrc` by hand.
This change wires `--scope` through:
- `cliOptionsTypes` / `rcOptionsTypes` declare the option.
- `help()` documents it.
- After the token is written, `@<scope>:registry=<registry>` is written into the same
auth file (`~/.config/pnpm/auth.ini`), which `config.reader` already accepts as a
source of `@scope:registry=` mappings.
- Scope normalization: `--scope foo` and `--scope @foo` both produce `@foo`. Blank
values (`""`, `" "`, `"@"`) are treated as unset rather than writing a broken
`@:registry=` entry.
Ref: #11716
Co-authored-by: shiminshen <16914659+shiminshen@users.noreply.github.com>