Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 54 additions & 8 deletions scripts/update-package-locks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,49 @@

set -e

TARGETS=(code-editor-server code-editor-sagemaker-server code-editor-web-embedded code-editor-web-embedded-with-terminal)
ALL_TARGETS=(code-editor-server code-editor-sagemaker-server code-editor-web-embedded code-editor-web-embedded-with-terminal)

echo "Updating package-lock overrides for all targets..."
# Parse command line arguments
SELECTED_TARGETS=()
while [[ $# -gt 0 ]]; do
case "$1" in
--target)
[[ $# -ge 2 ]] || { echo "Error: --target requires a value" >&2; exit 1; }
if [[ ! -f "configuration/$2.json" ]]; then
echo "Error: Unknown target: $2" >&2
echo "Available targets: ${ALL_TARGETS[*]}" >&2
exit 1
fi
SELECTED_TARGETS+=("$2")
shift 2
;;
*)
echo "Unknown option: $1" >&2
echo "Usage: $0 [--target <target>]..." >&2
exit 1
;;
esac
done

if [[ ${#SELECTED_TARGETS[@]} -gt 0 ]]; then
TARGETS=("${SELECTED_TARGETS[@]}")
else
TARGETS=("${ALL_TARGETS[@]}")
fi

# Unified OSS attribution needs all targets prepared
RUN_ATTRIBUTION=true
for target in "${ALL_TARGETS[@]}"; do
found=false
for selected in "${TARGETS[@]}"; do
[[ "$selected" == "$target" ]] && found=true
done
if [[ "$found" == false ]]; then
RUN_ATTRIBUTION=false
fi
done

echo "Updating package-lock overrides for targets: ${TARGETS[*]}"

# Clean up any existing prepared source directories
for target in "${TARGETS[@]}"; do
Expand Down Expand Up @@ -56,13 +96,19 @@ for target in "${TARGETS[@]}"; do
echo "=== COMPLETED TARGET: $target ==="
done

# Generate unified OSS attribution
echo ""
echo "Generating unified OSS attribution..."
./scripts/generate-oss-attribution.sh --command generate_unified_oss_attribution
# Generate unified OSS attribution (requires all targets prepared)
if [[ "$RUN_ATTRIBUTION" == true ]]; then
echo ""
echo "Generating unified OSS attribution..."
./scripts/generate-oss-attribution.sh --command generate_unified_oss_attribution

# Copy LICENSE-THIRD-PARTY to root directory
cp overrides/LICENSE-THIRD-PARTY LICENSE-THIRD-PARTY
# Copy LICENSE-THIRD-PARTY to root directory
cp overrides/LICENSE-THIRD-PARTY LICENSE-THIRD-PARTY
else
echo ""
echo "Skipping unified OSS attribution: it requires all targets to be prepared."
echo "Run this script without --target, or run ./scripts/generate-oss-attribution.sh --command generate_unified_oss_attribution separately."
fi

# Clean up prepared source directories
echo "Cleaning up prepared source directories..."
Expand Down