Skip to content

Commit 9b71b70

Browse files
committed
chore: refresh React Native library template
1 parent 83574c9 commit 9b71b70

32 files changed

Lines changed: 2753 additions & 6805 deletions

File tree

.github/workflows/ci.yml

Lines changed: 94 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ jobs:
3333
- name: Typecheck files
3434
run: yarn typecheck
3535

36-
test:
36+
37+
build-library:
3738
runs-on: ubuntu-latest
3839

3940
steps:
@@ -43,11 +44,13 @@ jobs:
4344
- name: Setup
4445
uses: ./.github/actions/setup
4546

46-
- name: Run unit tests
47-
run: yarn test --maxWorkers=2 --coverage
47+
- name: Build package
48+
run: yarn prepare
4849

49-
build-library:
50+
expo-prebuild:
5051
runs-on: ubuntu-latest
52+
env:
53+
EXPO_WORK_DIR: ${{ github.workspace }}/.tmp/expo-prebuild
5154

5255
steps:
5356
- name: Checkout
@@ -56,8 +59,74 @@ jobs:
5659
- name: Setup
5760
uses: ./.github/actions/setup
5861

59-
- name: Build package
60-
run: yarn prepare
62+
- name: Expo prebuild smoke test
63+
run: |
64+
set -euo pipefail
65+
66+
PACKAGE_TGZ="$(npm pack --silent --ignore-scripts | tail -n1)"
67+
rm -rf "$EXPO_WORK_DIR"
68+
mkdir -p "$EXPO_WORK_DIR"
69+
70+
npx --yes create-expo-app@latest "$EXPO_WORK_DIR/app" --template blank-typescript --yes --no-install
71+
72+
cd "$EXPO_WORK_DIR/app"
73+
npm install
74+
npm install --ignore-scripts "$GITHUB_WORKSPACE/$PACKAGE_TGZ"
75+
76+
CI=1 npx expo config --json > "$EXPO_WORK_DIR/expo-config.json" 2> "$EXPO_WORK_DIR/expo-config.stderr.log" || {
77+
echo "::error::expo config failed"
78+
if [[ -f "$EXPO_WORK_DIR/expo-config.stderr.log" ]]; then
79+
echo "::group::expo config stderr"
80+
cat "$EXPO_WORK_DIR/expo-config.stderr.log"
81+
echo "::endgroup::"
82+
fi
83+
exit 1
84+
}
85+
86+
node -e "JSON.parse(require(\"node:fs\").readFileSync(process.argv[1], \"utf8\"))" "$EXPO_WORK_DIR/expo-config.json" || {
87+
echo "::error::expo config output is not valid JSON"
88+
cat "$EXPO_WORK_DIR/expo-config.json" || true
89+
exit 1
90+
}
91+
92+
CI=1 npx expo prebuild --platform android --clean --no-install 2>&1 | tee "$EXPO_WORK_DIR/prebuild.log"
93+
94+
- name: Print Expo prebuild diagnostics
95+
if: always()
96+
run: |
97+
set -euo pipefail
98+
99+
echo "::group::app.json"
100+
if [[ -f "$EXPO_WORK_DIR/app/app.json" ]]; then
101+
cat "$EXPO_WORK_DIR/app/app.json"
102+
else
103+
echo "Missing: $EXPO_WORK_DIR/app/app.json"
104+
fi
105+
echo "::endgroup::"
106+
107+
echo "::group::expo config"
108+
if [[ -f "$EXPO_WORK_DIR/expo-config.json" ]]; then
109+
cat "$EXPO_WORK_DIR/expo-config.json"
110+
else
111+
echo "Missing: $EXPO_WORK_DIR/expo-config.json"
112+
fi
113+
echo "::endgroup::"
114+
115+
- name: Upload Expo prebuild diagnostics
116+
if: always()
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: expo-prebuild-diagnostics
120+
if-no-files-found: warn
121+
path: |
122+
${{ env.EXPO_WORK_DIR }}/prebuild.log
123+
${{ env.EXPO_WORK_DIR }}/app/app.json
124+
${{ env.EXPO_WORK_DIR }}/expo-config.json
125+
${{ env.EXPO_WORK_DIR }}/expo-config.stderr.log
126+
127+
- name: Cleanup Expo prebuild workspace
128+
if: always()
129+
run: rm -rf "$EXPO_WORK_DIR"
61130

62131
build-android:
63132
runs-on: ubuntu-latest
@@ -100,6 +169,7 @@ jobs:
100169
run: |
101170
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
102171
172+
103173
- name: Cache Gradle
104174
if: env.turbo_cache_hit != 1
105175
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
@@ -121,7 +191,7 @@ jobs:
121191
runs-on: macos-latest
122192

