Class: Dependabot::NpmAndYarn::UpdateChecker::ConflictingDependencyResolver
- Inherits:
-
Object
- Object
- Dependabot::NpmAndYarn::UpdateChecker::ConflictingDependencyResolver
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/npm_and_yarn/update_checker/conflicting_dependency_resolver.rb
Instance Method Summary collapse
- #conflicting_dependencies(dependency:, target_version:) ⇒ Object
-
#initialize(dependency_files:, credentials:) ⇒ ConflictingDependencyResolver
constructor
A new instance of ConflictingDependencyResolver.
Constructor Details
#initialize(dependency_files:, credentials:) ⇒ ConflictingDependencyResolver
29 30 31 32 |
# File 'lib/dependabot/npm_and_yarn/update_checker/conflicting_dependency_resolver.rb', line 29 def initialize(dependency_files:, credentials:) @dependency_files = dependency_files @credentials = credentials end |
Instance Method Details
#conflicting_dependencies(dependency:, target_version:) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/dependabot/npm_and_yarn/update_checker/conflicting_dependency_resolver.rb', line 51 def conflicting_dependencies(dependency:, target_version:) SharedHelpers.in_a_temporary_directory do dependency_files_builder = DependencyFilesBuilder.new( dependency: dependency, dependency_files: dependency_files, credentials: credentials ) dependency_files_builder.write_temporary_dependency_files # TODO: Look into using npm/arborist for parsing yarn lockfiles (there's currently partial yarn support) # # Prefer the npm conflicting dependency parser if there's both a npm lockfile and a yarn.lock file as the # npm parser handles edge cases where the package.json is out of sync with the lockfile, something the yarn # parser doesn't deal with at the moment. if dependency_files_builder.package_locks.any? || dependency_files_builder.shrinkwraps.any? T.cast( SharedHelpers.run_helper_subprocess( command: NativeHelpers.helper_path, function: "npm:findConflictingDependencies", args: [Dir.pwd, dependency.name, target_version.to_s] ), T::Array[T::Hash[String, String]] ) else T.cast( SharedHelpers.run_helper_subprocess( command: NativeHelpers.helper_path, function: "yarn:findConflictingDependencies", args: [Dir.pwd, dependency.name, target_version.to_s] ), T::Array[T::Hash[String, String]] ) end end rescue SharedHelpers::HelperSubprocessFailed [] end |