Skip to content

Commit 6a83eae

Browse files
committed
refactor: Fix shellcheck findings
1 parent 0ef37b4 commit 6a83eae

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

internal/documentation/scripts/downloadPackages.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ set -euo pipefail
33

44
# Constants
55
readonly UI5_CLI_PACKAGES_VERSION="next"
6-
readonly UI5_CLI_PACKAGES=($(find ../../packages/*/package.json -exec jq -r '.name' {} \;))
6+
UI5_CLI_PACKAGES=()
7+
while IFS= read -r pkg; do
8+
UI5_CLI_PACKAGES+=("$pkg")
9+
done < <(find ../../packages/*/package.json -exec jq -r '.name' {} \;)
710

811
# Directories
9-
readonly SCRIPT_DIR="$(dirname -- "$0")"
12+
SCRIPT_DIR="$(dirname -- "$0")"
13+
readonly SCRIPT_DIR
1014
readonly DOC_ROOT="${SCRIPT_DIR}/.."
1115
readonly TMP_PACKAGES_DIR="./tmp/packages"
1216

@@ -31,8 +35,9 @@ download_packages() {
3135
for package in "${UI5_CLI_PACKAGES[@]}"; do
3236
echo "Downloading and extracting $package..."
3337
npm pack "$package@$UI5_CLI_PACKAGES_VERSION" --workspaces false --quiet --pack-destination "$TMP_PACKAGES_DIR"
34-
local package_file_name="$(extract_package_file_name "$package")"
35-
rm -rf "$TMP_PACKAGES_DIR/${package}"
38+
local package_file_name
39+
package_file_name="$(extract_package_file_name "$package")"
40+
rm -rf "$TMP_PACKAGES_DIR/${package:?}"
3641
mkdir -p "$TMP_PACKAGES_DIR/${package}"
3742
tar -xzf "$TMP_PACKAGES_DIR/${package_file_name}"-*.tgz --strip-components=1 -C "$TMP_PACKAGES_DIR/${package}"
3843
rm "$TMP_PACKAGES_DIR/${package_file_name}"-*.tgz

0 commit comments

Comments
 (0)