Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade sample to React Native 76 #132

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
34 changes: 34 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const path = require('path');

const modulePath = 'modules/@shopify/checkout-sheet-kit';
const moduleAbsolutePath = path.join(__dirname, modulePath);

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: '@react-native',
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
'no-console': 'error',
},
overrides: [
// Sample app files
{
files: ['sample/**/*.ts', 'sample/**/*.tsx'],
rules: {
'no-console': 'off',
'@typescript-eslint/no-shadow': 'off',
},
},
// Module files
{
files: [
path.join(modulePath, 'src/**/*.ts'),
path.join(modulePath, 'src/**/*.tsx'),
],
parserOptions: {
project: path.join(moduleAbsolutePath, 'tsconfig.build.json'),
},
},
],
};
1 change: 1 addition & 0 deletions modules/@shopify/checkout-sheet-kit/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib
4 changes: 2 additions & 2 deletions modules/@shopify/checkout-sheet-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"clean": "rm -rf lib",
"build": "bob build",
"lint:swift": "./../../../sample/ios/Pods/SwiftLint/swiftlint --strict --quiet ios",
"lint": "yarn typecheck && eslint src",
"lint": "yarn typecheck && eslint .",
"typecheck": "tsc --noEmit"
},
"files": [
Expand Down Expand Up @@ -49,7 +49,7 @@
},
"devDependencies": {
"react-native-builder-bob": "^0.23.1",
"typescript": "^5.4.2"
"typescript": "5.5.2"
},
"react-native-builder-bob": {
"source": "src",
Expand Down
57 changes: 26 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,36 @@
"test": "jest"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "0.74.83",
"@react-native/eslint-config": "0.74.83",
"@react-native/metro-config": "0.74.83",
"@react-native/typescript-config": "0.74.83",
"@tsconfig/react-native": "^3.0.0",
"@types/jest": "^29.5.10",
"@types/react": "^18",
"@types/react-native-dotenv": "^0.2.1",
"@types/react-test-renderer": "^18.0.0",
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@babel/runtime": "^7.26.0",
"@react-native-community/cli": "15.0.0-alpha.2",
"@react-native-community/cli-platform-android": "15.0.0-alpha.2",
"@react-native-community/cli-platform-ios": "15.0.0-alpha.2",
"@react-native/babel-preset": "0.76.0",
"@react-native/eslint-config": "0.76.0",
"@react-native/metro-config": "0.76.0",
"@react-native/typescript-config": "0.76.0",
"@tsconfig/react-native": "^3.0.5",
"@types/jest": "^29.5.14",
"@types/react": "^18.3.12",
"@types/react-native-dotenv": "^0.2.2",
"@types/react-test-renderer": "^18.3.0",
"babel-jest": "^29.7.0",
"eslint": "^8.19.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.2.1",
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-native": "0.74.1",
"eslint": "^8.57.1",
"eslint-plugin-ft-flow": "^3.0.11",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"prettier": "^3.3.3",
"react": "18.3.1",
"react-native": "0.76.0",
"react-native-dotenv": "^3.4.9",
"react-native-gesture-handler": "^2.15.0",
"react-native-gesture-handler": "^2.20.2",
"react-native-gradle-plugin": "^0.71.19",
"react-test-renderer": "18.2.0",
"ts-jest": "^29.1.1",
"react-test-renderer": "18.3.1",
"ts-jest": "^29.2.5",
"turbo": "^1.10.16",
"typescript": "^5.4.2"
"typescript": "5.5.2"
},
"engines": {
"node": ">=18"
Expand All @@ -70,14 +74,5 @@
"shopify",
"checkout"
],
"eslintConfig": {
"root": true,
"extends": "@react-native",
"rules": {
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/consistent-type-imports": "error",
"no-console": "error"
}
},
Comment on lines -73 to -81
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to it's own file so it's easier to configure rules for sample + module

"packageManager": "yarn@4.4.1"
}
5 changes: 3 additions & 2 deletions sample/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

gem 'cocoapods', '>= 1.15'
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'cocoapods-check', '1.1.0'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
4 changes: 2 additions & 2 deletions sample/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ PLATFORMS
ruby

DEPENDENCIES
activesupport (>= 6.1.7.5, < 7.1.0)
cocoapods (>= 1.15)
activesupport (>= 6.1.7.5, != 7.1.0)
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
cocoapods-check (= 1.1.0)

RUBY VERSION
Expand Down
4 changes: 4 additions & 0 deletions sample/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ react {
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
hermesFlags = ["-O", "-output-source-map"]


/* Autolinking */
autolinkLibrariesWithApp()
}

/**
Expand Down
3 changes: 2 additions & 1 deletion sample/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config">
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader

class MainApplication : Application(), ReactApplication {
Expand All @@ -34,7 +35,7 @@ class MainApplication : Application(), ReactApplication {

override fun onCreate() {
super.onCreate()
SoLoader.init(this, false)
SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
Expand Down
8 changes: 4 additions & 4 deletions sample/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 23
compileSdkVersion = 34
buildToolsVersion = "35.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.22"
kotlinVersion = "1.9.24"

}
repositories {
Expand Down
4 changes: 1 addition & 3 deletions sample/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
Expand All @@ -34,7 +32,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false
newArchEnabled=true

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
Expand Down
2 changes: 1 addition & 1 deletion sample/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
6 changes: 4 additions & 2 deletions sample/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

##############################################################################
#
Expand Down Expand Up @@ -55,7 +56,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +85,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions sample/android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
5 changes: 3 additions & 2 deletions sample/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
rootProject.name = 'ReactNative'

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

include ':app'
include ':react-native-config'

Expand Down
2 changes: 1 addition & 1 deletion sample/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require Pod::Executable.execute_command('node', ['-p',
{paths: [process.argv[1]]},
)', __dir__]).strip

platform :ios, '13.4'
platform :ios, '15.1'

prepare_react_native_project!

Expand Down
Loading
Loading