Files
pnpm/registry-access/commands/package.json
Alessio Attilio 2c90d4061d feat: add native pnpm deprecate and undeprecate commands (#11120)
Adds native `pnpm deprecate` and `pnpm undeprecate` commands that interact with the npm registry directly instead of delegating to the npm CLI.

## Changes

- **New package `@pnpm/registry-access.commands`** — a new top-level domain for commands that manage packages on the registry
- **`pnpm deprecate <package>[@<version>] <message>`** — sets a deprecation message on matching versions
- **`pnpm undeprecate <package>[@<version>]`** — removes deprecation from already-deprecated versions
- Updated `pnpm-workspace.yaml`, CLI registration, and meta-updater config
- Removed `deprecate` from the not-implemented commands list
- Added changeset

## Implementation Details

- `registry-access/commands/src/deprecation/common.ts` — shared logic (auth, registry fetch, version matching)
- `registry-access/commands/src/deprecation/deprecate.ts` — deprecate command handler
- `registry-access/commands/src/deprecation/undeprecate.ts` — undeprecate command handler
- Uses `pickRegistryForPackage` for per-scope registry support
- Uses `createFetchFromRegistry`/`fetchWithDispatcher` for proxy/TLS support
- Uses `@pnpm/npm-package-arg` for package spec parsing
- Reuses `PackageMeta`/`PackageInRegistry` types from `@pnpm/resolving.registry.types`
- Sends minimal payload (only `name` + modified `versions.deprecated` fields) to the registry

## Usage

```bash
# Deprecate all versions
pnpm deprecate my-package "This package is deprecated"

# Deprecate a specific version
pnpm deprecate my-package@1.0.0 "Use v2 instead"

# Undeprecate all versions
pnpm undeprecate my-package

# Undeprecate a specific version
pnpm undeprecate my-package@1.0.0
```

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2026-04-06 15:30:11 +02:00

66 lines
2.0 KiB
JSON

{
"name": "@pnpm/registry-access.commands",
"version": "1000.0.0",
"description": "Commands for managing packages on the registry",
"keywords": [
"pnpm",
"pnpm11"
],
"license": "MIT",
"funding": "https://opencollective.com/pnpm",
"repository": "https://github.com/pnpm/pnpm/tree/main/registry-access/commands",
"homepage": "https://github.com/pnpm/pnpm/tree/main/registry-access/commands#readme",
"bugs": {
"url": "https://github.com/pnpm/pnpm/issues"
},
"type": "module",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"exports": {
".": "./lib/index.js"
},
"files": [
"lib",
"!*.map"
],
"scripts": {
"start": "tsgo --watch",
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
"test": "pn compile && pn .test",
"prepublishOnly": "pn compile",
"compile": "tsgo --build && pn lint --fix",
".test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest"
},
"dependencies": {
"@pnpm/cli.utils": "workspace:*",
"@pnpm/config.pick-registry-for-package": "workspace:*",
"@pnpm/config.reader": "workspace:*",
"@pnpm/error": "workspace:*",
"@pnpm/network.auth-header": "workspace:*",
"@pnpm/network.fetch": "workspace:*",
"@pnpm/npm-package-arg": "catalog:",
"@pnpm/resolving.registry.types": "workspace:*",
"@pnpm/types": "workspace:*",
"ramda": "catalog:",
"render-help": "catalog:",
"semver": "catalog:"
},
"devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/prepare": "workspace:*",
"@pnpm/registry-access.commands": "workspace:*",
"@pnpm/registry-mock": "catalog:",
"@pnpm/releasing.commands": "workspace:*",
"@pnpm/testing.command-defaults": "workspace:*",
"@types/ramda": "catalog:",
"@types/semver": "catalog:",
"execa": "catalog:"
},
"engines": {
"node": ">=22.13"
},
"jest": {
"preset": "@pnpm/jest-config/with-registry"
}
}