Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
f5f4e66
chore: add prettier baseline config and scripts
thisislvca Feb 9, 2026
4962a2d
style: format native event observer line break in iOS module
thisislvca Feb 9, 2026
6c9e0fc
chore: standardize local dev scripts on bun
thisislvca Feb 9, 2026
0be7461
chore: fix stale example paths after apps migration
thisislvca Feb 9, 2026
51f5ea5
chore(format): apply prettier baseline and align formatting outputs
thisislvca Feb 9, 2026
e3506e9
chore: fix lint warnings in example screens
thisislvca Feb 9, 2026
67a7ce7
chore(devx): move iOS tests to package harness and switch example to …
thisislvca Feb 9, 2026
2197301
chore: avoid prettier bin shadowing from expo-module-scripts
thisislvca Feb 9, 2026
7340f48
chore: untrack generated example targets and align swiftlint paths
thisislvca Feb 9, 2026
030ab36
fix: exclude iOS test harness files from pod sources
thisislvca Feb 9, 2026
eb099e9
chore: refine env example and ignore test harness artifacts
thisislvca Feb 9, 2026
f109bf6
test(ci): split runtime/plugin jest flows and stabilize iOS harness e…
thisislvca Feb 9, 2026
76034f1
docs: update contributing references and formatting note
thisislvca Feb 9, 2026
d9ad357
fix: address stability sweep pre-merge findings
thisislvca Feb 9, 2026
b2c8a66
fix(test): disable jest watch mode in package test script
thisislvca Feb 9, 2026
02ada65
chore(npm): exclude compiled test artifacts from package
thisislvca Feb 9, 2026
2fda15f
chore(npm): keep published artifact aligned with current target metad…
thisislvca Feb 9, 2026
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
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
root: true,
extends: ['universe/native', 'universe/web'],
ignorePatterns: ['build'],
extends: ["universe/native", "universe/web"],
ignorePatterns: ["build"],
};
24 changes: 13 additions & 11 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,43 @@ on:
workflow_dispatch:
inputs:
description:
description: 'Description'
description: "Description"
required: false
type: string
release_type:
description: 'Release Type'
description: "Release Type"
required: true
default: 'patch'
default: "patch"
type: choice
options:
- 'patch'
- 'minor'
- 'major'
- "patch"
- "minor"
- "major"

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- run: bun install

- run: bun lint

- run: bun typecheck

- run: bun run test

publish-to-npm:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4

- uses: oven-sh/setup-bun@v2
Expand Down Expand Up @@ -90,4 +92,4 @@ jobs:
with:
name: ${{ env.versionTag }} ${{ github.event.inputs.description }}
tag_name: ${{ env.versionTag }}
generate_release_notes: true
generate_release_notes: true
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
Expand All @@ -21,6 +21,6 @@ jobs:
cd packages/react-native-device-activity
bun run build
bun run prepublishOnly

- name: Publish preview
run: bunx pkg-pr-new@latest publish './packages/*'
run: bunx pkg-pr-new@latest publish './packages/*'
45 changes: 27 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ jobs:

- run: bun typecheck

test-js:
name: JS Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- run: bun install

- run: bun run test

typecheck-example:
name: Typecheck (example project)
runs-on: ubuntu-latest
Expand Down Expand Up @@ -98,11 +113,11 @@ jobs:

- run: bun install

- run: bunx expo prebuild
- run: bun run prebuild
working-directory: apps/example

swift-lint:
name: SwiftLint (example project)
name: SwiftLint (iOS harness)
runs-on: macos-latest
timeout-minutes: 10
steps:
Expand All @@ -114,20 +129,20 @@ jobs:

- uses: actions/cache@v4
with:
path: example/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock') }}
path: packages/react-native-device-activity/ios/TestHarness/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-device-activity/ios/TestHarness/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-

- run: bun install

- run: pod install
working-directory: apps/example/ios
working-directory: packages/react-native-device-activity/ios/TestHarness

