Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Open a pull request with the following changes:
2. Bump the metadata version in `platforms/swift/Sources/ShopifyCheckoutKit/MetaData.swift`.
3. Bump the podspec version in `ShopifyCheckoutKit.podspec` (at the repo root).
4. Add an entry to the top of `platforms/swift/CHANGELOG.md`.
5. If the React Native package should consume this Swift SDK release, update `checkoutKit.nativeSdkVersions.ios` in `platforms/react-native/modules/@shopify/checkout-kit-react-native/package.json` to the same version.

All Swift version declarations must match exactly. Supported release versions are `X.Y.Z` and prerelease versions are `X.Y.Z-{alpha|beta|rc}.N`.

Expand Down Expand Up @@ -133,6 +134,7 @@ Open a pull request with the following changes:

1. Bump the `versionName` in `platforms/android/lib/build.gradle`.
2. Add an entry to the top of `platforms/android/CHANGELOG.md`.
3. If the React Native package should consume this Android SDK release, update `checkoutKit.nativeSdkVersions.android` in `platforms/react-native/modules/@shopify/checkout-kit-react-native/package.json` to the same version.

Supported release versions are `X.Y.Z` and prerelease versions are `X.Y.Z-{alpha|beta|rc}.N`.

Expand All @@ -148,6 +150,21 @@ Once merged, run the [Release package workflow](../../actions/workflows/release.

## React Native (`platforms/react-native/`)

### Native SDK dependency versions

The React Native package reads its published native SDK dependency versions from `platforms/react-native/modules/@shopify/checkout-kit-react-native/package.json`:

```json
"checkoutKit": {
"nativeSdkVersions": {
"ios": "4.0.0-alpha.1",
"android": "4.0.0-alpha.1"
}
}
```

When updating the Swift or Android SDK version that React Native should consume, update the matching `checkoutKit.nativeSdkVersions` entry in this package file. These values drive `RNShopifyCheckoutKit.podspec` for iOS and the module/sample Gradle dependencies for Android, so they must stay aligned with the published native SDK versions used by the React Native release.

### Public API surface

The library's public API is tracked via a committed report at `platforms/react-native/modules/@shopify/checkout-kit-react-native/api/checkout-kit-react-native.api.md`, generated by [@microsoft/api-extractor](https://api-extractor.com/) from the bob-produced `.d.ts` files. The unified `Breaking Changes` CI workflow runs `dev rn api check` on every PR that touches React Native sources and fails if the regenerated report diverges from the committed one.
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/rn-build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ permissions:

env:
JAVA_VERSION: '22'
# TODO: remove once ShopifyCheckoutKit is published to CocoaPods trunk and
# Maven Central. Tracks the new pod/AAR name introduced by the
# ShopifyCheckoutSheetKit → ShopifyCheckoutKit rename.
USE_LOCAL_SDK: "1"

jobs:
build-android:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/rn-build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ on:
permissions:
contents: read

# TODO: remove once ShopifyCheckoutKit is published to CocoaPods trunk and
# Maven Central. Tracks the new pod/AAR name introduced by the
# ShopifyCheckoutSheetKit → ShopifyCheckoutKit rename.
env:
USE_LOCAL_SDK: "1"

jobs:
build-ios:
name: Build iOS Sample
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/rn-check-packed-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ on:
permissions:
contents: read

# TODO: remove once ShopifyCheckoutKit is published to CocoaPods trunk and
# Maven Central. Tracks the new pod/AAR name introduced by the
# ShopifyCheckoutSheetKit → ShopifyCheckoutKit rename.
env:
USE_LOCAL_SDK: "1"

jobs:
check-packed-files:
name: Check package files
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/rn-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ on:
permissions:
contents: read

# TODO: remove once ShopifyCheckoutKit is published to CocoaPods trunk and
# Maven Central. Tracks the new pod/AAR name introduced by the
# ShopifyCheckoutSheetKit → ShopifyCheckoutKit rename.
env:
USE_LOCAL_SDK: "1"

jobs:
swiftlint:
name: SwiftLint
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/rn-test-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ permissions:

env:
JAVA_VERSION: '22'
# TODO: remove once ShopifyCheckoutKit is published to CocoaPods trunk and
# Maven Central. Tracks the new pod/AAR name introduced by the
# ShopifyCheckoutSheetKit → ShopifyCheckoutKit rename.
USE_LOCAL_SDK: "1"

jobs:
test-android:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/rn-test-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ on:
permissions:
contents: read

# TODO: remove once ShopifyCheckoutKit is published to CocoaPods trunk and
# Maven Central. Tracks the new pod/AAR name introduced by the
# ShopifyCheckoutSheetKit → ShopifyCheckoutKit rename.
env:
USE_LOCAL_SDK: "1"

jobs:
test-ios:
name: Run iOS Tests
Expand Down
2 changes: 1 addition & 1 deletion platforms/react-native/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ USE_LOCAL_SDK=1 dev rn android

### CI

CI uses the default (published) path naturally — no special flag handling. As defense-in-depth, the build wiring still ignores `USE_LOCAL_SDK=1` when the `CI` env var is set (GitHub Actions sets `CI=true` automatically).
CI uses the default (published) path naturally — no special flag handling. Keep `USE_LOCAL_SDK=1` scoped to local development or explicit validation against unreleased native SDK changes.

### Gotchas

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))
ios_native_sdk_version = package.dig("checkoutKit", "nativeSdkVersions", "ios")

