Skip to content

Commit ed74216

Browse files
authored
Merge pull request #5827 from dependabot/jurre/yarn-berry-update-lockfile-mode
Yarn Berry: Run commands in `update-lockfile` mode
2 parents 0cee51a + e7c5cf0 commit ed74216

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def run_yarn_berry_top_level_updater(top_level_dependency_updates:, yarn_lock:)
161161
# updated to a single new version, so we just pick the first one.
162162
"#{dep[:name]}@#{dep[:requirements].first[:requirement]}"
163163
end
164-
command = "yarn add #{updates.join(' ')}"
164+
command = "yarn add #{updates.join(' ')} --mode=update-lockfile"
165165
Helpers.run_yarn_commands(command)
166166
{ yarn_lock.name => File.read(yarn_lock.name) }
167167
end
@@ -171,9 +171,9 @@ def run_yarn_berry_subdependency_updater(yarn_lock:)
171171
update = "#{dep.name}@#{dep.version}"
172172

173173
Helpers.run_yarn_commands(
174-
"yarn add #{update}",
175-
"yarn dedupe #{dep.name}",
176-
"yarn remove #{dep.name}"
174+
"yarn add #{update} --mode=update-lockfile",
175+
"yarn dedupe #{dep.name} --mode=update-lockfile",
176+
"yarn remove #{dep.name} --mode=update-lockfile"
177177
)
178178
{ yarn_lock.name => File.read(yarn_lock.name) }
179179
end

npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -2995,7 +2995,6 @@
29952995
it "updates the .yarn/cache folder" do
29962996
expect(updated_files.map(&:name)).to match_array(
29972997
[
2998-
".yarn/cache/fetch-factory-npm-0.0.1-e67abc1f87-ff7fe6fdb8.zip",
29992998
".yarn/cache/fetch-factory-npm-0.0.2-816f8766e1-200ddd8ae3.zip",
30002999
".yarn/install-state.gz",
30013000
"package.json",

0 commit comments

Comments
 (0)