Class: Dependabot::NpmAndYarn::FileUpdater::YarnLockfileUpdater

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

Instance Method Summary collapse

Constructor Details

#initialize(dependencies:, dependency_files:, repo_contents_path:, credentials:, security_updates_only: false, release_age_days: nil) ⇒ YarnLockfileUpdater

Returns a new instance of YarnLockfileUpdater.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb', line 39

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

Instance Method Details

#updated_yarn_lock_content(yarn_lock) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb', line 65

def updated_yarn_lock_content(yarn_lock)
  @updated_yarn_lock_content ||= T.let({}, T.nilable(T::Hash[String, String]))
  return T.must(@updated_yarn_lock_content[yarn_lock.name]) if @updated_yarn_lock_content[yarn_lock.name]

  new_content = updated_yarn_lock(yarn_lock)

  @updated_yarn_lock_content[yarn_lock.name] =
    post_process_yarn_lockfile(new_content)
end