From 40fba919ec2d2deb58c773acd1b81c83555fbef0 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 16 Jan 2024 14:00:33 +0100 Subject: [PATCH] Improve script to allow running on builder/package.json --- scripts/removeWorkspaceDependencies.sh | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/scripts/removeWorkspaceDependencies.sh b/scripts/removeWorkspaceDependencies.sh index ba27ae7edc..61eee4a10d 100755 --- a/scripts/removeWorkspaceDependencies.sh +++ b/scripts/removeWorkspaceDependencies.sh @@ -3,26 +3,14 @@ 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" package_json_path="$1" -package_json=$(cat "$package_json_path") process_package() { pkg_path="$1" - package_json=$(cat "$pkg_path") - has_changes=false for package_name in $packages_to_remove; do - 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 + jq "del(.dependencies[\"$package_name\"])" $pkg_path > tmp_file.json && mv tmp_file.json $pkg_path + jq "del(.resolutions[\"$package_name\"])" $pkg_path > tmp_file.json && mv tmp_file.json $pkg_path done - - if [ "$has_changes" = true ]; then - echo "$package_json" > "$pkg_path" - fi } process_package "$package_json_path" - -package_json=$(cat "$package_json_path") -echo "$package_json" | jq "del(.resolutions)" > "$1"