Skip to content

Commit

Permalink
pls
Browse files Browse the repository at this point in the history
deploy
  • Loading branch information
trueberryless committed Nov 24, 2024
1 parent 48881d5 commit 7ee1a6f
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions .github/workflows/sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,31 +154,7 @@ jobs:
fi
elif [[ "$dest_file" == "package.json" ]]; then
echo "Special handling for package.json"
# Iterate over each key in src_file and merge or update values in dest_file
jq --argfile template "../$src_file" \
--argfile current "$dest_file" \
'
# For each key in the template, check if it exists in the current (dest_file)
# If it exists and the value is different, update it. If not, add it.
reduce (keys_unsorted($template) | .[]) as $key (
$current;
if has($key) then
# If the key exists, check if the value is different, then update it
if ($current[$key] != $template[$key]) then
.[$key] = $template[$key]
else
. # Keep the existing value if it matches
end
else
# If the key doesn't exist, add it
.[$key] = $template[$key]
end
)
' > temp_package.json
# Move the processed JSON back to the destination file
mv temp_package.json "$dest_file"
jq -s 'reduce .[] as $item ({}; . * $item)' "$src_file" "$dest_file" > "$dest_file.tmp" && mv "$dest_file.tmp" "$dest_file"
fi
else
# Prepare the destination directory
Expand Down

0 comments on commit 7ee1a6f

Please sign in to comment.