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) ⇒ YarnLockfileUpdater

Returns a new instance of YarnLockfileUpdater.



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

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(
    YarnErrorHandler.new(
      dependencies: dependencies,
      dependency_files: dependency_files
    ),
    YarnErrorHandler
  )
end

Instance Method Details

#updated_yarn_lock_content(yarn_lock) ⇒ Object



62
63
64
65
66
67
68
69
70
# File 'lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb', line 62

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