Remove packageNames file usages

This commit is contained in:
Adria Navarro 2023-10-13 13:59:42 +02:00
parent 543ecb8d58
commit fb1db135cf
7 changed files with 19 additions and 46 deletions

View File

@ -12,4 +12,3 @@ packages/server/scripts/
!yarn.lock
!lerna.json
!.yarnrc
!packageNames.txt

View File

@ -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

1
.gitignore vendored
View File

@ -105,4 +105,3 @@ budibase-component
budibase-datasource
*.iml
packageNames.txt

View File

@ -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

View File

@ -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 .

View File

@ -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

View File

@ -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"