Class: Dependabot::NpmAndYarn::FileFetcher
- Inherits:
-
FileFetchers::Base
- Object
- FileFetchers::Base
- Dependabot::NpmAndYarn::FileFetcher
- Defined in:
- lib/dependabot/npm_and_yarn/file_fetcher.rb,
lib/dependabot/npm_and_yarn/file_fetcher/path_dependency_builder.rb
Overview
rubocop:disable Metrics/ClassLength
Defined Under Namespace
Classes: PathDependencyBuilder
Constant Summary collapse
- NPM_PATH_DEPENDENCY_STARTS =
Npm always prefixes file paths in the lockfile “version” with “file:” even when a naked path is used (e.g. “../dep”)
%w(file:).freeze
- PATH_DEPENDENCY_STARTS =
“link:” is only supported by Yarn but is interchangeable with “file:” when it specifies a path. Only include Yarn “link:”‘s that start with a path and ignore symlinked package names that have been registered with “yarn link”, e.g. “react”
%w(file: link:. link:/ link:~/ / ./ ../ ~/).freeze
- PATH_DEPENDENCY_CLEAN_REGEX =
/^file:|^link:/
Class Method Summary collapse
Instance Method Summary collapse
-
#clone_repo_contents ⇒ Object
Overridden to pull any yarn data or plugins which may be stored with Git LFS.
Class Method Details
.required_files_in?(filenames) ⇒ Boolean
27 28 29 |
# File 'lib/dependabot/npm_and_yarn/file_fetcher.rb', line 27 def self.required_files_in?(filenames) filenames.include?("package.json") end |
.required_files_message ⇒ Object
31 32 33 |
# File 'lib/dependabot/npm_and_yarn/file_fetcher.rb', line 31 def self. "Repo must contain a package.json." end |
Instance Method Details
#clone_repo_contents ⇒ Object
Overridden to pull any yarn data or plugins which may be stored with Git LFS.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/dependabot/npm_and_yarn/file_fetcher.rb', line 36 def clone_repo_contents return @git_lfs_cloned_repo_contents_path if defined?(@git_lfs_cloned_repo_contents_path) @git_lfs_cloned_repo_contents_path = super begin SharedHelpers.with_git_configured(credentials: credentials) do Dir.chdir(@git_lfs_cloned_repo_contents_path) do cache_dir = Helpers.fetch_yarnrc_yml_value("cacheFolder", "./yarn/cache") SharedHelpers.run_shell_command("git lfs pull --include .yarn,#{cache_dir}") end @git_lfs_cloned_repo_contents_path end rescue StandardError @git_lfs_cloned_repo_contents_path end end |