Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/salus/auto_fix/yarn_audit_v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def update_package_definition(blocks, parts)
updated_resolved = "resolved " + '"' + fixed_package_info["data"]["dist"]["tarball"] \
+ "#" + fixed_package_info["data"]["dist"]["shasum"] + '"'
updated_integrity = "integrity " + fixed_package_info['data']['dist']['integrity']
updated_name = package_name + "@^" + version_to_update_to
updated_name = package_name + "@^" + versions.first[:patch].tr(">=", "").tr(">", "")
Copy link
Contributor

@saikat056 saikat056 Sep 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some unit tests for this change?


parts.each_with_index do |part, index|
current_v = parts[index].match(/(("|)version("|).*)/)
Expand Down Expand Up @@ -160,7 +160,7 @@ def update_sub_parent_resolution(blocks, parts)
if part.include?(source) && !match.nil? && !is_major_bump(
match.to_s.split(" ").last, version_to_update_to
)
replace = target + ' "^' + version_to_update_to + '"'
replace = target + ' "^' + patch.first[:patch].tr(">=", "").tr(">", "") + '"'
part.sub!(/("|)(!:|#{target})("| ).*/, replace)
parts[index] = part
end
Expand Down