Class: Dependabot::NpmAndYarn::FileUpdater

Inherits:
FileUpdaters::Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/npm_and_yarn/file_updater.rb,
lib/dependabot/npm_and_yarn/file_updater/npmrc_builder.rb,
lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb,
lib/dependabot/npm_and_yarn/file_updater/package_json_updater.rb,
lib/dependabot/npm_and_yarn/file_updater/package_json_preparer.rb,
lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb,
lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb,
lib/dependabot/npm_and_yarn/file_updater/pnpm_workspace_updater.rb

Overview

rubocop:disable Metrics/ClassLength

Defined Under Namespace

Classes: NoChangeError, NpmLockfileUpdater, NpmrcBuilder, PackageJsonPreparer, PackageJsonUpdater, PnpmLockfileUpdater, PnpmWorkspaceUpdater, YarnLockfileUpdater

Instance Method Summary collapse

Instance Method Details

#updated_dependency_filesObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/dependabot/npm_and_yarn/file_updater.rb', line 39

def updated_dependency_files
  updated_files = T.let([], T::Array[DependencyFile])

  updated_files += updated_manifest_files
  updated_files += if pnpm_workspace.any?
                     update_pnpm_workspace_and_locks
                   else
                     updated_lockfiles
                   end

  if updated_files.none?
    if original_pnpm_locks.any?
      raise_tool_not_supported_for_pnpm_if_transitive
      raise_miss_configured_tooling_if_pnpm_subdirectory
    end

    raise NoChangeError.new(
      message: "No files were updated!",
      error_context: error_context(updated_files: updated_files)
    )
  end

  sorted_updated_files = updated_files.sort_by(&:name)
  if sorted_updated_files == filtered_dependency_files.sort_by(&:name)
    raise NoChangeError.new(
      message: "Updated files are unchanged!",
      error_context: error_context(updated_files: updated_files)
    )
  end

  vendor_updated_files(updated_files)
end