2023-10-18 14:28:05 +02:00
|
|
|
#!/bin/sh
|
2023-10-03 11:02:11 +02:00
|
|
|
|
2023-10-18 16:06:32 +02:00
|
|
|
packages_to_remove="@budibase/backend-core @budibase/bbui @budibase/builder @budibase/cli @budibase/client @budibase/frontend-core @budibase/pro @budibase/sdk @budibase/server @budibase/shared-core @budibase/string-templates @budibase/types @budibase/worker"
|
2023-10-03 11:02:11 +02:00
|
|
|
|
2023-10-18 14:28:05 +02:00
|
|
|
package_json_path="$1"
|
|
|
|
package_json=$(cat "$package_json_path")
|
2023-10-02 18:18:42 +02:00
|
|
|
|
2023-10-03 09:34:35 +02:00
|
|
|
process_package() {
|
2023-10-18 14:28:05 +02:00
|
|
|
pkg_path="$1"
|
|
|
|
package_json=$(cat "$pkg_path")
|
|
|
|
has_changes=false
|
2023-10-02 18:18:42 +02:00
|
|
|
|
2023-10-18 14:28:05 +02:00
|
|
|
for package_name in $packages_to_remove; do
|
2023-10-03 09:34:35 +02:00
|
|
|
if echo "$package_json" | jq -e --arg package_name "$package_name" '.dependencies | has($package_name)' > /dev/null; then
|
|
|
|
package_json=$(echo "$package_json" | jq "del(.dependencies[\"$package_name\"])")
|
|
|
|
has_changes=true
|
|
|
|
fi
|
2023-10-13 13:59:42 +02:00
|
|
|
done
|
2023-10-02 18:18:42 +02:00
|
|
|
|
2023-10-03 09:34:35 +02:00
|
|
|
if [ "$has_changes" = true ]; then
|
2023-10-18 14:28:05 +02:00
|
|
|
echo "$package_json" > "$pkg_path"
|
2023-10-02 18:18:42 +02:00
|
|
|
fi
|
2023-10-03 09:34:35 +02:00
|
|
|
}
|
2023-10-02 18:18:42 +02:00
|
|
|
|
2023-10-18 14:28:05 +02:00
|
|
|
process_package "$package_json_path"
|
2023-10-03 09:34:35 +02:00
|
|
|
|
2023-10-18 14:28:05 +02:00
|
|
|
package_json=$(cat "$package_json_path")
|
|
|
|
echo "$package_json" | jq "del(.resolutions)" > "$1"
|