Skip to content

Commit d6baa52

Browse files
evan-masseauclaude
andcommitted
chore: bump SDK version to 2.4.0
Also updates bump-version.sh to accept CLI arguments (-v, -a, -s, --skip-native, --skip-install) so it can run non-interactively. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 90761d0 commit d6baa52

4 files changed

Lines changed: 103 additions & 42 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<resources>
2-
<string name="klaviyo_sdk_version_override">2.3.1</string>
2+
<string name="klaviyo_sdk_version_override">2.4.0</string>
33
<string name="klaviyo_sdk_name_override">react_native</string>
44
</resources>

bump-version.sh

Lines changed: 100 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,53 @@
11
#!/bin/bash
22

3-
# Prompt for the new React SDK version
4-
read -rp "Enter the new React SDK version: " new_version
3+
set -euo pipefail
4+
5+
usage() {
6+
cat <<EOF
7+
Usage: $(basename "$0") [OPTIONS]
8+
9+
Bump SDK version numbers and update dependencies.
10+
11+
Options:
12+
-v, --version VERSION React SDK version (skips interactive prompt)
13+
-a, --android VERSION Android SDK version (skips interactive prompt)
14+
-s, --swift VERSION Swift SDK version (skips interactive prompt)
15+
--skip-native Skip native dependency bumps entirely
16+
--skip-install Skip yarn install and pod update steps
17+
-h, --help Show this help message
18+
19+
Examples:
20+
$(basename "$0") # Fully interactive (original behavior)
21+
$(basename "$0") -v 2.4.0 --skip-native # Bump RN SDK only, no native deps
22+
$(basename "$0") -v 2.4.0 -a 3.2.0 -s 4.1.0 # Bump everything non-interactively
23+
EOF
24+
exit 0
25+
}
26+
27+
new_version=""
28+
android_version=""
29+
swift_version=""
30+
skip_native=false
31+
skip_install=false
32+
33+
while [[ $# -gt 0 ]]; do
34+
case "$1" in
35+
-v|--version) new_version="$2"; shift 2 ;;
36+
-a|--android) android_version="$2"; shift 2 ;;
37+
-s|--swift) swift_version="$2"; shift 2 ;;
38+
--skip-native) skip_native=true; shift ;;
39+
--skip-install) skip_install=true; shift ;;
40+
-h|--help) usage ;;
41+
*) echo "Unknown option: $1"; usage ;;
42+
esac
43+
done
44+
45+
# --- React SDK version ---
46+
47+
if [[ -z "$new_version" ]]; then
48+
read -rp "Enter the new React SDK version: " new_version
49+
fi
550

6-
# Update SDK version in package.json
751
if [[ -f "package.json" ]]; then
852
jq --arg newVersion "$new_version" '.version = $newVersion' package.json > tmp.json && mv tmp.json package.json
953
echo "Updated SDK version in package.json."
@@ -32,35 +76,50 @@ else
3276
exit 1
3377
fi
3478

35-
# Prompt for the Android SDK version
36-
read -rp "Enter the Android SDK version: " android_version
79+
# --- Native dependencies (skippable) ---
3780

38-
# Update Android SDK version in gradle.properties
39-
gradle_properties="./android/gradle.properties"
40-
if [[ -f "$gradle_properties" ]]; then
41-
sed -i '' "s/KlaviyoReactNativeSdk_klaviyoAndroidSdkVersion=.*/KlaviyoReactNativeSdk_klaviyoAndroidSdkVersion=$android_version/" "$gradle_properties"
42-
echo "Updated Android SDK version in $gradle_properties."
81+
if [[ "$skip_native" == true ]]; then
82+
echo "Skipping native dependency updates."
4383
else
44-
echo "Error: $gradle_properties not found."
45-
exit 1
84+
# Android SDK version
85+
if [[ -z "$android_version" ]]; then
86+
read -rp "Enter the Android SDK version: " android_version
87+
fi
88+
89+
gradle_properties="./android/gradle.properties"
90+
if [[ -f "$gradle_properties" ]]; then
91+
sed -i '' "s/KlaviyoReactNativeSdk_klaviyoAndroidSdkVersion=.*/KlaviyoReactNativeSdk_klaviyoAndroidSdkVersion=$android_version/" "$gradle_properties"
92+
echo "Updated Android SDK version in $gradle_properties."
93+
else
94+
echo "Error: $gradle_properties not found."
95+
exit 1
96+
fi
97+
98+
# Swift SDK version
99+
if [[ -z "$swift_version" ]]; then
100+
read -rp "Enter the Swift SDK version: " swift_version
101+
fi
102+
103+
podspec_file="klaviyo-react-native-sdk.podspec"
104+
if [[ -f "$podspec_file" ]]; then
105+
sed -i '' "s/\"KlaviyoSwift\", \".*\"/\"KlaviyoSwift\", \"$swift_version\"/" "$podspec_file"
106+
sed -i '' "s/\"KlaviyoForms\", \".*\"/\"KlaviyoForms\", \"$swift_version\"/" "$podspec_file"
107+
sed -i '' "s/\"KlaviyoLocation\", \".*\"/\"KlaviyoLocation\", \"$swift_version\"/" "$podspec_file"
108+
echo "Updated KlaviyoSwift, KlaviyoForms, and KlaviyoLocation version in $podspec_file."
109+
else
110+
echo "Error: $podspec_file not found."
111+
exit 1
112+
fi
46113
fi
47114

