Change npm dependency

MSAL

Renames an npm dependency in package.json and optionally updates its version constraint. A catalog: reference keeps its catalog, which gains the new name's entry. After modifying the package.json, the lock file is regenerated natively, without executing the package manager. Not safe to use as a precondition: consults the package registry over the network and publishes per-project state shared with other dependency recipes.

org.openrewrite.javascript.ChangeDependency

Required

The current name of the npm package to rename.

The new name to use for the package.

Optional

Optional new version constraint to set on the renamed package.

The dependency scope: dependencies, devDependencies, etc. When omitted, all scopes are searched.

mod run . --recipe=org.openrewrite.javascript.ChangeDependency \ -P oldPackageName=lodash \ -P newPackageName=lodash-es

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.