Class: Dependabot::NpmAndYarn::FileUpdater::PnpmLockfileUpdater

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb

Overview

rubocop:disable Metrics/ClassLength

Instance Method Summary collapse

Constructor Details

#initialize(dependencies:, dependency_files:, repo_contents_path:, credentials:, security_updates_only: false) ⇒ PnpmLockfileUpdater

Returns a new instance of PnpmLockfileUpdater.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb', line 28

def initialize(
  dependencies:,
  dependency_files:,
  repo_contents_path:,
  credentials:,
  security_updates_only: false
)
  @dependencies = dependencies
  @dependency_files = dependency_files
  @repo_contents_path = repo_contents_path
  @credentials = credentials
  @security_updates_only = T.let(security_updates_only, T::Boolean)
  @error_handler = T.let(
    PnpmErrorHandler.new(
      dependencies: dependencies,
      dependency_files: dependency_files
    ),
    PnpmErrorHandler
  )
end

Instance Method Details

#updated_pnpm_lock_content(pnpm_lock, updated_pnpm_workspace_content: nil) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb', line 55

def updated_pnpm_lock_content(pnpm_lock, updated_pnpm_workspace_content: nil)
  @updated_pnpm_lock_content ||= T.let(
    {},
    T.nilable(T::Hash[String, String])
  )
  return T.must(@updated_pnpm_lock_content[pnpm_lock.name]) if @updated_pnpm_lock_content[pnpm_lock.name]

  new_content = run_pnpm_update(
    pnpm_lock: pnpm_lock,
    updated_pnpm_workspace_content: updated_pnpm_workspace_content
  )
  @updated_pnpm_lock_content[pnpm_lock.name] = new_content
rescue SharedHelpers::HelperSubprocessFailed => e
  handle_pnpm_lock_updater_error(e, pnpm_lock)
end