Skip to content

Commit

Permalink
Running yarn install before running the update checkoer (#11011)
Browse files Browse the repository at this point in the history
* Adding yarn install in file_fetcher.rb

* removing unused require

* fixing the sorbet error.

* Creating a .yarn/cache folder makes the cli run success.

* sorbet error fixes.

* Adding check for mono repo.

* Removed the monorepo check.

* Delete smoke.yml

---------

Co-authored-by: “Thavachelvam <“[email protected]”>
  • Loading branch information
thavaahariharangit and “Thavachelvam authored Nov 27, 2024
1 parent 59da347 commit c02fdae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def yarn_files
fetched_yarn_files << yarn_lock if yarn_lock
fetched_yarn_files << yarnrc if yarnrc
fetched_yarn_files << yarnrc_yml if yarnrc_yml
create_yarn_cache
fetched_yarn_files
end

Expand Down Expand Up @@ -655,6 +656,19 @@ def parsed_lerna_json
rescue JSON::ParserError
raise Dependabot::DependencyFileNotParseable, T.must(lerna_json).path
end

sig { void }
def create_yarn_cache
if repo_contents_path.nil?
Dependabot.logger.info("Repository contents path is nil")
elsif Dir.exist?(T.must(repo_contents_path))
Dir.chdir(T.must(repo_contents_path)) do
FileUtils.mkdir_p(".yarn/cache")
end
else
Dependabot.logger.info("Repository contents path does not exist")
end
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
File.join(repo_contents_path, ".pnp.cjs")
)
).to start_with("version https://git-lfs.github.com/spec/v1")

# Ensure .yarn directory contains .cache directory
expect(Dir.exist?(File.join(repo_contents_path, ".yarn", "cache"))).to be true
end
end

Expand Down

0 comments on commit c02fdae

Please sign in to comment.