Class LockFileRegeneration
java.lang.Object
org.openrewrite.javascript.internal.LockFileRegeneration
Regenerate a JavaScript project's lock file by running the package manager
in a temp directory seeded with the package.json and (optionally) the existing
lock file plus config files such as
.npmrc.
Pre-configured instances are provided for each
NodeResolutionResult.PackageManager; forPackageManager(PackageManager) dispatches
to the right one. The install args are preserved verbatim from the TypeScript
implementation in rewrite-javascript/rewrite/src/javascript/package-manager.ts.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final LockFileRegenerationstatic final LockFileRegenerationstatic final LockFileRegenerationstatic final LockFileRegenerationstatic final LockFileRegeneration -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable LockFileRegenerationforPackageManager(@Nullable NodeResolutionResult.PackageManager pm) regenerate(String packageJsonContent) regenerate(String packageJsonContent, @Nullable String existingLockContent) regenerate(String packageJsonContent, @Nullable String existingLockContent, @Nullable Map<String, String> configFiles) Regenerate the lock file.
-
Field Details
-
NPM
-
YARN_CLASSIC
-
YARN_BERRY
-
PNPM
-
BUN
-
-
Method Details
-
forPackageManager
public static @Nullable LockFileRegeneration forPackageManager(@Nullable NodeResolutionResult.PackageManager pm) -
getLockFile
-
regenerate
-
regenerate
public LockFileRegeneration.Result regenerate(String packageJsonContent, @Nullable String existingLockContent) -
regenerate
public LockFileRegeneration.Result regenerate(String packageJsonContent, @Nullable String existingLockContent, @Nullable Map<String, String> configFiles) Regenerate the lock file. Optional inputs:existingLockContent— when present, seeded into the temp dir so the package manager performs a minimal update rather than a full re-resolve.configFiles— extra files to seed into the temp dir (typically{".npmrc": "..."}).
-