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

Inherits:
Object
  • Object
show all
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:) ⇒ YarnLockfileUpdater

Returns a new instance of YarnLockfileUpdater.



24
25
26
27
28
29
30
31
32
33
# File 'lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb', line 24

def initialize(dependencies:, dependency_files:, repo_contents_path:, credentials:)
  @dependencies = dependencies
  @dependency_files = dependency_files
  @repo_contents_path = repo_contents_path
  @credentials = credentials
  @error_handler = YarnErrorHandler.new(
    dependencies: dependencies,
    dependency_files: dependency_files
  )
end

Instance Method Details

#updated_yarn_lock_content(yarn_lock) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb', line 35

def updated_yarn_lock_content(yarn_lock)
  @updated_yarn_lock_content ||= {}
  return @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