123193
env:
124-
XCODE_VERSION: 16.4
194+
XCODE_VERSION: 26
125195
TURBO_CACHE_DIR: .turbo/ios
126196
RCT_USE_RN_DEP: 1
127197
RCT_USE_PREBUILT_RNCORE: 1
@@ -171,4 +241,20 @@ jobs:
171241
172242
- name: Build example for iOS
173243
run: |
174-
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
244+
set -euo pipefail
245+
IOS_BUILD_LOG="$RUNNER_TEMP/ios-build.log"
246+
if ! yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" 2>&1 | tee "$IOS_BUILD_LOG"; then
247+
echo "::group::First iOS errors"
248+
grep -nE " error: |fatal error:|Command PhaseScriptExecution failed|No such file|cannot find type " \
249+
"$IOS_BUILD_LOG" | head -n 80 || true
250+
echo "::endgroup::"
251+
exit 1
252+
fi
253+
254+
- name: Upload iOS build log
255+
if: always()
256+
uses: actions/upload-artifact@v4
257+
with:
258+
name: ios-build-log
259+
if-no-files-found: warn
260+
path: ${{ runner.temp }}/ios-build.log

.github/workflows/manual-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- uses: actions/setup-node@v4
1515
with:
16-
node-version: 22
16+
node-version: 24
1717
registry-url: 'https://registry.npmjs.org'
1818
cache: 'yarn'
1919
- run: corepack enable

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup Node.js (with Corepack/Yarn)
2222
uses: actions/setup-node@v4
2323
with:
24-
node-version: 22
24+
node-version: 24
2525
registry-url: 'https://registry.npmjs.org'
2626
cache: 'yarn'
2727
- run: corepack enable

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v22.20.0
1+
v24.13.0

CHANGELOG.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Releases
2+
3+
---
4+
5+
## v6.3.2: React Native 0.85 template refresh
6+
7+
This release refreshes the project scaffold and example app to the latest `create-react-native-library` template. The public CookieManager API and native cookie behavior are unchanged.
8+
9+
### Compatibility
10+
11+
- JavaScript API remains compatible with `@react-native-cookies/cookies`.
12+
- Android minimum SDK remains `24` (Android 7.0).
13+
- React Native development and example app baseline updated to `0.85.0`.
14+
- React development baseline updated to `19.2.3`.
15+
- Old Architecture compatibility remains available for older React Native versions that still support it.
16+
- Old Architecture support is deprecated and will be removed in a future major release.
17+
18+
### Android
19+
20+
- Updated the example Android project to the current React Native 0.85 template.
21+
- Updated example Gradle wrapper to `9.3.1`.
22+
- Updated library Android defaults to `compileSdkVersion 36` and `targetSdkVersion 36`.
23+
- Moved library Android default versions into `android/build.gradle` and removed the separate library `android/gradle.properties`.
24+
- Migrated Android lint configuration from `lintOptions` to `lint`.
25+
- Kept the native Kotlin CookieManager implementation and JS API behavior unchanged.
26+
27+
### iOS
28+
29+
- Updated the example iOS project and pods for React Native 0.85.
30+
- Enabled React Native prebuilt dependencies in CI for faster iOS builds.
31+
- Preserved the existing Swift/Objective-C CookieManager implementation and bridge exports.
32+
33+
### Tooling and CI
34+
35+
- Updated `create-react-native-library` metadata from `0.55.1` to `0.62.0`.
36+
- Updated Node tooling to Node 24 in `.nvmrc` and publish workflows.
37+
- Updated TypeScript, ESLint, Prettier, Turbo, and Bob dependencies to match the refreshed template.
38+
- Added an Expo Android prebuild smoke test to CI.
39+
- Added iOS build log upload on CI failures for easier diagnostics.
40+
- Removed Jest, Lefthook, Commitlint, and Release It from the local template tooling.
41+
42+
---
43+
44+
## v6.3.1: iOS subdomain cookie fix + regression tests
45+
46+
This release fixes iOS cookie domain handling issues affecting WebView and subdomains.
47+
48+
### Fixed (iOS)
49+
50+
- Preserve leading-dot domains when setting cookies on iOS (`.example.com`).
51+
- Validate domains without mutating the original cookie domain value.
52+
- Use consistent domain matching for WebKit cookie reads (`get(url, true)`).
53+
- import RCTBridgeModule only for old architecture builds to avoid architecture-specific integration issues.
54+
55+
### Tests and CI
56+
57+
- Added Swift regression tests for domain normalization, validation, and subdomain matching.
58+
- Added `swift test` execution in the macOS CI pipeline.
59+
60+
### Example app
61+
62+
- Added manual domain input flow for cookie testing.
63+
- Each new submission adds a new cookie and refreshes available cookies from shared/WebKit stores.
64+
65+
Fixes #2
66+
67+
---
68+
69+
## v6.3.0 – Full TurboModule Rewrite (Swift/Kotlin, NA-Ready)
70+
71+
- Rebuilt CookieManager as a TurboModule with Swift (iOS) and Kotlin (Android) native implementations; JS API stays compatible (set/get etc.).
72+
- Renamed native methods to setCookie/getCookies to avoid Android codegen clashes; old-arch bridge exports added on iOS to match.
73+
- Android: cleaned up legacy CookieSyncManager path (minSdk 24), suppressed deprecation noise.
74+
- iOS: unified bridge import of CookieManager-Swift.h; supports both old and new arch from a single module.
75+
- Docs: expanded README (install via yarn/npm/bun + pod install, WebKit guidance, cookie shape, usage with try/catch)
76+
- Old architecture support kept intact on both platforms (iOS bridge exports and Android module still work with the classic architecture).

