From fb1db135cf1562ebd37bfef0cd3e0604b08197ed Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 13 Oct 2023 13:59:42 +0200 Subject: [PATCH] Remove packageNames file usages --- .dockerignore | 3 +- .../workflows/release-singleimage-test.yml | 2 - .gitignore | 1 - hosting/single/Dockerfile.v2 | 1 - scripts/build-single-image.sh | 1 - scripts/generatePackageNamesFile.sh | 11 ----- scripts/removeWorkspaceDependencies.sh | 46 ++++++++----------- 7 files changed, 19 insertions(+), 46 deletions(-) delete mode 100755 scripts/generatePackageNamesFile.sh diff --git a/.dockerignore b/.dockerignore index c9233c9899..86e1f739f7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,5 +11,4 @@ packages/server/scripts/ !package.json !yarn.lock !lerna.json -!.yarnrc -!packageNames.txt \ No newline at end of file +!.yarnrc \ No newline at end of file diff --git a/.github/workflows/release-singleimage-test.yml b/.github/workflows/release-singleimage-test.yml index 579b82ed84..0dfa2bdfc5 100644 --- a/.github/workflows/release-singleimage-test.yml +++ b/.github/workflows/release-singleimage-test.yml @@ -29,8 +29,6 @@ jobs: cache: "yarn" - name: Setup QEMU uses: docker/setup-qemu-action@v3 - - name: Generate package names file - run: ./scripts/generatePackageNamesFile.sh - name: Run Yarn run: yarn - name: Run Yarn Build diff --git a/.gitignore b/.gitignore index 1c75d321d9..02e0ca300d 100644 --- a/.gitignore +++ b/.gitignore @@ -105,4 +105,3 @@ budibase-component budibase-datasource *.iml -packageNames.txt diff --git a/hosting/single/Dockerfile.v2 b/hosting/single/Dockerfile.v2 index 229c6189e7..b1abe6d53e 100644 --- a/hosting/single/Dockerfile.v2 +++ b/hosting/single/Dockerfile.v2 @@ -10,7 +10,6 @@ COPY package.json . COPY yarn.lock . COPY lerna.json . COPY .yarnrc . -COPY packageNames.txt . COPY packages/server/package.json packages/server/package.json COPY packages/worker/package.json packages/worker/package.json diff --git a/scripts/build-single-image.sh b/scripts/build-single-image.sh index 99432483e8..cb2c29deac 100755 --- a/scripts/build-single-image.sh +++ b/scripts/build-single-image.sh @@ -1,4 +1,3 @@ #!/bin/bash yarn build --scope @budibase/server --scope @budibase/worker -./scripts/generatePackageNamesFile.sh docker build -f hosting/single/Dockerfile.v2 -t budibase:latest . diff --git a/scripts/generatePackageNamesFile.sh b/scripts/generatePackageNamesFile.sh deleted file mode 100755 index e214efeacc..0000000000 --- a/scripts/generatePackageNamesFile.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -workspace_info=$(yarn --silent workspaces info) - -package_names_file="packageNames.txt" - -rm -f $package_names_file - - -packages=$(echo "$workspace_info" | jq -r 'keys[]') -echo "$packages" > $package_names_file diff --git a/scripts/removeWorkspaceDependencies.sh b/scripts/removeWorkspaceDependencies.sh index 057e433fba..627058c92a 100755 --- a/scripts/removeWorkspaceDependencies.sh +++ b/scripts/removeWorkspaceDependencies.sh @@ -1,23 +1,21 @@ #!/bin/bash - -exclude_packages=() - -while getopts "e:" opt; do - case $opt in - e) - exclude_packages+=("$OPTARG") - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument." >&2 - exit 1 - ;; - esac -done +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 + # We cannot remove string-templates yet because it cannot be bundled by esbuild as a dependency + @budibase/string-templates + @budibase/types + @budibase/worker +) root_package_json=$(cat "package.json") @@ -27,20 +25,12 @@ process_package() { local package_json=$(cat "$pkg/package.json") local has_changes=false - - - while IFS= read -r package_name; do - for exclude_package in "${exclude_packages[@]}"; do - if [ "$package_name" == "$exclude_package" ]; then - continue 2 # Skip this package and continue with the next one - fi - done - + 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 - done < "packageNames.txt" + done if [ "$has_changes" = true ]; then echo "$package_json" > "$1/package.json"