swc/scripts/update-all-swc-crates.sh

27 lines
820 B
Bash
Raw Normal View History

#!/usr/bin/env bash
set -eu
echo "Listing all swc crates"
swc_crates=$(cargo metadata --format-version=1 --all-features | jq '.packages .[] | select(.repository == "https://github.com/swc-project/swc.git" or .repository == "https://github.com/swc-project/plugins.git") | .name' -r)
2024-03-26 08:46:44 +03:00
command="cargo update"
2024-03-28 06:47:59 +03:00
for crate in $swc_crates; do
2024-03-26 08:46:44 +03:00
command="$command -p $crate"
done
echo "Running: $command"
eval $command
all_direct_deps=$(cargo metadata --format-version=1 --all-features | jq -r '.packages[] | select(.source == null) | .dependencies .[] .name' -r)
2024-03-28 06:47:59 +03:00
direct_swc_deps=$(comm -12 <(echo "$swc_crates" | sort) <(echo "$all_direct_deps" | sort))
command="cargo upgrade --incompatible --recursive false"
2024-03-28 06:47:59 +03:00
for crate in $direct_swc_deps; do
command="$command -p $crate"
done
echo "Running: $command"
eval $command