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

@ -11,5 +11,4 @@ packages/server/scripts/
!package.json !package.json
!yarn.lock !yarn.lock
!lerna.json !lerna.json
!.yarnrc !.yarnrc
!packageNames.txt

View File

@ -29,8 +29,6 @@ jobs:
cache: "yarn" cache: "yarn"
- name: Setup QEMU - name: Setup QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
- name: Generate package names file
run: ./scripts/generatePackageNamesFile.sh
- name: Run Yarn - name: Run Yarn
run: yarn run: yarn
- name: Run Yarn Build - name: Run Yarn Build

1
.gitignore vendored
View File

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

View File

@ -10,7 +10,6 @@ COPY package.json .
COPY yarn.lock . COPY yarn.lock .
COPY lerna.json . COPY lerna.json .
COPY .yarnrc . COPY .yarnrc .
COPY packageNames.txt .
COPY packages/server/package.json packages/server/package.json COPY packages/server/package.json packages/server/package.json
COPY packages/worker/package.json packages/worker/package.json COPY packages/worker/package.json packages/worker/package.json

View File

@ -1,4 +1,3 @@
#!/bin/bash #!/bin/bash
yarn build --scope @budibase/server --scope @budibase/worker yarn build --scope @budibase/server --scope @budibase/worker
./scripts/generatePackageNamesFile.sh
docker build -f hosting/single/Dockerfile.v2 -t budibase:latest . 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 #!/bin/bash
packages_to_remove=(
exclude_packages=() @budibase/backend-core
@budibase/bbui
while getopts "e:" opt; do @budibase/builder
case $opt in @budibase/cli
e) @budibase/client
exclude_packages+=("$OPTARG") @budibase/frontend-core
;; @budibase/pro
\?) @budibase/sdk
echo "Invalid option: -$OPTARG" >&2 @budibase/server
exit 1 @budibase/shared-core
;; # We cannot remove string-templates yet because it cannot be bundled by esbuild as a dependency
:) @budibase/string-templates
echo "Option -$OPTARG requires an argument." >&2 @budibase/types
exit 1 @budibase/worker
;; )
esac
done
root_package_json=$(cat "package.json") root_package_json=$(cat "package.json")
@ -27,20 +25,12 @@ process_package() {
local package_json=$(cat "$pkg/package.json") local package_json=$(cat "$pkg/package.json")
local has_changes=false local has_changes=false
for package_name in "${packages_to_remove[@]}"; do
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
if echo "$package_json" | jq -e --arg package_name "$package_name" '.dependencies | has($package_name)' > /dev/null; then 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\"])") package_json=$(echo "$package_json" | jq "del(.dependencies[\"$package_name\"])")
has_changes=true has_changes=true
fi fi
done < "packageNames.txt" done
if [ "$has_changes" = true ]; then if [ "$has_changes" = true ]; then
echo "$package_json" > "$1/package.json" echo "$package_json" > "$1/package.json"