- run: apps/example/ios/Pods/SwiftLint/swiftlint lint
- run: packages/react-native-device-activity/ios/TestHarness/Pods/SwiftLint/swiftlint lint --config .swiftlint.yml

swift-test:
name: Swift Test (example project)
name: Swift Test (iOS harness)
runs-on: macos-latest
timeout-minutes: 25
steps:
Expand All @@ -143,14 +158,10 @@ jobs:

- run: bun install

- name: Start bundler
run: bun start &
working-directory: apps/example

- uses: actions/cache@v4
with:
path: example/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock') }}
path: packages/react-native-device-activity/ios/TestHarness/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-device-activity/ios/TestHarness/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-

Expand All @@ -172,9 +183,7 @@ jobs:
run: swift --version

- run: pod install
working-directory: apps/example/ios

- run: cp .swiftlint.yml apps/example/ios
working-directory: packages/react-native-device-activity/ios/TestHarness

- run: xcodebuild test -workspace reactnativedeviceactivityexample.xcworkspace -scheme Tests -allowProvisioningUpdates -destination "platform=iOS Simulator,OS=latest,name=iPhone 17"
working-directory: apps/example/ios
- run: xcodebuild test -workspace reactnativedeviceactivityexample.xcworkspace -scheme Tests -destination "platform=iOS Simulator,OS=latest,name=iPhone 17"
working-directory: packages/react-native-device-activity/ios/TestHarness
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ project.xcworkspace
local.properties
android.iml

# Example native output (CNG)
apps/example/ios/
apps/example/android/
apps/example/targets/

# Cocoapods
#
example/ios/Pods
apps/example/ios/Pods

# Ruby
example/vendor/
apps/example/vendor/

# node.js
#
Expand Down
5 changes: 3 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
swift format -i -p -r ./packages/react-native-device-activity/ios ./packages/react-native-device-activity/targets ./apps/example/ios
apps/example/ios/Pods/SwiftLint/swiftlint lint --fix
swift format -i -p -r ./packages/react-native-device-activity/ios/Tests ./packages/react-native-device-activity/targets ./packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample
swift format -i -p ./packages/react-native-device-activity/ios/Shared.swift ./packages/react-native-device-activity/ios/ReactNativeDeviceActivityModule.swift ./packages/react-native-device-activity/ios/ReactNativeDeviceActivityView.swift ./packages/react-native-device-activity/ios/ReactNativeDeviceActivityViewPersisted.swift ./packages/react-native-device-activity/ios/ScreenTimeActivityPicker.swift
packages/react-native-device-activity/ios/TestHarness/Pods/SwiftLint/swiftlint lint --fix --config .swiftlint.yml
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm run pre-push
bun run pre-push
4 changes: 2 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ __tests__
/android/src/androidTest/
/android/src/test/
/android/build/
/example/
/apps/example/

# Test files
*.test.ts
Expand All @@ -18,4 +18,4 @@ __tests__
__tests__/

# seems like something is causing example to get installed recursively (bun bug?)
example
apps/example
15 changes: 15 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules/
bun.lock

# Expo / native generated artifacts
apps/example/.expo/
apps/example/dist/
apps/example/ios/Pods/
apps/example/ios/build/

# Package build output
packages/react-native-device-activity/build/

# iOS test harness generated artifacts
packages/react-native-device-activity/ios/TestHarness/Pods/
packages/react-native-device-activity/ios/TestHarness/build/
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"singleQuote": false,
"semi": true,
"trailingComma": "all"
}
15 changes: 12 additions & 3 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ disabled_rules:
- inclusive_language

included:
- packages/react-native-device-activity/ios
- apps/example/ios
- packages/react-native-device-activity/targets
- packages/react-native-device-activity/ios/ReactNativeDeviceActivityModule.swift
- packages/react-native-device-activity/ios/ReactNativeDeviceActivityView.swift
- packages/react-native-device-activity/ios/ReactNativeDeviceActivityViewPersisted.swift
- packages/react-native-device-activity/ios/ScreenTimeActivityPicker.swift
- packages/react-native-device-activity/ios/Tests
- packages/react-native-device-activity/ios/Shared.swift
- packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample
- packages/react-native-device-activity/targets

excluded:
- packages/react-native-device-activity/ios/TestHarness/Pods
- packages/react-native-device-activity/ios/TestHarness/build
7 changes: 2 additions & 5 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"recommendations": [
"vknabel.vscode-swiftlint",
"swiftlang.swift-vscode"
],
}
"recommendations": ["vknabel.vscode-swiftlint", "swiftlang.swift-vscode"]
}
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"android": {}
}
]
}
}
8 changes: 3 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"cSpell.words": [
"Triggerable"
],
"swiftlint.path": "apps/example/ios/Pods/SwiftLint/swiftlint",
"cSpell.words": ["Triggerable"],
"swiftlint.path": "packages/react-native-device-activity/ios/TestHarness/Pods/SwiftLint/swiftlint",
"swift.SDK": "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.2.sdk"
}
}
86 changes: 77 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,81 @@
# Example project setup
# Repository development setup

The example project is linked specifically to simplify development. This means it's not looking exactly like the published package, but for most intents and purposes it should result in the same outcome.
## Example app config (env-driven)

- The config plugin has a `copyToTargetFolder` option that is set to false. This is to prevent the target folder from being copied to the example project and potentially overwriting the original files.
- The swift files in the targets folder are linked to the root project instead of duplicated. If adding new swift files, try to link them instead of duplicating to keep things clean.
- The entitlements and info.plist files however duplicated - to not mess with the example project/signing etc.
- There is a Shared.swift file that can be accessed by all targets. This is linked to each target in the example project, but in the published package it's copied and duplicated to each target. I prefer this to making more changes in @bacons/xcode package which only supports swift files on the root level of each target directory.
- In addition the example project contains an XCode test target as well as SwiftLint.
The example app uses `apps/example/app.config.ts` so local developer values do not need to be committed.

## Prebuild
Create local env values from the template:

To try out prebuild functionality (i.e. the config plugin) run `bun run prebuild` in the example project (it uses the `INTERNALLY_TEST_EXAMPLE_PROJECT` and `COPY_TO_TARGET_FOLDER` env variables to behave like a published package). This should be used to verify changes are expected, but the result should not in it's full state be commited to the example project, since it will break the DX of the example project as explained above.
```bash
cp apps/example/.env.example apps/example/.env
```

Supported variables:

- `RNDA_APPLE_TEAM_ID`
- `RNDA_APP_GROUP`
- `RNDA_IOS_BUNDLE_ID`
- `RNDA_ANDROID_PACKAGE`

If these variables are missing, `app.config.ts` falls back to stable defaults for this repository.

## Example app follows CNG

The example app no longer tracks `apps/example/ios` and `apps/example/android`.
The example target folder `apps/example/targets` is also generated during prebuild and should not be committed.

Regenerate native folders when needed:

```bash
cd apps/example
bun run prebuild
# or
bun run ios
bun run android
```

## Swift test ownership

Swift test sources are package-owned and live in:

- `packages/react-native-device-activity/ios/Tests`

The iOS test runner lives in:

- `packages/react-native-device-activity/ios/TestHarness`

## SwiftLint setup

The repository runs SwiftLint from the iOS test harness CocoaPods installation:

- `packages/react-native-device-activity/ios/TestHarness/Pods/SwiftLint/swiftlint`

Run this once after cloning (and again if Pod dependencies are cleaned):

```bash
cd packages/react-native-device-activity/ios/TestHarness
pod install
```

Then run repository checks from the root:

```bash
bun run pre-push
```

## Formatting setup

The formatting scripts intentionally call `node ./node_modules/prettier/bin/prettier.cjs` to avoid PATH/bin shadowing from transitive tooling (see [expo/expo#42994](https://github.com/expo/expo/issues/42994)).

## Plugin testing

In addition to app/prebuild validation, config plugin regression tests are defined under:

- `packages/react-native-device-activity/plugin/__tests__`

Run them with:

```bash
cd packages/react-native-device-activity
bun run test:plugin
```
Loading