CONTRIBUTING.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -75,36 +75,6 @@ To fix formatting errors, run the following:
7575
yarn lint --fix
7676
```
7777

78-
Remember to add tests for your change if possible. Run the unit tests by:
79-
80-
```sh
81-
yarn test
82-
```
83-
84-
85-
### Commit message convention
86-
87-
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
88-
89-
- `fix`: bug fixes, e.g. fix crash due to deprecated method.
90-
- `feat`: new features, e.g. add new method to the module.
91-
- `refactor`: code refactor, e.g. migrate from class components to hooks.
92-
- `docs`: changes into documentation, e.g. add usage example for the module.
93-
- `test`: adding or updating tests, e.g. add integration tests using detox.
94-
- `chore`: tooling changes, e.g. change CI config.
95-
96-
Our pre-commit hooks verify that your commit message matches this format when committing.
97-
98-
99-
### Publishing to npm
100-
101-
We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.
102-
103-
To publish new versions, run the following:
104-
105-
```sh
106-
yarn release
107-
```
10878

10979

11080
### Scripts
@@ -114,7 +84,6 @@ The `package.json` file contains various scripts for common tasks:
11484
- `yarn`: setup project by installing dependencies.
11585
- `yarn typecheck`: type-check files with TypeScript.
11686
- `yarn lint`: lint files with [ESLint](https://eslint.org/).
117-
- `yarn test`: run unit tests with [Jest](https://jestjs.io/).
11887
- `yarn example start`: start the Metro server for the example app.
11988
- `yarn example android`: run the example app on Android.
12089
- `yarn example ios`: run the example app on iOS.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 Preeternal
3+
Copyright (c) 2026 Preeternal
44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal
66
in the Software without restriction, including without limitation the rights

android/build.gradle

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
buildscript {
2-
ext.getExtOrDefault = {name ->
3-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['CookieManager_' + name]
2+
ext.CookieManager = [
3+
kotlinVersion: "2.0.21",
4+
minSdkVersion: 24,
5+
compileSdkVersion: 36,
6+
targetSdkVersion: 36
7+
]
8+
9+
ext.getExtOrDefault = { prop ->
10+
if (rootProject.ext.has(prop)) {
11+
return rootProject.ext.get(prop)
12+
}
13+
14+
return CookieManager[prop]
415
}
516

617
repositories {
@@ -21,18 +32,14 @@ apply plugin: "kotlin-android"
2132

2233
apply plugin: "com.facebook.react"
2334

24-
def getExtOrIntegerDefault(name) {
25-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["CookieManager_" + name]).toInteger()
26-
}
27-
2835
android {
2936
namespace "com.preeternal.reactnativecookiemanager"
3037

31-
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
38+
compileSdkVersion getExtOrDefault("compileSdkVersion")
3239

3340
defaultConfig {
34-
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
35-
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
41+
minSdkVersion getExtOrDefault("minSdkVersion")
42+
targetSdkVersion getExtOrDefault("targetSdkVersion")
3643
}
3744

3845
buildFeatures {
@@ -45,33 +52,16 @@ android {
4552
}
4653
}
4754

48-
lintOptions {
55+
lint {
4956
disable "GradleCompatible"
5057
}
5158

5259
compileOptions {
5360
sourceCompatibility JavaVersion.VERSION_1_8
5461
targetCompatibility JavaVersion.VERSION_1_8
5562
}
56-
57-
sourceSets {
58-
main {
59-
java.srcDirs += [
60-
"generated/java",
61-
"generated/jni"
62-
]
63-
}
64-
}
6563
}
6664

67-
repositories {
68-
mavenCentral()
69-
google()
70-
}
71-
72-
def kotlin_version = getExtOrDefault("kotlinVersion")
73-
7465
dependencies {
7566
implementation "com.facebook.react:react-android"
76-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
7767
}

android/gradle.properties

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)