mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-07-30 03:09:50 +08:00
31 lines
872 B
Bash
Executable File
31 lines
872 B
Bash
Executable File
#!/bin/bash
|
|
# Checks that sourceApiVersion in sfdx-project.json is 67.0 or higher.
|
|
# If lower, updates it to "67.0".
|
|
|
|
set -e
|
|
|
|
PROJECT_FILE="sfdx-project.json"
|
|
|
|
if [[ ! -f "$PROJECT_FILE" ]]; then
|
|
echo "ERROR: $PROJECT_FILE not found in current directory"
|
|
exit 1
|
|
fi
|
|
|
|
# Extract sourceApiVersion and check if it's below 67.0
|
|
version=$(jq -r '.sourceApiVersion // "0"' "$PROJECT_FILE")
|
|
is_below=$(jq --arg v "$version" -n '($v | split(".") | .[0] | tonumber) < 67')
|
|
|
|
if [[ "$is_below" == "true" ]]; then
|
|
echo "WARNING: sourceApiVersion is $version (< 67.0)"
|
|
echo "Updating $PROJECT_FILE to set sourceApiVersion to \"67.0\""
|
|
|
|
# Update the file
|
|
jq '.sourceApiVersion = "67.0"' "$PROJECT_FILE" > "$PROJECT_FILE.tmp"
|
|
mv "$PROJECT_FILE.tmp" "$PROJECT_FILE"
|
|
|
|
echo "OK: Updated sourceApiVersion to 67.0"
|
|
exit 0
|
|
fi
|
|
|
|
echo "OK: sourceApiVersion is $version (>= 67.0)"
|