48-
# Prompt for the Swift SDK version
49-
read -rp "Enter the Swift SDK version: " swift_version
115+
# --- Install steps (skippable) ---
50116

51-
# Update Swift SDK version in the podspec
52-
podspec_file="klaviyo-react-native-sdk.podspec"
53-
if [[ -f "$podspec_file" ]]; then
54-
sed -i '' "s/\"KlaviyoSwift\", \".*\"/\"KlaviyoSwift\", \"$swift_version\"/" "$podspec_file"
55-
sed -i '' "s/\"KlaviyoForms\", \".*\"/\"KlaviyoForms\", \"$swift_version\"/" "$podspec_file"
56-
sed -i '' "s/\"KlaviyoLocation\", \".*\"/\"KlaviyoLocation\", \"$swift_version\"/" "$podspec_file"
57-
echo "Updated KlaviyoSwift, KlaviyoForms, and KlaviyoLocation version in $podspec_file."
58-
else
59-
echo "Error: $podspec_file not found."
60-
exit 1
117+
if [[ "$skip_install" == true ]]; then
118+
echo "Skipping install steps."
119+
echo "All tasks completed successfully."
120+
exit 0
61121
fi
62122

63-
# Run yarn install or npm install in the example app directory
64123
example_dir="example"
65124
if [[ -d "$example_dir" ]]; then
66125
echo "Running yarn install in $example_dir..."
@@ -75,20 +134,22 @@ else
75134
exit 1
76135
fi
77136

78-
# Run bundle install and pod update in the iOS directory
79-
ios_dir="$example_dir/ios"
80-
if [[ -d "$ios_dir" ]]; then
81-
cd "$ios_dir" || exit
82-
if [[ -f "Gemfile" ]]; then
83-
echo "Running bundle install..."
84-
bundle install || { echo "Error: Failed to run bundle install."; exit 1; }
137+
# Run bundle install and pod update in the iOS directory (only if native deps were bumped)
138+
if [[ "$skip_native" == false ]]; then
139+
ios_dir="$example_dir/ios"
140+
if [[ -d "$ios_dir" ]]; then
141+
cd "$ios_dir" || exit
142+
if [[ -f "Gemfile" ]]; then
143+
echo "Running bundle install..."
144+
bundle install || { echo "Error: Failed to run bundle install."; exit 1; }
145+
fi
146+
echo "Running pod update for KlaviyoSwift, KlaviyoForms, and KlaviyoLocation..."
147+
bundle exec pod update KlaviyoSwift KlaviyoForms KlaviyoLocation || { echo "Error: Failed to update pods."; exit 1; }
148+
cd - || exit
149+
else
150+
echo "Error: $ios_dir not found."
151+
exit 1
85152
fi
86-
echo "Running pod update for KlaviyoSwift, KlaviyoForms, and KlaviyoLocation..."
87-
bundle exec pod update KlaviyoSwift KlaviyoForms KlaviyoLocation || { echo "Error: Failed to update pods."; exit 1; }
88-
cd - || exit
89-
else
90-
echo "Error: $ios_dir not found."
91-
exit 1
92153
fi
93154

94-
echo "All tasks completed successfully."
155+
echo "All tasks completed successfully."

ios/klaviyo-sdk-configuration.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
<key>klaviyo_sdk_name</key>
66
<string>react_native</string>
77
<key>klaviyo_sdk_version</key>
8-
<string>2.3.1</string>
8+
<string>2.4.0</string>
99
</dict>
1010
</plist>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "klaviyo-react-native-sdk",
3-
"version": "2.3.1",
3+
"version": "2.4.0",
44
"description": "Official Klaviyo React Native SDK",
55
"source": "./src/index.tsx",
66
"main": "./lib/module/index.js",

0 commit comments

Comments
 (0)