Class: Dependabot::NpmAndYarn::FileUpdater::YarnLockfileUpdater
- Inherits:
-
Object
- Object
- Dependabot::NpmAndYarn::FileUpdater::YarnLockfileUpdater
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb
Instance Method Summary collapse
-
#initialize(dependencies:, dependency_files:, repo_contents_path:, credentials:) ⇒ YarnLockfileUpdater
constructor
A new instance of YarnLockfileUpdater.
- #updated_yarn_lock_content(yarn_lock) ⇒ Object
Constructor Details
#initialize(dependencies:, dependency_files:, repo_contents_path:, credentials:) ⇒ YarnLockfileUpdater
Returns a new instance of YarnLockfileUpdater.
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb', line 36 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 = T.let( YarnErrorHandler.new( dependencies: dependencies, dependency_files: dependency_files ), YarnErrorHandler ) end |
Instance Method Details
#updated_yarn_lock_content(yarn_lock) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb', line 53 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 |