raise "checkoutKit.nativeSdkVersions.ios is required in package.json" if ios_native_sdk_version.to_s.empty?

Pod::Spec.new do |s|
s.name = "RNShopifyCheckoutKit"
Expand Down Expand Up @@ -28,8 +31,8 @@ Pod::Spec.new do |s|
s.dependency "ShopifyCheckoutKit"
s.dependency "ShopifyCheckoutKit/AcceleratedCheckouts"
else
s.dependency "ShopifyCheckoutKit", "~> 0.0.0"
s.dependency "ShopifyCheckoutKit/AcceleratedCheckouts", "~> 0.0.0"
s.dependency "ShopifyCheckoutKit", "~> #{ios_native_sdk_version}"
s.dependency "ShopifyCheckoutKit/AcceleratedCheckouts", "~> #{ios_native_sdk_version}"
end

install_modules_dependencies(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,24 @@ android {
}


def useLocalSdk = (System.getenv("USE_LOCAL_SDK") ?: "0") == "1"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth adding this to dev.yml commands?

Probably the best default to use for local dev?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is part of the dev.yml commands

image.png

dev rn android --local will give you local maven

By default I think local being false is safer and less confusing
Most react-native code will want writing/integrating against the released maven/cocoapods to match local with CI

The --local flag is an opt in to the workflow of "I'm working on a swift/android change and I want to test in react-native before releasing" e.g. what we did with prototype/development and during this migration
I don't think this is the default case though, and can be slightly more confusing / trip people up

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok sounds good

def packageJsonFile = file("../package.json")
def packageJson = new groovy.json.JsonSlurper().parse(packageJsonFile)
def shopifySdkVersion = packageJson.checkoutKit?.nativeSdkVersions?.android as String

if (shopifySdkVersion == null || shopifySdkVersion.trim().isEmpty()) {
throw new GradleException("checkoutKit.nativeSdkVersions.android is required in ${packageJsonFile}")
}

def shopifySdkArtifact = "com.shopify:checkout-kit:$shopifySdkVersion"

repositories {
mavenLocal()
mavenCentral()
google()
}


def useLocalSdk = (System.getenv("USE_LOCAL_SDK") ?: "0") == "1"
def shopifySdkArtifact = useLocalSdk
? "com.shopify:checkout-kit:4.0.0-alpha.1"
: "com.shopify:checkout-kit:0.0.0"

dependencies {
// For < 0.71, this will be from the local maven repo
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"checkoutKit": {
"nativeSdkVersions": {
"ios": "4.0.0-alpha.1",
"android": "4.0.0-alpha.1"
}
},
"scripts": {
"clean": "rm -rf lib",
"build": "bob build",
Expand Down
13 changes: 9 additions & 4 deletions platforms/react-native/sample/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,15 @@ android {
}
}

def useLocalSdk = (System.getenv("USE_LOCAL_SDK") ?: "0") == "1"
def shopifySdkArtifact = useLocalSdk
? "com.shopify:checkout-kit:4.0.0-alpha.1"
: "com.shopify:checkout-kit:0.0.0"
def checkoutKitPackageJsonFile = rootProject.file("../../modules/@shopify/checkout-kit-react-native/package.json")
def checkoutKitPackageJson = new groovy.json.JsonSlurper().parse(checkoutKitPackageJsonFile)
def shopifySdkVersion = checkoutKitPackageJson.checkoutKit?.nativeSdkVersions?.android as String

if (shopifySdkVersion == null || shopifySdkVersion.trim().isEmpty()) {
throw new GradleException("checkoutKit.nativeSdkVersions.android is required in ${checkoutKitPackageJsonFile}")
}

def shopifySdkArtifact = "com.shopify:checkout-kit:$shopifySdkVersion"

dependencies {
// The version of react-native is set by the React Native Gradle Plugin
Expand Down
13 changes: 5 additions & 8 deletions platforms/react-native/sample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2605,8 +2605,8 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- ShopifyCheckoutKit
- ShopifyCheckoutKit/AcceleratedCheckouts
- ShopifyCheckoutKit (~> 4.0.0-alpha.1)
- ShopifyCheckoutKit/AcceleratedCheckouts (~> 4.0.0-alpha.1)
- SocketRocket
- Yoga
- RNVectorIcons (10.3.0):
Expand Down Expand Up @@ -2732,13 +2732,12 @@ DEPENDENCIES:
- RNScreens (from `../../node_modules/react-native-screens`)
- "RNShopifyCheckoutKit (from `../../modules/@shopify/checkout-kit-react-native`)"
- RNVectorIcons (from `../../node_modules/react-native-vector-icons`)
- ShopifyCheckoutKit (from `../../../../`)
- ShopifyCheckoutKit/AcceleratedCheckouts (from `../../../../`)
- SocketRocket (~> 0.7.1)
- Yoga (from `../../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
trunk:
- ShopifyCheckoutKit
- SocketRocket

EXTERNAL SOURCES:
Expand Down Expand Up @@ -2911,8 +2910,6 @@ EXTERNAL SOURCES:
:path: "../../modules/@shopify/checkout-kit-react-native"
RNVectorIcons:
:path: "../../node_modules/react-native-vector-icons"
ShopifyCheckoutKit:
:path: "../../../../"
Yoga:
:path: "../../node_modules/react-native/ReactCommon/yoga"

Expand Down Expand Up @@ -2999,9 +2996,9 @@ SPEC CHECKSUMS:
RNGestureHandler: eeb622199ef1fb3a076243131095df1c797072f0
RNReanimated: 237d420b7bb4378ef1dacc7d7a5c674fddb4b5d2
RNScreens: 3fc29af06302e1f1c18a7829fe57cbc2c0259912
RNShopifyCheckoutKit: 554996990cd493b49bc64e8f4a42bea4266e5a2d
RNShopifyCheckoutKit: 23f4881a5a839cc7b5e0840ccfec3b317c3c3bd6
RNVectorIcons: be4d047a76ad307ffe54732208fb0498fcb8477f
ShopifyCheckoutKit: 86b4e0976e98b17dc0a1de0399ec5a0a4f8171b5
ShopifyCheckoutKit: ffd719db529ac48907536d855182d7c57c85659f
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: a742cc68e8366fcfc681808162492bc0aa7a9498

Expand Down
2 changes: 1 addition & 1 deletion platforms/react-native/scripts/publish_android_snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ ANDROID_SDK_PATH="$SCRIPT_DIR/../../android"

cd "$ANDROID_SDK_PATH"
./gradlew :lib:publishToMavenLocal -q
echo "publish_android_snapshot: published com.shopify:checkout-kit:4.0.0-alpha.1 to ~/.m2/"
echo "publish_android_snapshot: published com.shopify:checkout-kit to ~/.m2/"
Loading