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:, credentials:) ⇒ YarnLockfileUpdater

Returns a new instance of YarnLockfileUpdater.



18
19
20
21
22
# File 'lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb', line 18

def initialize(dependencies:, dependency_files:, credentials:)
  @dependencies = dependencies
  @dependency_files = dependency_files
  @credentials = credentials
end

Instance Method Details

#updated_yarn_lock_content(yarn_lock) ⇒ Object



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

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