chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
#!/bin/bash
|
||||
|
||||
get_latest_versions() {
|
||||
local result="" # Initialize an empty string to hold the results
|
||||
|
||||
for pkg in "$@"; do
|
||||
# Encode the package name for use in a URL
|
||||
encoded_pkg=$(echo "$pkg" | sed 's|/|%2F|g')
|
||||
|
||||
# Fetch the latest version of the package
|
||||
latest_version=$(curl -s "https://registry.npmjs.org/$encoded_pkg" | jq -r '.["dist-tags"].latest')
|
||||
|
||||
# Check if the latest version was found
|
||||
if [[ $latest_version != "null" && ! -z $latest_version ]]; then
|
||||
# Append the package and version to the result string, separated by '@' and spaces between packages
|
||||
result+="${pkg}@${latest_version} "
|
||||
else
|
||||
echo "Latest version for package ${pkg} could not be found." >&2
|
||||
return 1 # Optionally return an error code if a package's latest version can't be found
|
||||
fi
|
||||
done
|
||||
|
||||
# Trim the trailing space and print the result
|
||||
echo "${result% }"
|
||||
}
|
||||
|
||||
get_latest_copilotkit_versions() {
|
||||
get_latest_versions "@copilotkit/backend" "@copilotkit/react-core" "@copilotkit/react-textarea" "@copilotkit/react-ui" "@copilotkit/shared"
|
||||
}
|
||||
|
||||
get_latest_prerelease_versions() {
|
||||
local result="" # Initialize an empty string to hold the results
|
||||
local tag_part="$1" # The specific part of the tag to match
|
||||
|
||||
# Shift the arguments so $@ contains the packages
|
||||
shift
|
||||
|
||||
for pkg in "$@"; do
|
||||
# Encode the package name for use in a URL
|
||||
encoded_pkg=$(echo "$pkg" | sed 's|/|%2F|g')
|
||||
|
||||
# Fetch the list of all versions
|
||||
versions=$(curl -s "https://registry.npmjs.org/$encoded_pkg" | jq -r '.versions | keys[]')
|
||||
|
||||
# Filter versions that match the tag part and get the last one
|
||||
latest_prerelease_version=$(echo "$versions" | grep "$tag_part" | tail -n 1)
|
||||
|
||||
# Check if a version was found
|
||||
if [[ ! -z $latest_prerelease_version ]]; then
|
||||
# Append the package and version to the result string, separated by '@' and spaces between packages
|
||||
result+="${pkg}@${latest_prerelease_version} "
|
||||
else
|
||||
echo "Latest pre-release version matching '$tag_part' for package ${pkg} could not be found." >&2
|
||||
fi
|
||||
done
|
||||
|
||||
# Trim the trailing space and print the result
|
||||
echo "${result% }"
|
||||
}
|
||||
|
||||
get_latest_copilotkit_prerelase_versions() {
|
||||
get_latest_prerelease_versions $1 "@copilotkit/runtime" "@copilotkit/react-core" "@copilotkit/react-textarea" "@copilotkit/react-ui" "@copilotkit/shared"
|
||||
}
|
||||
|
||||
use_local_packages() {
|
||||
echo "Building local packages..."
|
||||
pnpm -w freshbuild
|
||||
echo "Done building local packages."
|
||||
packages="file:$(pwd)/packages/runtime file:$(pwd)/packages/react-core file:$(pwd)/packages/react-textarea file:$(pwd)/packages/react-ui file:$(pwd)/packages/shared"
|
||||
}
|
||||
|
||||
yarn_install_packages() {
|
||||
local app_path="$1"
|
||||
|
||||
if [ -z "$packages" ]; then
|
||||
use_local_packages;
|
||||
fi
|
||||
|
||||
(cd "$app_path" && yarn add $packages)
|
||||
|
||||
info "Package manager: yarn"
|
||||
info "Using CopilotKit packages: $packages"
|
||||
}
|
||||
|
||||
npm_install_packages() {
|
||||
local app_path="$1"
|
||||
|
||||
if [ -z "$packages" ]; then
|
||||
use_local_packages;
|
||||
fi
|
||||
|
||||
(cd "$app_path" && npm install $packages --save)
|
||||
info "Package manager: npm"
|
||||
info "Using CopilotKit packages: $packages"
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
source scripts/qa/lib/bash/qa.sh
|
||||
source scripts/qa/lib/bash/packages.sh
|
||||
|
||||
prerelease_tag="$1"
|
||||
packages=""
|
||||
|
||||
if [ -n "$prerelease_tag" ]; then
|
||||
echo "Fetching pre-release CopilotKit packages..."
|
||||
packages=$(get_latest_copilotkit_prerelase_versions "$prerelease_tag")
|
||||
echo "Pre-release CopilotKit packages: $packages"
|
||||
fi
|
||||
|
||||
if [ -z "$packages" ]; then
|
||||
echo "No pre-release CopilotKit packages provided."
|
||||
read -p "Enter package names separated by space or Enter to install local packages: " packages
|
||||
fi
|
||||
|
||||
if [ -z "$packages" ]; then
|
||||
echo "Installing local packages..."
|
||||
else
|
||||
echo "Installing packages: $packages"
|
||||
fi
|
||||
|
||||
# only prompt for openai key if it is not set already
|
||||
if [ -z "$OPENAI_API_KEY" ]; then
|
||||
read -p "Enter OpenAI API key: " OPENAI_API_KEY
|
||||
else
|
||||
# Extract the first 5 characters of the API key
|
||||
key_start=${OPENAI_API_KEY:0:5}
|
||||
# Calculate the number of asterisks to print based on the key length
|
||||
num_asterisks=$((${#OPENAI_API_KEY}-5))
|
||||
asterisks=$(printf '%*s' "$num_asterisks" '' | tr ' ' '*')
|
||||
echo "Using existing OPENAI_API_KEY: $key_start$asterisks"
|
||||
fi
|
||||
|
||||
pid1=0
|
||||
pid2=0
|
||||
pid3=0
|
||||
|
||||
cleanup() {
|
||||
if [ $pid1 -ne 0 ]; then
|
||||
kill -9 $pid1 2>/dev/null || true
|
||||
fi
|
||||
if [ $pid2 -ne 0 ]; then
|
||||
kill -9 $pid2 2>/dev/null || true
|
||||
fi
|
||||
if [ $pid3 -ne 0 ]; then
|
||||
kill -9 $pid3 2>/dev/null || true
|
||||
fi
|
||||
killall next-server 2>/dev/null || true
|
||||
}
|
||||
|
||||
# Trap Ctrl+C (INT signal) and exit
|
||||
trap "echo 'Script interrupted.'; cleanup; exit" INT
|
||||
trap "cleanup" EXIT
|
||||
|
||||
# Exit on any error
|
||||
set -e
|
||||
|
||||
# record the current date + time
|
||||
info "Test started at $(date)"
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the current date in YYYY-MM-DD format
|
||||
current_date=$(date +%Y-%m-%d)
|
||||
|
||||
# Define the file path with the current date
|
||||
file_path="/tmp/qa-${current_date}.txt"
|
||||
|
||||
prompt() {
|
||||
local prompt="$1"
|
||||
local user_input
|
||||
|
||||
while true; do
|
||||
# Display the prompt to the user and read a single character input
|
||||
read -p "$prompt (y/n): " -n 1 user_input
|
||||
echo # Move to a new line
|
||||
|
||||
# Check the user input and append the prompt to the file with the appropriate emoji
|
||||
if [[ $user_input == "y" ]]; then
|
||||
echo -e "✅ $prompt" >> "$file_path" # Green checkmark emoji
|
||||
break
|
||||
elif [[ $user_input == "n" ]]; then
|
||||
echo -e "❌ $prompt" >> "$file_path" # Red X emoji
|
||||
break
|
||||
else
|
||||
echo "Invalid input. Please enter 'y' or 'n'."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
info() {
|
||||
local info_msg="$1"
|
||||
# Append the string to the file with the information emoji
|
||||
echo -e "📢 $info_msg" >> "$file_path"
|
||||
}
|
||||
|
||||
fail() {
|
||||
local fail_msg="$1"
|
||||
# Append the string to the file with the information emoji
|
||||
echo -e "❌ $fail_msg" >> "$file_path"
|
||||
}
|
||||
|
||||
succeed() {
|
||||
local success_msg="$1"
|
||||
# Append the string to the file with the information emoji
|
||||
echo -e "✅ $success_msg" >> "$file_path"
|
||||
}
|
||||
Reference in New Issue
Block a user