Skip to content

Commit

Permalink
chore: expo example (#8)
Browse files Browse the repository at this point in the history
* move the package and the app

* update yarn

* make sure the example is working

* fix linting

* update ci

* fixup! make sure the example is working

* release it dependency

* add expo app

* add bundle identifiers

* create example

* mention expo

* update ci

* update comment
  • Loading branch information
atlj authored Sep 15, 2024
1 parent 17458f4 commit c4406e6
Show file tree
Hide file tree
Showing 112 changed files with 8,876 additions and 7,468 deletions.
15 changes: 0 additions & 15 deletions .editorconfig

This file was deleted.

26 changes: 26 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
root: true,
"extends": [
"@react-native",
"prettier",
"plugin:prettier/recommended"
],
"rules": {
"react/react-in-jsx-scope": "off",
"prettier/prettier": [
"error",
{
"quoteProps": "consistent",
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
]
},
ignorePatterns: [
'**/lib/**',
'**/dist/**',
'**/node_modules/**',
],
};
3 changes: 0 additions & 3 deletions .gitattributes

This file was deleted.

20 changes: 4 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ jobs:
- name: Typecheck files
run: yarn typecheck

test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Run unit tests
run: yarn test --maxWorkers=2 --coverage

build-library:
runs-on: ubuntu-latest
steps:
Expand All @@ -48,7 +36,7 @@ jobs:
uses: ./.github/actions/setup

- name: Build package
run: yarn prepare
run: yarn library prepare

build-android:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -96,7 +84,7 @@ jobs:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
key: ${{ runner.os }}-gradle-${{ hashFiles('apps/bare/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
Expand Down Expand Up @@ -140,14 +128,14 @@ jobs:
with:
path: |
**/ios/Pods
key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
key: ${{ runner.os }}-cocoapods-${{ hashFiles('apps/bare/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-cocoapods-
- name: Install cocoapods
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
run: |
cd example/ios
cd apps/bare/ios
pod install
env:
NO_FLIPPER: 1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
uses: ./.github/actions/setup

- name: Prepare
run: yarn prepare
run: cd packages/react-native-background-remover && yarn prepare

- name: Publish
run: npm publish --provenance --access public
run: cd packages/react-native-background-remover && npm publish --provenance --access public
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ android.iml

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

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

# node.js
#
Expand Down
541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.1.cjs

This file was deleted.

925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.5.0.cjs

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
nodeLinker: node-modules
compressionLevel: mixed

enableGlobalCache: false

nmHoistingLimits: workspaces

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.6.1.cjs
yarnPath: .yarn/releases/yarn-4.5.0.cjs
36 changes: 13 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ We want this community to be friendly and respectful to each other. Please follo

This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages:

- The library package in the root directory.
- An example app in the `example/` directory.
- The library package in the packages/react-native-background-remover directory.
- An example app in the `apps/bare` directory.

To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:

Expand All @@ -19,40 +19,40 @@ yarn

> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.
The [example app](/apps/bare/) demonstrates usage of the library. You need to run it to test any changes you make.

It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.

If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/BackgroundRemoverExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-background-remover`.
If you want to use Android Studio or XCode to edit the native code, you can open the `bare/android` or `bare/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `bare/ios/BackgroundRemoverExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-background-remover`.

To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-background-remover` under `Android`.
To edit the Java or Kotlin files, open `bare/android` in Android studio and find the source files at `react-native-background-remover` under `Android`.

You can use various commands from the root directory to work with the project.

To start the packager:

```sh
yarn example start
yarn bare start
```

To run the example app on Android:

```sh
yarn example android
yarn bare android
```

To run the example app on iOS:

```sh
yarn example ios
yarn bare ios
```

By default, the example is configured to build with the old architecture. To run the example with the new architecture, you can do the following:

1. For Android, run:

```sh
ORG_GRADLE_PROJECT_newArchEnabled=true yarn example android
ORG_GRADLE_PROJECT_newArchEnabled=true yarn bare android
```

2. For iOS, run:
Expand All @@ -61,7 +61,7 @@ By default, the example is configured to build with the old architecture. To run
cd example/ios
RCT_NEW_ARCH_ENABLED=1 pod install
cd -
yarn example ios
yarn bare ios
```

If you are building for a different architecture than your previous build, make sure to remove the build folders first. You can run the following command to cleanup all build folders:
Expand All @@ -80,6 +80,8 @@ Note the `"fabric":true` and `"concurrentRoot":true` properties.

Make sure your code passes TypeScript and ESLint. Run the following to verify:

> Or alternatively, you can use the Expo example in apps/expo. Make sure to call `expo prebuild` while working with the Expo app.
```sh
yarn typecheck
yarn lint
Expand All @@ -88,7 +90,7 @@ yarn lint
To fix formatting errors, run the following:

```sh
yarn lint --fix
yarn lint:fix
```

Remember to add tests for your change if possible. Run the unit tests by:
Expand Down Expand Up @@ -128,18 +130,6 @@ To publish new versions, run the following:
yarn release
```

### Scripts

The `package.json` file contains various scripts for common tasks:

- `yarn`: setup project by installing dependencies.
- `yarn typecheck`: 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.
- `yarn example android`: run the example app on Android.
- `yarn example ios`: run the example app on iOS.

### Sending a pull request

> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit c4406e6

Please sign in to comment.