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
80 changes: 78 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: npm
Expand All @@ -31,6 +31,34 @@ jobs:
- name: Run tests
run: npm test

validate-versions:
name: Validate Versions
runs-on: aws-runner-set
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc

- name: Verify conektaElements config in package.json
run: |
node -e "
const pkg = require('./package.json');
if (!pkg.conektaElements?.version) {
console.error('Error: conektaElements.version missing in package.json');
process.exit(1);
}
if (!pkg.conektaElements?.iosChecksum) {
console.error('Error: conektaElements.iosChecksum missing in package.json');
process.exit(1);
}
console.log('conektaElements.version:', pkg.conektaElements.version);
console.log('conektaElements.iosChecksum:', pkg.conektaElements.iosChecksum);
"

validate-package:
name: Validate Package
runs-on: aws-runner-set
Expand All @@ -39,7 +67,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: npm
Expand All @@ -49,3 +77,51 @@ jobs:

- name: Validate package contents
run: npm pack --dry-run

validate-android:
name: Validate Android
runs-on: aws-runner-set
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17

- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4

- name: Validate build configuration
working-directory: android
run: ./gradlew tasks --no-daemon
Comment thread
fcarrero marked this conversation as resolved.

- name: Validate dependency resolution
working-directory: android
run: ./gradlew dependencies --configuration releaseRuntimeClasspath --no-daemon

validate-ios:
name: Validate iOS
runs-on: aws-runner-set
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Verify podspec exists
run: |
if [ ! -f ConektaElements.podspec ]; then
echo "Error: ConektaElements.podspec not found"
exit 1
fi
echo "ConektaElements.podspec found"

- name: Verify iOS source files exist
run: |
FILES=$(find ios -type f \( -name "*.swift" -o -name "*.m" -o -name "*.h" \) | wc -l)
echo "Found $FILES iOS source file(s)"
if [ "$FILES" -eq 0 ]; then
echo "Error: No iOS source files found in ios/"
exit 1
fi
32 changes: 11 additions & 21 deletions ConektaElements.podspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
require 'json'

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
elements = package['conektaElements']

Pod::Spec.new do |s|
s.name = "ConektaElements"
s.version = "0.0.1-beta.12"
s.version = package['version']
s.summary = "React Native wrapper for Conekta Elements Compose UI"
s.homepage = "https://github.com/conekta/conekta-elements"
s.homepage = "https://github.com/conekta/conekta-elements-react-native"
s.license = { :type => "MIT" }
s.author = { "Conekta" => "engineering@conekta.com" }
s.source = { :git => "https://github.com/conekta/conekta-elements-react-native.git", :tag => s.version }
Expand All @@ -12,27 +17,12 @@ Pod::Spec.new do |s|

s.dependency "React-Core"

# Downloads the xcframework from a private GitHub release.
# Requires ~/.netrc with GitHub credentials before running pod install:
#
# printf "machine api.github.com login <user> password <token>\nmachine github.com login <user> password <token>\n" >> ~/.netrc
# chmod 600 ~/.netrc
#
s.prepare_command = <<-CMD
ASSET_URL=$(curl -s --netrc \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/conekta/conekta-elements/releases/latest" \
| grep -o '"url":"[^"]*composeKit\.xcframework\.zip[^"]*"' \
| head -1 \
| sed 's/"url":"//;s/"//')
if [ -z "$ASSET_URL" ]; then
echo "error: Could not find composeKit.xcframework.zip. Check ~/.netrc credentials."
exit 1
fi
curl -L --netrc \
-H "Accept: application/octet-stream" \
"$ASSET_URL" \
set -e
curl -L \
"https://github.com/conekta/conekta-elements/releases/download/#{elements['version']}/composeKit.xcframework.zip" \
-o composeKit.xcframework.zip
echo "#{elements['iosChecksum']} composeKit.xcframework.zip" | shasum -a 256 -c -
unzip -o composeKit.xcframework.zip
rm composeKit.xcframework.zip
CMD
Comment thread
fcarrero marked this conversation as resolved.
Expand Down
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ React Native wrapper for [Conekta Elements](https://github.com/conekta/conekta-e

## Installation

This package is published to GitHub Packages. First, configure your `.npmrc` to use the GitHub registry for the `@conekta` scope:
This package is published to GitHub Packages. Configure your `.npmrc` to use the GitHub registry for the `@conekta` scope:

```
@conekta:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
```

Then install:
Expand All @@ -31,11 +30,11 @@ npm install @conekta/conekta-elements-react-native
cd ios && pod install
```

`pod install` descarga automáticamente el XCFramework de Compose desde GitHub releases.
`pod install` automatically downloads the Compose XCFramework from GitHub releases.

### Android

Autolinking registra el módulo automáticamente. No se requiere configuración adicional.
Autolinking registers the module automatically. No additional configuration is required.

## Usage

Expand Down Expand Up @@ -135,14 +134,23 @@ After that, autolinking picks up the module automatically and the library works

## Development

Clona el repo y usa la app de ejemplo:

```bash
git clone https://github.com/conekta/conekta-elements-react-native.git
cd conekta-elements-react-native

npm install
```

### Scripts

```bash
npm test # Run tests
npm run test:watch # Run tests in watch mode
npx tsc --noEmit # Type check
```

### Example app

```bash
# Android
cd example && npx react-native run-android

Expand Down
13 changes: 4 additions & 9 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
def packageJson = new groovy.json.JsonSlurper().parse(file("$projectDir/../package.json"))

buildscript {
ext.kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.kotlinVersion : '2.0.21'
ext.kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.kotlinVersion : '2.0.21'
repositories {
google()
mavenCentral()
Expand Down Expand Up @@ -42,18 +44,11 @@ android {
repositories {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/conekta/conekta-elements")
credentials {
username = System.getenv("GP_USER") ?: project.findProperty("GP_USER") ?: ""
password = System.getenv("GP_TOKEN") ?: project.findProperty("GP_TOKEN") ?: ""
}
}
}

dependencies {
// Conekta Elements with Compose UI
implementation "io.conekta:conekta-elements-compose:0.0.1-beta.8"
implementation "io.conekta:conekta-elements-compose:${packageJson.conektaElements.version}"

// React Native
implementation "com.facebook.react:react-android"
Expand Down
1 change: 1 addition & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
android.useAndroidX=true
Binary file added android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading