Skip to content

feat: Remove singleton pattern #198

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

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f8bf6d7
feat: Move everything into `package/`
mrousavy May 10, 2024
a39ab21
Update Podfile.lock
mrousavy May 10, 2024
efbf23e
Create .gitignore
mrousavy May 13, 2024
23b06b3
Update .gitignore
mrousavy May 15, 2024
5d7c8b7
feat: Upgrade Android to new arch C++ only
mrousavy May 15, 2024
4f48e8f
Create C++ loader
mrousavy May 15, 2024
eed7c0f
fix: Fix configs
mrousavy May 15, 2024
2fc4b4e
Update react-native.config.js
mrousavy May 15, 2024
c4d3d8a
Update package.json
mrousavy May 15, 2024
a37b3af
Update useRunOnJS.ts
mrousavy May 15, 2024
d2f184b
Update package.json
mrousavy May 15, 2024
58d75aa
Rename
mrousavy May 15, 2024
6854053
chore: release 2.0.0-beta.1
mrousavy May 15, 2024
84fb2d2
Export Worklets
mrousavy May 15, 2024
25c0c7f
fix: Update CI paths
mrousavy May 15, 2024
09eb3bd
fix: Fix CI
mrousavy May 15, 2024
651f4ac
Remove JSC for simplicity
mrousavy May 15, 2024
0bfd8cc
feat: Upgrade Example app
mrousavy May 15, 2024
1030273
feat: Create `NativeWorkletsModule` CXX
mrousavy May 15, 2024
a40ee2b
Format
mrousavy May 15, 2024
15552fd
Try to refactor everything away from static singletons....
mrousavy May 15, 2024
cac72f3
oh my god
mrousavy May 16, 2024
a16079f
fix: Fix decorators again
mrousavy May 16, 2024
6201411
fix: Fix ctx throwing
mrousavy May 16, 2024
f03a4d7
Update WKTJsiWorkletContext.h
mrousavy May 16, 2024
224887f
Update WKTJsiWorklet.h
mrousavy May 16, 2024
f042e4f
feat: Try to clean up createRunInContext
mrousavy May 16, 2024
ada3a53
feat: Rewrite the whole `createCallInContext` logic into `FunctionInv…
mrousavy May 16, 2024
30e3d79
fix: Implement createRunOnJS - stub out Promise
mrousavy May 16, 2024
6eebe9c
feat: Create `FunctionInvoker:: callAndForget`
mrousavy May 16, 2024
e179d2f
fix: Try to use simple Promise approach... fails
mrousavy May 16, 2024
6f022fc
Revert "fix: Try to use simple Promise approach... fails"
mrousavy May 16, 2024
6d224ee
Update types.ts
mrousavy May 16, 2024
f619ec4
Add Invoker again
mrousavy May 16, 2024
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
23 changes: 13 additions & 10 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,27 @@ on:
- main
paths:
- '.github/workflows/build-android.yml'
- 'android/**'
- 'cpp/**'
- 'example/android/**'
- 'yarn.lock'
- 'example/yarn.lock'
- 'package/android/**'
- 'package/cpp/**'
- 'package/example/android/**'
- 'package/yarn.lock'
- 'package/example/yarn.lock'
pull_request:
paths:
- '.github/workflows/build-android.yml'
- 'android/**'
- 'cpp/**'
- 'example/android/**'
- 'yarn.lock'
- 'example/yarn.lock'
- 'package/android/**'
- 'package/cpp/**'
- 'package/example/android/**'
- 'package/yarn.lock'
- 'package/example/yarn.lock'

jobs:
build_example:
name: Build Android Example App
runs-on: ubuntu-latest
defaults:
run:
working-directory: package
steps:
- uses: actions/checkout@v2

Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ on:
- main
paths:
- '.github/workflows/build-ios.yml'
- 'ios/**'
- 'cpp/**'
- '*.podspec'
- 'example/ios/**'
- 'package/ios/**'
- 'package/cpp/**'
- 'package/*.podspec'
- 'package/example/ios/**'
pull_request:
paths:
- '.github/workflows/build-ios.yml'
- 'ios/**'
- 'cpp/**'
- '*.podspec'
- 'example/ios/**'
- 'package/ios/**'
- 'package/cpp/**'
- 'package/*.podspec'
- 'package/example/ios/**'

jobs:
build:
name: Build iOS Example App
runs-on: macOS-latest
defaults:
run:
working-directory: example/ios
working-directory: package/example/ios
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -53,13 +53,13 @@ jobs:
with:
ruby-version: '2.7.6'
bundler-cache: true
working-directory: example
working-directory: package/example

- name: Restore Pods cache
uses: actions/cache@v2
with:
path: |
example/ios/Pods
package/example/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: package
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -21,10 +24,13 @@ jobs:
run: yarn lint

- name: Typecheck files
run: yarn typecheck
run: yarn typescript

test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: package
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -37,6 +43,9 @@ jobs:

build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: package
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/validate-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Validate C++

on:
push:
branches:
- main
paths:
- '.github/workflows/validate-cpp.yml'
- 'package/cpp/**'
- 'package/android/src/main/cpp/**'
- 'package/ios/**'
pull_request:
paths:
- '.github/workflows/validate-cpp.yml'
- 'package/cpp/**'
- 'package/android/src/main/cpp/**'
- 'package/ios/**'

jobs:
lint:
name: Check clang-format
runs-on: ubuntu-latest
strategy:
matrix:
path:
- 'package/cpp'
- 'package/android/src/main/cpp'
- 'package/ios'
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check
uses: jidicula/[email protected]
with:
clang-format-version: '16'
check-path: ${{ matrix.path }}

74 changes: 4 additions & 70 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,70 +1,4 @@
# OSX
#
.DS_Store

# XDE
.expo/

# VSCode
.vscode/
jsconfig.json

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IJ
#
.classpath
.cxx
.gradle
.idea
.project
.settings
local.properties
android.iml

# Cocoapods
#
example/ios/Pods

# Ruby
example/vendor/

# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore

# Expo
.expo/

# Turborepo
.turbo/

# generated by bob
lib/
/example
/lib
/node_modules
/react-native-worklets
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

3 changes: 0 additions & 3 deletions .yarnrc

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Note the `"fabric":true` and `"concurrentRoot":true` properties.
Make sure your code passes TypeScript and ESLint. Run the following to verify:

```sh
yarn typecheck
yarn typescript
yarn lint
```

Expand Down Expand Up @@ -119,7 +119,7 @@ yarn release
The `package.json` file contains various scripts for common tasks:

- `yarn bootstrap`: setup project by installing all dependencies and pods.
- `yarn typecheck`: type-check files with TypeScript.
- `yarn typescript`: type-check files with TypeScript.
- `yarn lint`: lint files with ESLint.
- `yarn test`: run unit tests with Jest.
- `yarn example start`: start the Metro server for the example app.
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ const worklet = () => {
}
```

> [!NOTE]
> In most cases, react-native-worklets-core shouldn't be used as a standalone dependency but rather as a peer-dependency for other modules such as [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera), [react-native-wishlist](https://github.com/margelo/react-native-wishlist), or [react-native-skia](https://github.com/Shopify/react-native-skia).

## Installation

1. Install the library from npm:
Expand All @@ -37,6 +34,12 @@ const worklet = () => {
yarn start --reset-cache
```

## Requirements

- Requires react-native 0.74 or higher
- Requires the [new architecture](https://reactnative.dev/docs/the-new-architecture/landing-page) to be enabled
- Requires [Hermes](https://reactnative.dev/docs/hermes)

## Usage

See [USAGE.md](docs/USAGE.md)
Expand Down
96 changes: 0 additions & 96 deletions android/CMakeLists.txt

This file was deleted.

Loading